diff options
| author | Igor Pashev <pashev.igor@gmail.com> | 2019-05-27 17:48:55 +0200 |
|---|---|---|
| committer | Igor Pashev <pashev.igor@gmail.com> | 2019-05-27 17:48:55 +0200 |
| commit | ae30c173eddd217144d6cb1db4c272261c09ba68 (patch) | |
| tree | 897fac11b1f54362a564b9b2df778299a6d2c9ae | |
| parent | f030c9a9d1dad41e84e034ff4b8c6ee75d5bf3fe (diff) | |
| download | nixsap-ae30c173eddd217144d6cb1db4c272261c09ba68.tar.gz | |
Use mapfile in backup apps
Fix shellcheck warning SC2207:
Prefer mapfile or read -a to split command output (or quote to avoid
splitting).
| -rw-r--r-- | modules/apps/filebackup.nix | 4 | ||||
| -rw-r--r-- | modules/apps/mysqlbackup.nix | 4 | ||||
| -rw-r--r-- | modules/apps/pgbackup.nix | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/modules/apps/filebackup.nix b/modules/apps/filebackup.nix index 55412a1..e6760bd 100644 --- a/modules/apps/filebackup.nix +++ b/modules/apps/filebackup.nix @@ -80,8 +80,8 @@ let mv "$tarball".tmp "$tarball" ${optionalString (gpgPubKeys != []) '' - recipient=( $(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ - ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') ) + mapfile -t recipient < <(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ + ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') r=( "''${recipient[@]/#/-r}" ) ${gpg} --homedir '${privateDir}/gnupg' --batch --no-tty --yes \ "''${r[@]}" --trust-model always \ diff --git a/modules/apps/mysqlbackup.nix b/modules/apps/mysqlbackup.nix index 8e87da6..96e5f08 100644 --- a/modules/apps/mysqlbackup.nix +++ b/modules/apps/mysqlbackup.nix @@ -182,8 +182,8 @@ let mv "$dump".tmp "$dump" ${optionalString (gpgPubKeys != []) '' - recipient=( $(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ - ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') ) + mapfile -t recipient < <(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ + ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') r=( "''${recipient[@]/#/-r}" ) ${gpg} --homedir '${privateDir}/gnupg' --batch --no-tty --yes \ "''${r[@]}" --trust-model always \ diff --git a/modules/apps/pgbackup.nix b/modules/apps/pgbackup.nix index 2cde338..8eb0726 100644 --- a/modules/apps/pgbackup.nix +++ b/modules/apps/pgbackup.nix @@ -130,8 +130,8 @@ let } ${optionalString (gpgPubKeys != []) '' - recipient=( $(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ - ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') ) + mapfile -t recipient < <(${gpg} --homedir '${privateDir}/gnupg' -k --with-colons --fast-list-mode | \ + ${pkgs.gawk}/bin/awk -F: '/^pub/{print $5}') r=( "''${recipient[@]/#/-r}" ) ${gpg} --homedir '${privateDir}/gnupg' --batch --no-tty --yes \ "''${r[@]}" --trust-model always \ |
