on master help sign in
nix-bootstrap.sh: fix shellcheck warnings
5672912zimbatm
nix-bootstrap.sh+13−13
@@ -1,35 +1,35 @@
1#!/bin/sh
1#!/bin/sh
2
2
3−cmd=sh
4−if ! [ $# -eq 0 ]; then
3+if [ $# -gt 0 ]; then
5− cmd=$@
4+ set -- sh
6fi
5fi
7
6
8# should download this in the future
7# should download this in the future
9# but the mirror is down
8# but the mirror is down
10−proot=`dirname $0`/proot-`uname -p`
9+proot=$(dirname "$0")/proot-$(uname -p)
11export PROOT_NO_SECCOMP=1
10export PROOT_NO_SECCOMP=1
12
11
13nixdir=$HOME/.nix
12nixdir=$HOME/.nix
14
13
15OLD_NIX_PATH=$NIX_PATH
14OLD_NIX_PATH=$NIX_PATH
15+# shellcheck disable=SC1090
16−if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi
16+if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh"; fi
17−if ! [ -z "$OLD_NIX_PATH" ]; then NIX_PATH="$OLD_NIX_PATH"; fi
17+if [ -n "$OLD_NIX_PATH" ]; then NIX_PATH="$OLD_NIX_PATH"; fi
18
18
19if [ -z "$IN_PROOT" ]; then
19if [ -z "$IN_PROOT" ]; then
20 export IN_PROOT=1
20 export IN_PROOT=1
21
21
22− if ! [ -d $nixdir ]; then
22+ if ! [ -d "$nixdir" ]; then
23− mkdir -p $nixdir
23+ mkdir -p "$nixdir"
24 s=$(mktemp)
24 s=$(mktemp)
25− curl https://nixos.org/nix/install -o $s
25+ curl https://nixos.org/nix/install -o "$s"
26− $proot -b $nixdir:/nix $0 sh $s
26+ $proot -b "$nixdir:/nix" "$0" sh "$s"
27 fi
27 fi
28
28
29− $proot -b $nixdir:/nix $0 $cmd
29+ $proot -b "$nixdir:/nix" "$0" "$@"
30
30
31 export IN_PROOT=
31 export IN_PROOT=
32 exit
32 exit
33−elif ! [ $# -eq 0 ]; then
33+elif [ $# -gt 0 ]; then
34− exec $cmd
34+ exec "$@"
35fi
35fi