hashboot/initscript.sysv
2015-09-25 23:18:01 +02:00

57 lines
890 B
Bash
Executable File

#!/bin/sh
### 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
PATH=/sbin:/bin:/usr/bin
# See if hashboot.sh is accessible
test -x $(which hashboot.sh) || exit 0
case "$1" in
start)
log_daemon_msg "Checking integrity of files in /boot"
hashboot.sh check
if [ $? == 4 ]
then
log_end_msg 4
echo -n "Recover files? [y/N] "
read -r yesno
if [ ${yesno} == "y" ]
then
hashboot.sh recover
fi
sh
exit 4
elif [ $? != 0 ]
log_end_msg $?
exit $?
fi
log_end_msg 0
;;
stop)
# No-op
;;
restart|reload|force-reload|status)
echo "Error: argument '$1' not supported" >&2
exit 2
;;
*)
echo "Usage: /etc/init.d/hashboot {start|stop}"
exit 2
;;
esac
exit 0