@@ -41,7 +41,7 @@ abort() {
41
41
default_kexec_url=https://github.com/nix-community/nixos-images/releases/download/nixos-22.11/nixos-kexec-installer-x86_64-linux.tar.gz
42
42
kexec_url=" $default_kexec_url "
43
43
enable_debug=" "
44
- maybereboot =" sleep 6 && reboot"
44
+ maybe_reboot =" sleep 6 && reboot"
45
45
substitute_on_destination=" --substitute-on-destination"
46
46
nix_options=(
47
47
--extra-experimental-features ' nix-command flakes'
@@ -94,7 +94,7 @@ while [[ $# -gt 0 ]]; do
94
94
stop_after_disko=y
95
95
;;
96
96
--no-reboot)
97
- maybereboot =" "
97
+ maybe_reboot =" "
98
98
;;
99
99
--option)
100
100
key=$2
@@ -205,9 +205,9 @@ export $(echo "$facts" | grep -E '^(has|is)_[a-z0-9_]+=\S+' | xargs)
205
205
if [[ ${has_tar-n} == " n" ]]; then
206
206
abort " no tar command found, but required to unpack kexec tarball"
207
207
fi
208
- maybesudo =" "
208
+ maybe_sudo =" "
209
209
if [[ ${has_sudo-n} == " y" ]]; then
210
- maybesudo =" sudo"
210
+ maybe_sudo =" sudo"
211
211
fi
212
212
if [[ ${is_os-n} != " Linux" ]]; then
213
213
abort " This script requires Linux as the operating system, but got $is_os "
224
224
if [[ ${is_kexec-n} == " n" ]] && [[ ${is_installer-n} == " n" ]]; then
225
225
ssh_ << SSH
226
226
set -efu ${enable_debug}
227
- $maybesudo rm -rf /root/kexec
228
- $maybesudo mkdir -p /root/kexec
227
+ $maybe_sudo rm -rf /root/kexec
228
+ $maybe_sudo mkdir -p /root/kexec
229
229
SSH
230
230
231
231
if [[ -f $kexec_url ]]; then
232
- ssh_ " ${maybesudo } tar -C /root/kexec -xvzf-" < " $kexec_url "
232
+ ssh_ " ${maybe_sudo } tar -C /root/kexec -xvzf-" < " $kexec_url "
233
233
elif [[ ${has_curl-n} == " y" ]]; then
234
- ssh_ " curl --fail -Ss -L '${kexec_url} ' | ${maybesudo } tar -C /root/kexec -xvzf-"
234
+ ssh_ " curl --fail -Ss -L '${kexec_url} ' | ${maybe_sudo } tar -C /root/kexec -xvzf-"
235
235
elif [[ ${has_wget-n} == " y" ]]; then
236
- ssh_ " wget '${kexec_url} ' -O- | ${maybesudo } tar -C /root/kexec -xvzf-"
236
+ ssh_ " wget '${kexec_url} ' -O- | ${maybe_sudo } tar -C /root/kexec -xvzf-"
237
237
else
238
- curl --fail -Ss -L " ${kexec_url} " | ssh_ " ${maybesudo } tar -C /root/kexec -xvzf-"
238
+ curl --fail -Ss -L " ${kexec_url} " | ssh_ " ${maybe_sudo } tar -C /root/kexec -xvzf-"
239
239
fi
240
240
241
241
ssh_ << SSH
242
- TMPDIR=/root/kexec setsid ${maybesudo } /root/kexec/kexec/run
242
+ TMPDIR=/root/kexec setsid ${maybe_sudo } /root/kexec/kexec/run
243
243
SSH
244
244
245
245
# wait for machine to become unreachable
@@ -278,5 +278,5 @@ mkdir -m777 -p /mnt/tmp
278
278
nixos-install --no-root-passwd --no-channel-copy --system "$nixos_system "
279
279
# We will reboot in background so we can cleanly finish the script before the hosts go down.
280
280
# This makes integration into scripts easier
281
- nohup bash -c '${maybereboot } ' >/dev/null &
281
+ nohup bash -c '${maybe_reboot } ' >/dev/null &
282
282
SSH
0 commit comments