hashboot/initscript.sysv

59 lines
966 B
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
# Required-Stop:
# Default-Start: S
# Default-Stop:
# 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
start)
log_daemon_msg "Checking integrity of files in /boot"
hashboot check
if [ $? -gt 0 ] && [ $? -le 3 ]
2015-06-05 08:04:44 -04:00
then
log_end_msg 4
echo -n "Recover files? [y/N] "
read -r yesno
2015-10-03 11:09:36 -04:00
if [ "${yesno}" == "y" ]
then
hashboot recover
fi
2015-10-03 11:09:36 -04:00
echo "Dropping to shell. Type exit to continue."
2015-06-05 08:04:44 -04:00
sh
2015-10-03 11:09:36 -04:00
exit 3
elif [ $? != 0 ]
2015-10-03 11:09:36 -04:00
then
log_end_msg $?
exit $?
2015-06-05 08:04:44 -04:00
fi
log_end_msg 0
;;
stop)
# No-op
;;
restart|reload|force-reload|status)
echo "Error: argument '$1' not supported" >&2
2015-10-03 11:09:36 -04:00
exit 1
2015-06-05 08:04:44 -04:00
;;
*)
echo "Usage: /etc/init.d/hashboot {start|stop}"
2015-10-03 11:09:36 -04:00
exit 1
2015-06-05 08:04:44 -04:00
;;
esac
exit 0