mirror of
https://github.com/elitak/nixos-infect.git
synced 2024-12-22 16:18:29 +03:00
Use if rather than test before rebooting (#35)
* whitespace * Use if rather than test before rebooting When the -z returned false, the script would return its error code, 1, resulting in a failure.
This commit is contained in:
parent
4f31db455e
commit
b95ff459a8
1 changed files with 7 additions and 4 deletions
11
nixos-infect
11
nixos-infect
|
@ -39,7 +39,7 @@ EOF
|
||||||
fileSystems."/" = { device = "/dev/${disk}1"; fsType = "ext4"; };
|
fileSystems."/" = { device = "/dev/${disk}1"; fsType = "ext4"; };
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ "$PROVIDER" = "digitalocean" ]
|
if [ "$PROVIDER" = "digitalocean" ]
|
||||||
then
|
then
|
||||||
makeNetworkingConf
|
makeNetworkingConf
|
||||||
|
@ -177,7 +177,7 @@ prepareEnv() {
|
||||||
)"
|
)"
|
||||||
}; export -f curl; }
|
}; export -f curl; }
|
||||||
|
|
||||||
# Nix installer tries to use sudo regardless of whether we're already uid 0
|
# Nix installer tries to use sudo regardless of whether we're already uid 0
|
||||||
#which sudo || { sudo() { eval "$@"; }; export -f sudo; }
|
#which sudo || { sudo() { eval "$@"; }; export -f sudo; }
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 0755 /nix
|
mkdir -p -m 0755 /nix
|
||||||
|
@ -192,7 +192,7 @@ checkEnv() {
|
||||||
which dnf && dnf install -y perl-Digest-SHA # Fedora 24
|
which dnf && dnf install -y perl-Digest-SHA # Fedora 24
|
||||||
which bzcat || (which yum && yum install -y bzip2) \
|
which bzcat || (which yum && yum install -y bzip2) \
|
||||||
|| (which apt-get && apt-get install bzip2) \
|
|| (which apt-get && apt-get install bzip2) \
|
||||||
|| true
|
|| true
|
||||||
|
|
||||||
[[ "$(whoami)" == "root" ]] || { echo "ERROR: Must run as root"; return 1; }
|
[[ "$(whoami)" == "root" ]] || { echo "ERROR: Must run as root"; return 1; }
|
||||||
|
|
||||||
|
@ -258,4 +258,7 @@ makeConf
|
||||||
makeSwap # smallest (512MB) droplet needs extra memory!
|
makeSwap # smallest (512MB) droplet needs extra memory!
|
||||||
infect
|
infect
|
||||||
removeSwap
|
removeSwap
|
||||||
[[ -z "$NO_REBOOT" ]] && reboot
|
|
||||||
|
if [[ -z "$NO_REBOOT" ]]; then
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue