From 68833cf242ac080f3f03b2839b92f02c71c70f79 Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Mon, 4 Apr 2022 03:27:05 +0200 Subject: [PATCH] Updated md5sums --- PKGBUILD | 20 ++++++++++---------- msynk.1.man | 46 ++++++++++++++++++++++++++++++++++------------ msynk.sh | 7 ++++--- 3 files changed, 48 insertions(+), 25 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 2437e87..38bf134 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,25 +8,25 @@ url="https:/github.com/MatthiasQuintern/msynk" license=('GPL3') depends=('rsync') optdepends=('mkrypt: for encryption') -source=(msynk.sh _msynk.compdef.zsh) -md5sums=(8a25fcee8c895632f5216933b2058c68 f621c7793781a8e2684eba8c17d6a029) +source=(msynk.sh _msynk.compdef.zsh msynk.1.man template) +md5sums=(3350dd60fd45dee9e5d7254d8d360da9 f621c7793781a8e2684eba8c17d6a029 1f320b6b18c4535cf38f75f66cdc3c02 492028aa2f08528f1d476376884959b2) package() { mkdir -p "${pkgdir}/usr/bin" cp "${srcdir}/msynk.sh" "${pkgdir}/usr/bin/msynk" chmod +x "${pkgdir}/usr/bin/msynk" - mkdir -p "${pkgdir}/usr/share/local/man/man1/" - cp "msynk.1.man" "${pkgdir}/usr/share/local/man/man1/msynk.1" + mkdir -p "${pkgdir}/usr/share/man/man1/" + cp "${srcdir}/msynk.1.man" "${pkgdir}/usr/share/man/man1/msynk.1" - mkdir -p "${pkdir}/usr/share/msynk" - cp "template" "${pkdir}/usr/share/msynk/template" - chmod +x "${pkdir}/usr/share/msynk/template" + mkdir -p "${pkgdir}/usr/share/msynk" + cp "${srcdir}/template" "${pkgdir}/usr/share/msynk/template" + chmod +x "${pkgdir}/usr/share/msynk/template" # if using zsh if [[ -n $ZSH_VERSION ]]; then - mkdir -p "${pkdir}/usr/share/zsh/site-functions" - cp "${srcdir}/_msynk.compdef.zsh" "${pkdir}/usr/share/zsh/site-functions/_msynk" - chmod +x "${pkdir}/usr/share/zsh/site-functions/_msynk" + mkdir -p "${pkgdir}/usr/share/zsh/site-functions" + cp "${srcdir}/_msynk.compdef.zsh" "${pkgdir}/usr/share/zsh/site-functions/_msynk" + chmod +x "${pkgdir}/usr/share/zsh/site-functions/_msynk" fi } diff --git a/msynk.1.man b/msynk.1.man index e1bbedd..582bf4d 100644 --- a/msynk.1.man +++ b/msynk.1.man @@ -79,7 +79,10 @@ If you just want to add a flag, use rsync_flags+=(-yourflag) .PD 0 .P .PD -- use_encryption: 0 for no, 1 for yes +- use_encryption: 0 for no, 1 for yes\ A template config file is stored +in /usr/share/msynk. +You can change the location of the configuration directory by replacing +$CONFIG_DIR with your directory in /usr/bin/msynk .SS Example .PP To sync the directories \[lq]/home/user/foo\[rq] @@ -118,9 +121,12 @@ Show a list of arguments. Show the current settings. .TP \f[B]-c\f[R], \f[B]\[em]-config\f[R] config-name -Retrieve settings from config file +Retrieve settings from a config file in $CONFIG_DIR, eg \[ti]/.config/msynk/\f[I]config-name\f[R] .TP +\f[B]\[em]-show-config\f[R] config-name +Print variables defined from a config with \f[I]config-name\f[R]. +.TP \f[B]-s\f[R], \f[B]\[em]-sender\f[R] path Set sender to directory. This can also be a remote, like user\[at]domain.com:/dir. @@ -150,17 +156,19 @@ The files are synced to $TMP_DIR and then decrypted to the receiver directory. Does not work with \[em]-delete. .TP -\f[B]\[em]-date\f[R] +\f[B]\[em]-check-date\f[R] Can be used with -c and \[em]-encrypt or \[en]decrypt: When running \f[B]msynk\f[R] with a config, the current date is stored in the config file. -When running with \[em]-date, only files that have been modified after -the date stored in the config file are processed (by passing\[en]date -[date the config was last run] to \f[I]mkrypt\f[R]). +When running with \[em]-check-date, only files that have been modified +after the date stored in the config file are processed (by +passing\[en]date [date the config was last run] to \f[I]mkrypt\f[R]). .TP -\f[B]\[em]-mkrypt-flags\f[R] flags -Additional flags for \f[I]mkrypt\f[R]. -You can use this to set the key for the encryption. +\f[B]\[em]-mkrypt-flag\f[R] arg +Additional argument for \f[I]mkrypt\f[R], for example to set the key for +the encryption. +Only pass one argument at a time, so for passing two use +`\[em]-mkrypt-flag \[lq]arg1\[rq] \[en]mkrypt-flag \[lq]arg2\[rq]' .TP \f[B]-d\f[R], \f[B]\[em]-delete\f[R] \f[I]rsync\f[R] \[em]-delete option. @@ -173,9 +181,11 @@ will be deleted and prompt you wether you want continue (unless Can be used with \[em]-delete. This skips listing the files that will be deleted and the prompt. .TP -\f[B]\[em]-rsync-flags\f[R] flags -Additional flags for \f[I]rsync\f[R]. -You can use this to set the port for the connection. +\f[B]\[em]-rsync-flag\f[R] arg +Additional argument for \f[I]rsync\f[R], for example to set the port for +the connection. +Only pass one argument at a time, so for passing two use +`\[em]-rsync-flag \[lq]arg1\[rq] \[en]rsync-flag \[lq]arg2\[rq]' .TP \f[B]-v\f[R], \f[B]\[em]-verbose\f[R] Increase verbosity: Passes -v to rsync and mkrypt. @@ -198,6 +208,18 @@ are given, all files are synced. If you are not using a config file: pos. args. are filepaths relative to the sender directory. +.SH Troubleshooting +.SS Not enough space when using encryption +.PP +When using \[em]-encrypt, the data is encrypted to a temporary directory +$TMP_DIR, when using \[en]decrypt the encrypted date is copied to the +$TMP_DIR and then decrypted. +The $TMP_DIR defaults to /tmp/mksynk and /tmp is usually limited to half +the size of your memory. +You change the $TMP_DIR in the script in /usr/bin/msynk or temporarily +increase the size of the tmpfs by running \[lq]sudo mount -o +remount,size=XXG,noatime /tmp\[rq] if your $TMP_DIR is on /tmp and you +have at least XXGB memory+swap space. .SH COPYRIGHT .PP Copyright \[co] 2022 Matthias Quintern. diff --git a/msynk.sh b/msynk.sh index bccc9ca..223f12f 100755 --- a/msynk.sh +++ b/msynk.sh @@ -103,7 +103,8 @@ sync_sender_to_receiver() printf "$FMT_ERROR" "Invalid path: $path"; exit 1 fi if [[ -n $encrypt || -n $decrypt ]]; then - [[ -d "$path" ]] && tmp_source="$TMP_DIR" + mkdir -p "$TMP_DIR" + tmp_source="$TMP_DIR" if [[ -n $encrypt ]]; then # check if TMP_DIR has enough space @@ -124,7 +125,7 @@ sync_sender_to_receiver() [[ -f $path ]] && tmp_source=$TMP_DIR$(basename $path) [[ $v -ge 3 ]] && printf "$FMT_CMD" "rsync ${rsync_flags[*]} $path $TMP_DIR" rsync "${rsync_flags[@]}" "$path" "$TMP_DIR" || { printf "$FMT_ERROR" "rsync exited with exit code $?"; exit 2; } - [[ $v -ge 3 ]] && printf "$FMT_CMD" "bash $mkrypt --decrypt $tmp_source --output $(readlink -f $dest) ${mkrypt_flags[@]}" + [[ $v -ge 3 ]] && printf "$FMT_CMD" "bash $mkrypt --decrypt $tmp_source --output $(readlink -f $dest) ${mkrypt_flags[*]}" bash $mkrypt --decrypt "$tmp_source" --output "$(readlink -f "$dest")" ${mkrypt_flags[@]} || exit 3 fi else @@ -326,7 +327,7 @@ if [[ -n $config ]]; then if [[ $use_encryption = 1 ]]; then [[ -z $reverse ]] && encrypt=1 || decrypt=1 fi - [[ $v -ge 3 ]] && printf "$FMT_MESSAGE" "Loaded config:" "$CONFIG_DIR$config:: date:$date sender:$sender receiver:$receiver use_encryption:$use_encryption encrypt:$encrypt decrypt:$decrypt paths:${paths[*]}" + [[ $v -ge 3 ]] && printf "$FMT_MESSAGE" "Loaded config:" "$CONFIG_DIR$config: date:$date sender:$sender receiver:$receiver use_encryption:$use_encryption encrypt:$encrypt decrypt:$decrypt paths:${paths[*]}" fi # overwrite stuff from the config if anything else was given / set variables of no config was given