Skip to content

Commit 840b980

Browse files
Merge #89
89: feat: detect bash & setsid presence and fail if they are not on the target r=phaer a=RaitoBezarius Co-authored-by: Raito Bezarius <masterancpp@gmail.com>
2 parents 17cc299 + 33ab44a commit 840b980

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/nixos-anywhere.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ has_tar=\$(has tar)
234234
has_sudo=\$(has sudo)
235235
has_wget=\$(has wget)
236236
has_curl=\$(has curl)
237+
has_setsid=\$(has setsid)
238+
has_bash=\$(has bash)
237239
FACTS
238240
SSH
239241
); then
@@ -253,10 +255,20 @@ import_facts
253255
if [[ ${has_tar-n} == "n" ]]; then
254256
abort "no tar command found, but required to unpack kexec tarball"
255257
fi
258+
259+
if [[ ${has_bash-n} == "n" ]]; then
260+
abort "no bash command found, but required for running the reboot script"
261+
fi
262+
263+
if [[ ${has_setsid-n} == "n" ]]; then
264+
abort "no setsid command found, but required to run the kexec script under a new session"
265+
fi
266+
256267
maybe_sudo=""
257268
if [[ ${has_sudo-n} == "y" ]]; then
258269
maybe_sudo="sudo"
259270
fi
271+
260272
if [[ ${is_os-n} != "Linux" ]]; then
261273
abort "This script requires Linux as the operating system, but got $is_os"
262274
fi

0 commit comments

Comments
 (0)