Common wisdom to enter single user on Linux is to edit command
line and add "single". This was not possible because switch_root
was always called with empty init arguments. Collect them from
command line and pass to real init when switching root.
Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
initargs=""
+read CLINE </proc/cmdline
if getarg init= >/dev/null ; then
ignoreargs="console BOOT_IMAGE"
# only pass arguments after init= to the init
- read CLINE </proc/cmdline
CLINE=${CLINE#*init=}
set $CLINE
shift
initargs="$initargs $x"
done
unset CLINE
+else
+ set $CLINE
+ shift
+ for x in "$@"; do
+ case "$x" in
+ [0-9]|s|S|single|emergency|auto )
+ initargs="$initargs $x"
+ ;;
+ esac
+ done
fi
# Debug: Copy state