mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 06:55:53 +03:00
nix-bundle.sh: fix shellcheck warnings
This commit is contained in:
parent
83742ac8ea
commit
565770f037
@ -19,7 +19,7 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nix_file=`dirname $0`/default.nix
|
nix_file=$(dirname "$0")/default.nix
|
||||||
|
|
||||||
target="$1"
|
target="$1"
|
||||||
shift
|
shift
|
||||||
@ -38,21 +38,23 @@ shift
|
|||||||
bootstrap=nix-bootstrap
|
bootstrap=nix-bootstrap
|
||||||
if [ "$target" = "nix-bundle" ] || [ "$target" = "nixStable" ] || [ "$target" = "nixUnstable" ] || [ "$target" = "nix" ]; then
|
if [ "$target" = "nix-bundle" ] || [ "$target" = "nixStable" ] || [ "$target" = "nixUnstable" ] || [ "$target" = "nix" ]; then
|
||||||
bootstrap=nix-bootstrap-nix
|
bootstrap=nix-bootstrap-nix
|
||||||
elif ! [ -z "$extraTargets" ]; then
|
elif [ -n "$extraTargets" ]; then
|
||||||
bootstrap=nix-bootstrap-path
|
bootstrap=nix-bootstrap-path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
expr="with import <nixpkgs> {}; with import $nix_file {}; $bootstrap { target = $target; extraTargets = [ $extraTargets ]; run = \"$exec\"; }"
|
expr="with import <nixpkgs> {}; with import $nix_file {}; $bootstrap { target = $target; extraTargets = [ $extraTargets ]; run = \"$exec\"; }"
|
||||||
|
|
||||||
out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
|
drv=$(nix-instantiate --no-gc-warning -E "$expr")
|
||||||
|
|
||||||
|
out=$(nix-store --no-gc-warning --realize "$drv")
|
||||||
|
|
||||||
if [ -z "$out" ]; then
|
if [ -z "$out" ]; then
|
||||||
>&2 echo "$0 failed. Exiting."
|
>&2 echo "$0 failed. Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
elif [ -t 1 ]; then
|
elif [ -t 1 ]; then
|
||||||
filename=$(basename $exec)
|
filename=$(basename "$exec")
|
||||||
echo "Nix bundle created at $filename."
|
echo "Nix bundle created at $filename."
|
||||||
cp -f $out $filename
|
cp -f "$out" "$filename"
|
||||||
else
|
else
|
||||||
cat $out
|
cat "$out"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user