From 9ce3fa2b2de12b617d74b5505d27dd092d5b49d6 Mon Sep 17 00:00:00 2001 From: James Broadhead Date: Fri, 2 Dec 2016 13:18:50 +0000 Subject: [PATCH] shellcheck scripts/install-nix-from-closure.sh --- scripts/install-nix-from-closure.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh index fd38a4528..1b4d92632 100644 --- a/scripts/install-nix-from-closure.sh +++ b/scripts/install-nix-from-closure.sh @@ -7,7 +7,7 @@ self="$(dirname "$0")" nix="@nix@" cacert="@cacert@" -if ! [ -e $self/.reginfo ]; then +if ! [ -e "$self/.reginfo" ]; then echo "$0: incomplete installer (.reginfo is missing)" >&2 exit 1 fi @@ -39,10 +39,10 @@ fi mkdir -p $dest/store -echo -n "copying Nix to $dest/store..." >&2 +printf "copying Nix to %s..." "${dest}/store" >&2 -for i in $(cd $self/store >/dev/null && echo *); do - echo -n "." >&2 +for i in $(cd "$self/store" >/dev/null && echo ./*); do + printf "." >&2 i_tmp="$dest/store/$i.$$" if [ -e "$i_tmp" ]; then rm -rf "$i_tmp" @@ -63,20 +63,20 @@ if ! $nix/bin/nix-store --init; then exit 1 fi -if ! $nix/bin/nix-store --load-db < $self/.reginfo; then +if ! "$nix/bin/nix-store" --load-db < "$self/.reginfo"; then echo "$0: unable to register valid paths" >&2 exit 1 fi -. $nix/etc/profile.d/nix.sh +. "$nix/etc/profile.d/nix.sh" -if ! $nix/bin/nix-env -i "$nix"; then +if ! "$nix/bin/nix-env" -i "$nix"; then echo "$0: unable to install Nix into your default profile" >&2 exit 1 fi # Install an SSL certificate bundle. -if [ -z "$NIX_SSL_CERT_FILE" -o ! -f "$NIX_SSL_CERT_FILE" ]; then +if [ -z "$NIX_SSL_CERT_FILE" ] || ! [ -f "$NIX_SSL_CERT_FILE" ]; then $nix/bin/nix-env -i "$cacert" export NIX_SSL_CERT_FILE="$HOME/.nix-profile/etc/ssl/certs/ca-bundle.crt" fi @@ -100,7 +100,7 @@ if [ -z "$NIX_INSTALLER_NO_MODIFY_PROFILE" ]; then if [ -w "$fn" ]; then if ! grep -q "$p" "$fn"; then echo "modifying $fn..." >&2 - echo "if [ -e $p ]; then . $p; fi # added by Nix installer" >> $fn + echo "if [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn" fi added=1 break