Updated SysVinit script.

pull/16/head
tastytea 2019-03-29 23:51:15 +01:00
parent 191753a17e
commit 02121e496c
No known key found for this signature in database
GPG Key ID: CFC39497F1B26E07
1 changed files with 35 additions and 37 deletions

View File

@ -3,9 +3,9 @@
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: hashboot # Provides: hashboot
# Required-Start: $mountall # Required-Start: $mountall
# Required-Stop: # Required-Stop:
# Default-Start: S # Default-Start: S
# Default-Stop: # Default-Stop:
# Short-Description: Check integrity of files in /boot # Short-Description: Check integrity of files in /boot
### END INIT INFO ### END INIT INFO
@ -15,44 +15,42 @@
test -x $(which hashboot) || exit 255 test -x $(which hashboot) || exit 255
case "$1" in case "$1" in
start) start)
log_daemon_msg "Checking integrity of files in /boot" log_daemon_msg "Checking integrity of files in /boot"
hashboot check hashboot check
if [ $? -gt 0 ] && [ $? -le 3 ] ret=$?
then if [ ${ret} -ge 1 ] && [ ${ret} -le 3 ] || [ ${ret} -ge 10 ] && [ ${ret} -le 13 ]; then
log_end_msg 4 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." echo -n "Recover files? [y/N] "
sh read -r yesno
exit 3 if [ "${yesno}" == "y" ]; then
elif [ $? != 0 ] hashboot recover
then fi
log_end_msg $?
exit $?
fi
log_end_msg 0
;;
stop)
# No-op
;; echo "Dropping to shell. Type exit to continue."
restart|reload|force-reload|status) sh
echo "Error: argument '$1' not supported" >&2 exit ${ret}
exit 1 elif [ ${ret} != 0 ]; then
;; log_end_msg ${ret}
*) eerror "Unexpected error number ${ret}."
echo "Usage: /etc/init.d/hashboot {start|stop}" exit ${ret}
exit 1 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
;;
esac esac
exit 0 exit 0