diff --git a/defaults/initrd.d/00-common.sh b/defaults/initrd.d/00-common.sh index a116a58..8947008 100755 --- a/defaults/initrd.d/00-common.sh +++ b/defaults/initrd.d/00-common.sh @@ -41,6 +41,16 @@ verbose_kmsg() { [ -n "$QUIET" ] && echo '6' > /proc/sys/kernel/printk } +test_success() { + local ret=${?} + local error_string="${1:-run command}" + + if [ "${ret}" != "0" ]; then + bad_msg "Failed to ${1}; failing back to the shell..." + run_shell + fi +} + run_shell() { /bin/ash } diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 886fe63..64e06af 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -114,18 +114,6 @@ find_nfs() { fi } -test_success() { - retcode=$? - # If last command failed send error message and fall back to a shell - if [ "$retcode" != '0' ] - then - error_string=$1 - error_string="${error_string:-run command}" - bad_msg 'Failed to $1; failing back to the shell...' - run_shell - fi -} - crypt_exec() { if [ "${CRYPT_SILENT}" = '1' ] then