1
1
mirror of https://schlomp.space/tastytea/hashboot synced 2024-11-16 14:37:06 +01:00
hashboot/init/openrc

40 lines
879 B
Plaintext
Raw Normal View History

#!/sbin/openrc-run
2019-03-29 23:40:30 +01:00
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
2015-06-05 14:04:44 +02:00
description="Check integrity of files in /boot"
depend()
{
2019-03-29 23:40:30 +01:00
need localmount
before xdm
2015-06-05 14:04:44 +02:00
}
start()
{
2019-03-29 23:40:30 +01:00
ebegin "Checking integrity of files in /boot"
2015-06-05 14:04:44 +02:00
2019-03-29 23:40:30 +01:00
# See if hashboot is accessible
which hashboot > /dev/null || return 255
2015-06-05 14:04:44 +02:00
2019-03-29 23:40:30 +01:00
hashboot check
ret=$?
# If return code is 1-3 or 10-13
if [ ${ret} -ge 1 ] && [ ${ret} -le 3 ] || [ ${ret} -ge 10 ] && [ ${ret} -le 13 ]; then
echo -n "Recover files? [y/N] "
read -r yesno
if [ "${yesno}" == "y" ]; then
hashboot recover
fi
2019-03-29 23:40:30 +01:00
echo "Dropping to shell. Type exit to continue."
sh
return ${ret}
elif [ ${ret} != 0 ]; then
eerror "Unexpected error number ${ret}."
return ${ret}
fi
eend 0
}