hashboot/initscript.sysv

57 lines
907 B
Plaintext
Raw Normal View History

2015-06-05 14:04:44 +02:00
#!/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 [ $? -gt 0 ] && [ $? -le 3 ]
2015-06-05 14:04:44 +02:00
then
log_end_msg 4
echo -n "Recover files? [y/N] "
read -r yesno
if [ ${yesno} == "y" ]
then
hashboot.sh recover
fi
2015-06-05 14:04:44 +02:00
sh
exit 4
elif [ $? != 0 ]
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
exit 2
;;
*)
echo "Usage: /etc/init.d/hashboot {start|stop}"
exit 2
;;
esac
exit 0