Merge pull request #1144 from jamesbroadhead/shellcheck_install
shellcheck scripts/install-nix-from-closure.sh
This commit is contained in:
		
						commit
						2d801bf0a4
					
				
					 1 changed files with 9 additions and 9 deletions
				
			
		| 
						 | 
					@ -7,7 +7,7 @@ self="$(dirname "$0")"
 | 
				
			||||||
nix="@nix@"
 | 
					nix="@nix@"
 | 
				
			||||||
cacert="@cacert@"
 | 
					cacert="@cacert@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! [ -e $self/.reginfo ]; then
 | 
					if ! [ -e "$self/.reginfo" ]; then
 | 
				
			||||||
    echo "$0: incomplete installer (.reginfo is missing)" >&2
 | 
					    echo "$0: incomplete installer (.reginfo is missing)" >&2
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -39,10 +39,10 @@ fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkdir -p $dest/store
 | 
					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
 | 
					for i in $(cd "$self/store" >/dev/null && echo ./*); do
 | 
				
			||||||
    echo -n "." >&2
 | 
					    printf "." >&2
 | 
				
			||||||
    i_tmp="$dest/store/$i.$$"
 | 
					    i_tmp="$dest/store/$i.$$"
 | 
				
			||||||
    if [ -e "$i_tmp" ]; then
 | 
					    if [ -e "$i_tmp" ]; then
 | 
				
			||||||
        rm -rf "$i_tmp"
 | 
					        rm -rf "$i_tmp"
 | 
				
			||||||
| 
						 | 
					@ -63,20 +63,20 @@ if ! $nix/bin/nix-store --init; then
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					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
 | 
					    echo "$0: unable to register valid paths" >&2
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					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
 | 
					    echo "$0: unable to install Nix into your default profile" >&2
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install an SSL certificate bundle.
 | 
					# 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"
 | 
					    $nix/bin/nix-env -i "$cacert"
 | 
				
			||||||
    export NIX_SSL_CERT_FILE="$HOME/.nix-profile/etc/ssl/certs/ca-bundle.crt"
 | 
					    export NIX_SSL_CERT_FILE="$HOME/.nix-profile/etc/ssl/certs/ca-bundle.crt"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -100,7 +100,7 @@ if [ -z "$NIX_INSTALLER_NO_MODIFY_PROFILE" ]; then
 | 
				
			||||||
        if [ -w "$fn" ]; then
 | 
					        if [ -w "$fn" ]; then
 | 
				
			||||||
            if ! grep -q "$p" "$fn"; then
 | 
					            if ! grep -q "$p" "$fn"; then
 | 
				
			||||||
                echo "modifying $fn..." >&2
 | 
					                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
 | 
					            fi
 | 
				
			||||||
            added=1
 | 
					            added=1
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue