From 5722d3826edb7bad4c9197b39edc706e5660a7f5 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 30 Aug 2013 12:05:58 +0200 Subject: [PATCH] initrd.scripts: move test_success() to 00-common.sh and fix it --- defaults/initrd.d/00-common.sh | 10 ++++++++++ defaults/initrd.scripts | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) 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