From: Andrey Borzenkov <arvidjaar-JGs/UdohzUI@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] Pass init argument(s) to real init
Date: Sat, 30 Jan 2010 17:57:45 +0300 [thread overview]
Message-ID: <201001301757.49473.arvidjaar@mail.ru> (raw)
[-- Attachment #1.1: Type: Text/Plain, Size: 183 bytes --]
I was rather surprised why all my attempts to enter single user were not
successful :) Simple patch to collect and pass to real init what _looks_
like init arguments.
-andrey
[-- Attachment #1.2: initargs --]
[-- Type: message/rfc822, Size: 1312 bytes --]
From: Andrey Borzenkov <arvidjaar-JGs/UdohzUI@public.gmane.org>
Subject: [PATCH] Pass init argument(s) to real init
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-JGs/UdohzUI@public.gmane.org>
---
modules.d/99base/init | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index ab033a7..e5158f8 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -259,10 +259,10 @@ done
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
@@ -273,6 +273,16 @@ if getarg init= >/dev/null ; then
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2010-01-30 14:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-30 14:57 Andrey Borzenkov [this message]
[not found] ` <201001301757.49473.arvidjaar-JGs/UdohzUI@public.gmane.org>
2010-03-01 18:12 ` [PATCH] Pass init argument(s) to real init Andrey Borzenkov
[not found] ` <201003012112.58174.arvidjaar-JGs/UdohzUI@public.gmane.org>
2010-03-04 13:07 ` Harald Hoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201001301757.49473.arvidjaar@mail.ru \
--to=arvidjaar-jgs/udohzui@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.