mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-05 19:17:16 +03:00
nix-bootstrap.sh: fix shellcheck warnings
It also changes how the arguments are being passed around.
This commit is contained in:
parent
565770f037
commit
5672912336
@ -1,35 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
cmd=sh
|
||||
if ! [ $# -eq 0 ]; then
|
||||
cmd=$@
|
||||
if [ $# -gt 0 ]; then
|
||||
set -- sh
|
||||
fi
|
||||
|
||||
# should download this in the future
|
||||
# but the mirror is down
|
||||
proot=`dirname $0`/proot-`uname -p`
|
||||
proot=$(dirname "$0")/proot-$(uname -p)
|
||||
export PROOT_NO_SECCOMP=1
|
||||
|
||||
nixdir=$HOME/.nix
|
||||
|
||||
OLD_NIX_PATH=$NIX_PATH
|
||||
if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi
|
||||
if ! [ -z "$OLD_NIX_PATH" ]; then NIX_PATH="$OLD_NIX_PATH"; fi
|
||||
# shellcheck disable=SC1090
|
||||
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh"; fi
|
||||
if [ -n "$OLD_NIX_PATH" ]; then NIX_PATH="$OLD_NIX_PATH"; fi
|
||||
|
||||
if [ -z "$IN_PROOT" ]; then
|
||||
export IN_PROOT=1
|
||||
|
||||
if ! [ -d $nixdir ]; then
|
||||
mkdir -p $nixdir
|
||||
if ! [ -d "$nixdir" ]; then
|
||||
mkdir -p "$nixdir"
|
||||
s=$(mktemp)
|
||||
curl https://nixos.org/nix/install -o $s
|
||||
$proot -b $nixdir:/nix $0 sh $s
|
||||
curl https://nixos.org/nix/install -o "$s"
|
||||
$proot -b "$nixdir:/nix" "$0" sh "$s"
|
||||
fi
|
||||
|
||||
$proot -b $nixdir:/nix $0 $cmd
|
||||
$proot -b "$nixdir:/nix" "$0" "$@"
|
||||
|
||||
export IN_PROOT=
|
||||
exit
|
||||
elif ! [ $# -eq 0 ]; then
|
||||
exec $cmd
|
||||
elif [ $# -gt 0 ]; then
|
||||
exec "$@"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user