Merge pull request #1144 from jamesbroadhead/shellcheck_install

shellcheck scripts/install-nix-from-closure.sh
This commit is contained in:
Domen Kožar 2016-12-22 10:34:15 +00:00 committed by GitHub
commit 2d801bf0a4

View file

@ -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