summaryrefslogtreecommitdiffstats
path: root/initramfs
diff options
context:
space:
mode:
authorBastian Wissler2007-02-07 12:14:15 +0100
committerBastian Wissler2007-02-07 12:14:15 +0100
commitd6a418d2562b0b351b53df65a800f26d6067e25e (patch)
tree7cce85721eafbba3359030411d958172590cc378 /initramfs
parentmkdxsinitrd changed to create proper initramfs for gentoo & functions-default... (diff)
downloadcore-d6a418d2562b0b351b53df65a800f26d6067e25e.tar.gz
core-d6a418d2562b0b351b53df65a800f26d6067e25e.tar.xz
core-d6a418d2562b0b351b53df65a800f26d6067e25e.zip
gentoo-functions: added the function try()-> one error less
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@694 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rw-r--r--initramfs/distro-specs/gentoo/functions-default37
1 files changed, 37 insertions, 0 deletions
diff --git a/initramfs/distro-specs/gentoo/functions-default b/initramfs/distro-specs/gentoo/functions-default
index 123b568d..7c548648 100644
--- a/initramfs/distro-specs/gentoo/functions-default
+++ b/initramfs/distro-specs/gentoo/functions-default
@@ -88,6 +88,43 @@ cat >>/mnt/etc/${D_INITDIR}/boot <<EOF
esac
done < /proc/filesystems
fi
+ # Function try() needed by udev, since it's a critical task...
+ # Originally from /sbin/rc gentoo-sysinit-script
+ try() {
+ local errstr
+ local retval=0
+
+ if [ -c /dev/null ]; then
+ errstr="\$((eval \$*) 2>&1 >/dev/null)"
+ else
+ errstr="\$((eval \$*) 2>&1)"
+ fi
+ retval=\$?
+ if [ "\${retval}" -ne 0 ]
+ then
+ splash "critical" &
+
+ echo -e "\${ENDCOL}\${NORMAL}[\${BAD} oops \${NORMAL}]"
+ echo
+ eerror "The \"\${1}\" command failed with error:"
+ echo
+ echo "\${errstr#*: }"
+ echo
+ eerror "Since this is a critical task, startup cannot continue."
+ echo
+ /sbin/sulogin \${CONSOLE}
+ einfo "Unmounting filesystems"
+ if [ -c /dev/null ]; then
+ /bin/mount -a -o remount,ro &>/dev/null
+ else
+ /bin/mount -a -o remount,ro
+ fi
+ einfo "Rebooting"
+ /sbin/reboot -f
+ fi
+
+ return \${retval}
+ }
# Starting udev (normally handled by /sbin/rc sysinit)
source "\${svclib}/addons/udev-start.sh"
rm -rf /dev/.rcsysinit