diff --git a/PKGBUILD b/PKGBUILD index ca76813..6f667b6 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Matthias Quintern pkgname=msynk -pkgver=1.0 +pkgver=1.1 pkgrel=1 pkgdesc="rsync helper that supports encryption and presets" arch=('any') diff --git a/_msynk.compdef.zsh b/_msynk.compdef.zsh index d04fd0b..8c48e7a 100644 --- a/_msynk.compdef.zsh +++ b/_msynk.compdef.zsh @@ -32,6 +32,7 @@ _msynk() {--verbose,-v}'[Increase verbosity.]' \ '--silent[Decrease verbosity.]' \ '--debug[Maximum verbosity.]' \ + '--exclude[Interpret positional arguments as blacklist]' \ '*:file or directory:_files' } _msynk "$@" diff --git a/msynk.1.man b/msynk.1.man index 582bf4d..986f044 100644 --- a/msynk.1.man +++ b/msynk.1.man @@ -1,6 +1,6 @@ -.\" Automatically generated by Pandoc 2.14.2 +.\" Automatically generated by Pandoc 2.17.0.1 .\" -.TH "MSYNK" "1" "March 2022" "msynk 1.0" "" +.TH "MSYNK" "1" "March 2022" "msynk 1.1" "" .hy .SH NAME .PP @@ -11,7 +11,8 @@ Local: .PD 0 .P .PD -\ \ \ \f[B]msynk\f[R] [OPTION\&...] -r DEST_DIR -s SOURCE_DIR PATHS\&... +\ \ \ \f[B]msynk\f[R] [OPTION\&...] +-r DEST_DIR -s SOURCE_DIR PATHS\&... .PP Via remote shell: .PD 0 @@ -21,8 +22,8 @@ Via remote shell: .PD 0 .P .PD -\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...] -r -[USER\[at]]HOST:DEST_DIR -s SOURCE_DIR PATHS\&... +\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...] +-r [USER\[at]]HOST:DEST_DIR -s SOURCE_DIR PATHS\&... .PD 0 .P .PD @@ -30,14 +31,15 @@ Via remote shell: .PD 0 .P .PD -\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...] -r DEST_DIR -s -[USER\[at]]HOST:SOURCE_DIR PATHS\&... +\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...] +-r DEST_DIR -s [USER\[at]]HOST:SOURCE_DIR PATHS\&... .PP Using a configuration file: .PD 0 .P .PD -\ \ \ \ \f[B]msynk\f[R] [OPTION\&...] -c CONFIG NAME [SELECTIONS\&...] +\ \ \ \ \f[B]msynk\f[R] [OPTION\&...] +-c CONFIG NAME [SELECTIONS\&...] .SH DESCRIPTION .PP \f[B]msynk\f[R] uses \f[I]rsync\f[R] to synchronise files or directories @@ -197,6 +199,9 @@ mkrypt. \f[B]\[em]-debug\f[R] Maximum verbosity: -v but also print out rsync and mkrypt commands. .TP +\f[B]\[em]-exclude\f[R] +Interpret positional arguments as blacklist, not whitelist. +.TP \f[B]positional arguments\f[R] If you are using a config file: pos. args. diff --git a/msynk.1.md b/msynk.1.md index 2fd9d2e..8d0f25d 100644 --- a/msynk.1.md +++ b/msynk.1.md @@ -1,4 +1,4 @@ -% MSYNK(1) msynk 1.0 +% MSYNK(1) msynk 1.1 % Matthias Quintern % March 2022 @@ -102,6 +102,9 @@ You can then run this with: "msynk -c my_backup"\, or if you only want to sync t **--debug** : Maximum verbosity: -v but also print out rsync and mkrypt commands. +**--exclude** +: Interpret positional arguments as blacklist, not whitelist. + **positional arguments** : If you are using a config file: pos. args. are strings that have to be contained in a path in order for it to be synced. If no pos. args. are given, all files are synced. : If you are not using a config file: pos. args. are filepaths relative to the sender directory. diff --git a/msynk.sh b/msynk.sh index 223f12f..6e2b28b 100755 --- a/msynk.sh +++ b/msynk.sh @@ -55,10 +55,18 @@ check_path_in_args() fi for string in ${paths_2[@]}; do if [[ $path == *$string* ]]; then - return 0 + if [[ $exclude = 1 ]]; then + return 1 + else + return 0 + fi fi done - return 1 + if [[ $exclude = 1 ]]; then + return 0 + else + return 1 + fi } @@ -181,6 +189,8 @@ show_help() --silent Decrease verbosity. --debug Maximum verbosity. +--exclude Interpret positional arguments as blacklist + Positional arguments are: - if using a config: a string that must be in the configs paths: eg. 'foo' will include ~/foo but not ~/bar - if not using a config: paths to sync (must be relative to --sender) @@ -295,6 +305,9 @@ while (( "$#" )); do rsync_flags+=(-v) mkrypt_flags+=(-v) shift;; + --exclude) + exclude=1 + shift ;; -*|--*=) # unsupported flags printf "$FMT_ERROR" "Unsupported flag $1" >&2 exit 1 ;; diff --git a/readme.md b/readme.md index 015ce82..e071d1e 100644 --- a/readme.md +++ b/readme.md @@ -47,6 +47,7 @@ You can then run this with: `msynk -c my_backup`, or if you only want to sync th - `-v, --verbose` Increase verbosity: Passes -v to rsync and mkrypt. - `--silent` Decrease verbosity: Print only error messages and passes --silent to mkrypt. - `--debug` Maximum verbosity: -v but also print out rsync and mkrypt commands. +- `--exclude` Interpret positional arguments as blacklist, not as whitelist. - `positional arguments` If you are using a config file: pos. args. are strings that have to be contained in a path in order for it to be synced. If no pos. args. are given, all files are synced. If you are not using a config file: pos. args. are filepaths relative to the sender directory. ## Troubleshooting @@ -55,6 +56,10 @@ When using --encrypt, the data is encrypted to a temporary directory $TMP_DIR, w 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 `sudo mount -o remount,size=XXG,noatime /tmp` if your $TMP_DIR is on /tmp and you have at least XXGB memory+swap space. +## Changelog +### 1.1 +- Added --exclude + ## COPYRIGHT Copyright © 2022 Matthias Quintern. License GPLv3+: GNU GPL version 3 .\ This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.