2015-10-03 17:09:36 +02:00
|
|
|
#!/bin/bash
|
2015-06-05 14:04:44 +02: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 17:09:36 +02:00
|
|
|
#PATH=/sbin:/bin:/usr/bin:/usr
|
2015-06-05 14:04:44 +02:00
|
|
|
|
|
|
|
# See if hashboot.sh is accessible
|
2015-10-03 17:09:36 +02:00
|
|
|
test -x $(which hashboot.sh) || exit 255
|
2015-06-05 14:04:44 +02:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
log_daemon_msg "Checking integrity of files in /boot"
|
|
|
|
|
2015-06-06 01:58:48 +02:00
|
|
|
hashboot.sh check
|
2015-09-29 15:55:28 +02:00
|
|
|
if [ $? -gt 0 ] && [ $? -le 3 ]
|
2015-06-05 14:04:44 +02:00
|
|
|
then
|
2015-06-06 01:58:48 +02:00
|
|
|
log_end_msg 4
|
|
|
|
|
|
|
|
echo -n "Recover files? [y/N] "
|
|
|
|
read -r yesno
|
2015-10-03 17:09:36 +02:00
|
|
|
if [ "${yesno}" == "y" ]
|
2015-06-06 01:58:48 +02:00
|
|
|
then
|
|
|
|
hashboot.sh recover
|
|
|
|
fi
|
|
|
|
|
2015-10-03 17:09:36 +02:00
|
|
|
echo "Dropping to shell. Type exit to continue."
|
2015-06-05 14:04:44 +02:00
|
|
|
sh
|
2015-10-03 17:09:36 +02:00
|
|
|
exit 3
|
2015-06-06 01:58:48 +02:00
|
|
|
elif [ $? != 0 ]
|
2015-10-03 17:09:36 +02:00
|
|
|
then
|
2015-06-06 01:58:48 +02:00
|
|
|
log_end_msg $?
|
|
|
|
exit $?
|
2015-06-05 14:04:44 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
log_end_msg 0
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
# No-op
|
|
|
|
|
|
|
|
;;
|
|
|
|
restart|reload|force-reload|status)
|
|
|
|
echo "Error: argument '$1' not supported" >&2
|
2015-10-03 17:09:36 +02:00
|
|
|
exit 1
|
2015-06-05 14:04:44 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: /etc/init.d/hashboot {start|stop}"
|
2015-10-03 17:09:36 +02:00
|
|
|
exit 1
|
2015-06-05 14:04:44 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|