diff --git a/init/openrc b/init/openrc index 3f4c5b8..dfac9b0 100755 --- a/init/openrc +++ b/init/openrc @@ -1,37 +1,39 @@ #!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 description="Check integrity of files in /boot" depend() { - need localmount - before xdm + need localmount + before xdm } start() { - ebegin "Checking integrity of files in /boot" + ebegin "Checking integrity of files in /boot" - # See if hashboot is accessible - which hashboot > /dev/null || return 255 + # See if hashboot is accessible + which hashboot > /dev/null || return 255 - hashboot check - if [ $? -gt 0 ] && [ $? -le 3 ] - then - echo -n "Recover files? [y/N] " - read -r yesno - if [ "${yesno}" == "y" ] - then - hashboot recover - fi + 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 - echo "Dropping to shell. Type exit to continue." - sh - return 3 - elif [ $? != 0 ] - then - return $? - fi - - eend 0 + 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 }