diff options
author | Ori Bernstein <ori@eigenstate.org> | 2022-08-12 10:36:55 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2022-08-12 10:36:55 +0000 |
commit | efc7a9a729b075aab06bc24ae778304ad98c3ab6 (patch) | |
tree | 2d820c23633d60ef6442580103acf2ebf1629b69 /rc | |
parent | 302e5bc94465df9b36e326faea94dcd018b1b491 (diff) |
fshalt: allow passing a kernel to 'fshalt -r'
reboot(1) doesn't shut down the file system gracefully,
and fshalt -r didn't support passing a kernel; this
change allows rebooting into a new kernel with fshalt.
Diffstat (limited to 'rc')
-rwxr-xr-x | rc/bin/fshalt | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/rc/bin/fshalt b/rc/bin/fshalt index 24ee921c4..7fb4f6207 100755 --- a/rc/bin/fshalt +++ b/rc/bin/fshalt @@ -1,15 +1,17 @@ #!/bin/rc -# fshalt [-r] - sync (flush) and, if possible, halt all file servers +# fshalt [-r [kernel]] - sync (flush) and, if possible, halt all file servers # and optionally reboot rfork en +flagfmt='r:reboot' reboot=no scram=no -switch ($#*) { -case 0 -case 1 +bootf=() +if(~ $1 -r){ reboot=yes -case * - echo usage: $0 '[-r]' >[1=2] + shift +} +if not if(! ~ $#* 0 && ! ~ $#* 1){ + echo usage: $0 '[-r bootkern]' >[1=2] exit usage } @@ -46,6 +48,11 @@ cp /bin/sed /tmp cp /bin/sleep /tmp cp /bin/scram /tmp cp /bin/test /tmp +if(~ $reboot yes && ~ $#* 1){ + if(! cp $1 /tmp/bootf) + exit 'failed to copy kernel' + bootf=/bin/bootf +} bind /tmp /rc bind /tmp /bin @@ -66,7 +73,7 @@ fn x { if (~ $reboot yes) { echo rebooting... - echo reboot >'#c/reboot' + echo reboot $bootf >'#c/reboot' } if (~ $scram yes){ scram |