hashboot/init/sysv

57 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-10-03 11:09:36 -04:00
#!/bin/bash
2015-06-05 08:04:44 -04:00
### BEGIN INIT INFO
# Provides: hashboot
# Required-Start: $mountall
2019-03-29 18:51:15 -04:00
# Required-Stop:
2015-06-05 08:04:44 -04:00
# Default-Start: S
2019-03-29 18:51:15 -04:00
# Default-Stop:
2015-06-05 08:04:44 -04:00
# Short-Description: Check integrity of files in /boot
### END INIT INFO
2015-10-03 11:09:36 -04:00
#PATH=/sbin:/bin:/usr/bin:/usr
2015-06-05 08:04:44 -04:00
# See if hashboot is accessible
test -x $(which hashboot) || exit 255
2015-06-05 08:04:44 -04:00
case "$1" in
2019-03-29 18:51:15 -04:00
start)
log_daemon_msg "Checking integrity of files in /boot"
hashboot check
ret=$?
if [ ${ret} -ge 1 ] && [ ${ret} -le 3 ] || [ ${ret} -ge 10 ] && [ ${ret} -le 13 ]; then
log_end_msg ${ret}
echo -n "Recover files? [y/N] "
read -r yesno
if [ "${yesno}" == "y" ]; then
hashboot recover
fi
echo "Dropping to shell. Type exit to continue."
sh
exit ${ret}
elif [ ${ret} != 0 ]; then
log_end_msg ${ret}
eerror "Unexpected error number ${ret}."
exit ${ret}
fi
log_end_msg 0
;;
stop)
# No-op
;;
restart|reload|force-reload|status)
echo "Error: argument '$1' not supported" >&2
exit 1
;;
*)
echo "Usage: /etc/init.d/hashboot {start|stop}"
exit 1
;;
2015-06-05 08:04:44 -04:00
esac
exit 0