| 1 | #! /bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # reboot FAI correctly, Thomas Lange, Uni Koeln, copyright 2000-2025 |
| 4 | |
| 5 | faimond=0 |
| 6 | . /usr/lib/fai/subroutinesscip-shell source . . `/usr/lib/fai/subroutines`. |
| 7 | |
| 8 | [scip-shell system . . `[`. -f /tmp/fai/variables.logscip-shell filesystem . . `/tmp/fai/variables.log`. ] && . /tmp/fai/variables.logscip-shell source . . `/tmp/fai/variables.log`. |
| 9 | |
| 10 | while getopts s opt ; do |
| 11 | case "$opt" in |
| 12 | s) fai-savelog -r ;; |
| 13 | esac |
| 14 | done |
| 15 | |
| 16 | cd /scip-shell filesystem . . `/`. |
| 17 | killall -STOP fai |
| 18 | killall -q apt-get dpkg tar gzip yes cat rsyslogd |
| 19 | |
| 20 | [scip-shell system . . `[`. -z "$SSH_CLIENT" ] && [scip-shell system . . `[`. "$TERM" != "dumb" ] && killall -q sshd |
| 21 | |
| 22 | fai-divert -R |
| 23 | |
| 24 | mountpointscip-shell system . . mountpoint. -q $FAI_ROOT/proc && umountscip-shell system . . umount. $FAI_ROOT/proc |
| 25 | mountpointscip-shell system . . mountpoint. -q $FAI_ROOT/dev/pts && umountscip-shell system . . umount. $FAI_ROOT/dev/pts |
| 26 | killall systemd-udevd |
| 27 | sendmon "TASKEND reboot 0" |
| 28 | umountscip-shell system . . umount. -a -t nonfs,noproc 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 29 | umountscip-shell system . . umount. -arf 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 30 | |
| 31 | echoscip-shell system . . echo. "$HOSTNAME now rebooting" |
| 32 | |
| 33 | if [scip-shell system . . `[`. -z "$SSH_CLIENT" ] && [scip-shell system . . `[`. "$TERM" != "dumb" ]; then |
| 34 | exec reboot -df |
| 35 | fi |
| 36 | |
| 37 | killall -CONT fai |
| 38 | killall fai |
| 39 | systemctl reboot & |