From ae30c173eddd217144d6cb1db4c272261c09ba68 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 27 May 2019 17:48:55 +0200 Subject: Use mapfile in backup apps Fix shellcheck warning SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). --- modules/apps/filebackup.nix | 4 ++-- modules/apps/mysqlbackup.nix | 4 ++-- modules/apps/pgbackup.nix | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') 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 \ -- cgit v1.2.3