#!/bin/sh
[ "$root" ] || {
- root=$(getarg root); root=${root#root=}
+ root=$(getarg root=)
case $root in
LABEL=*) root=${root#LABEL=}
root="$(echo $root |sed 's,/,\\x2f,g')"
}
[ "$rflags" ] || {
- if rflags="$(getarg rootflags)"; then
- rflags="${rflags#rootflags=}"
- getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro"
+ if rflags="$(getarg rootflags=)"; then
+ getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
else
- getarg rw >/dev/null && rflags=rw || rflags=ro
+ getarg rw && rflags=rw || rflags=ro
fi
}
[ "$fstype" ] || {
- fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}"
+ fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}"
}
-[ -e "$root" ] && {
- ln -sf "$root" /dev/root
- mount $fstype -o $rflags /dev/root $NEWROOT && ROOTFS_MOUNTED=yes
-}
+[ -e "$root" ] && mount $fstype -o "$rflags" "$root" "$NEWROOT" && \
+ ROOTFS_MOUNTED=yes
#!/bin/sh
-resume=$(getarg resume) && [ "$(getarg noresume)" = "" ] && {
- resume=${resume#resume=}
- [ -b "$resume" ] && {
- # parsing the output of ls is Bad, but until there is a better way...
- ls -lH "$resume" | (
- read x x x x maj min x;
- echo "${maj%,}:$min"> /sys/power/resume)
- }
+resume=$(getarg resume=) && ! getarg noresume && [ -b "$resume" ] && {
+ # parsing the output of ls is Bad, but until there is a better way...
+ ls -lH "$resume" | (
+ read x x x x maj min x;
+ echo "${maj%,}:$min"> /sys/power/resume)
}
getarg() {
local o line
for o in $CMDLINE; do
- [ "${o%%=*}" = "$1" ] && { echo $o; return 0; }
+ [ "$o" = "$1" ] && return 0
+ [ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
done
return 1
}
done
# by the time we get here, the root filesystem should be mounted.
-
-INIT=$(getarg init)
+# Try to find init.
+for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
+ [ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
+done
[ "$INIT" ] || {
- for i in /sbin/init /etc/init /init /bin/sh; do
- [ -x "$NEWROOT$i" ] && { INIT="$i"; break; }
- done
- [ "$INIT" ] || {
- echo "Cannot find init! Please check to make sure you passed"
- echo "a valid root filesystem! Dropping to a shell."
- emergency_shell
- }
+ echo "Cannot find init! Please check to make sure you passed"
+ echo "a valid root filesystem! Dropping to a shell."
+ emergency_shell
}
# pre pivot scripts are sourced just before we switch over to the new root.
inst_rules /lib/udev/rules.d/10-console* /lib/udev/rules.d/40-redhat* \
/lib/udev/rules.d/50* /lib/udev/rules.d/60-persistent-storage.rules \
/lib/udev/rules.d/61*edd* /lib/udev/rules.d/64* /lib/udev/rules.d/80* \
- /lib/udev/rules.d/95*
\ No newline at end of file
+ /lib/udev/rules.d/95*
+# make udevadm shut up about missing udev.conf
+inst /etc/udev/udev.conf
\ No newline at end of file