Sync single file
This commit is contained in:
parent
1fac9d0564
commit
ba3a862dad
|
@ -21,5 +21,7 @@ pgpkey = ID
|
||||||
rawpath = /path/to/json/dir
|
rawpath = /path/to/json/dir
|
||||||
# path in which signed files will be stored
|
# path in which signed files will be stored
|
||||||
path = /path/to/dir
|
path = /path/to/dir
|
||||||
# if synccmd can be empty, if no synchronization command is needed
|
# if synccmd can be empty, if no synchronization command is needed. Placeholders:
|
||||||
;synccmd = rclone /path/to/dir Remote:dir
|
# %s - signed file
|
||||||
|
# %u - unsigned file
|
||||||
|
;synccmd = rclone %s Remote:dir
|
||||||
|
|
|
@ -110,10 +110,16 @@ function create_text_file($cfg, $body) {
|
||||||
}
|
}
|
||||||
file_put_contents($file_path, "\n\n\n", FILE_APPEND);
|
file_put_contents($file_path, "\n\n\n", FILE_APPEND);
|
||||||
shell_exec("gpg --yes --clearsign " . $file_path);
|
shell_exec("gpg --yes --clearsign " . $file_path);
|
||||||
if (strlen($cfg["export"]["synccmd"]) > 0) {
|
sync_command($cfg, $file_path);
|
||||||
shell_exec($cfg["export"]["synccmd"]);
|
|
||||||
}
|
|
||||||
return trim(shell_exec("/usr/bin/sha256sum " . $file_path. ".asc | awk '{ print $1 }'"));
|
return trim(shell_exec("/usr/bin/sha256sum " . $file_path. ".asc | awk '{ print $1 }'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sync_command($cfg, $file_path) {
|
||||||
|
$cmd = $cfg["export"]["synccmd"];
|
||||||
|
if (strlen($cmd) > 0) {
|
||||||
|
$cmd = str_replace("%s", $file_path . ".asc", $cmd);
|
||||||
|
$cmd = str_replace("%u", $file_path, $cmd);
|
||||||
|
shell_exec($cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue