new flags and lvm
isirc: lvm instead symlinks (vgscan, ...) will be called with --sysinit. flags: NOSEC: default, on failure, isirc crashes and no shell will start. but NOSEC will allow isirc to start a shell for debugging. if you have a secure grub-config and nobody should be able to start a root-shell, this will be default. else NOSEC is interesting for debugging. init: yes, init=/bin/sh will be possible. NOSEC is not needed. isirdsh: start a shell before mounting. needs NOSEC. ISIRDSH: start a shell after mounting and before switch root. needs NOSEC.
This commit is contained in:
parent
d81863c487
commit
a09b427d1c
28
isirc
28
isirc
|
@ -3,6 +3,7 @@
|
||||||
PATH=/bin
|
PATH=/bin
|
||||||
export PATH
|
export PATH
|
||||||
QUITE=${QUITE:-false}
|
QUITE=${QUITE:-false}
|
||||||
|
NOSEC=false
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
[ "X$QUITE" != "Xtrue" ] && echo "$*"
|
[ "X$QUITE" != "Xtrue" ] && echo "$*"
|
||||||
|
@ -26,10 +27,15 @@ then
|
||||||
log " mdev"
|
log " mdev"
|
||||||
mdev -s
|
mdev -s
|
||||||
log " activate volume groups"
|
log " activate volume groups"
|
||||||
vgscan --mknodes --ignorelockingfailure
|
lvm vgscan --mknodes --sysinit
|
||||||
vgchange --ignorelockingfailure -P -a y
|
lvm vgchange --sysinit -P -a y
|
||||||
|
|
||||||
if cmdline -c isirdsh
|
if cmdline -c NOSEC
|
||||||
|
then
|
||||||
|
NOSEC=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ Xtrue = "X$NOSEC" ] && cmdline -c isirdsh
|
||||||
then
|
then
|
||||||
log " start shell"
|
log " start shell"
|
||||||
exec sh
|
exec sh
|
||||||
|
@ -42,11 +48,9 @@ fi
|
||||||
ROOT="$(cmdline -c root)"
|
ROOT="$(cmdline -c root)"
|
||||||
FLAGS="$(cmdline -c rootflags)"
|
FLAGS="$(cmdline -c rootflags)"
|
||||||
if cmdline -c ro
|
if cmdline -c ro
|
||||||
then
|
then FLAGS="${FLAGS},ro"
|
||||||
FLAGS="${FLAGS},ro"
|
|
||||||
elif cmdline -c rw
|
elif cmdline -c rw
|
||||||
then
|
then FLAGS="${FLAGS},rw"
|
||||||
FLAGS="${FLAGS},rw"
|
|
||||||
fi
|
fi
|
||||||
FSTYPE="$(cmdline -c rootfstype)"
|
FSTYPE="$(cmdline -c rootfstype)"
|
||||||
FSTYPE="${FSTYPE:-auto}"
|
FSTYPE="${FSTYPE:-auto}"
|
||||||
|
@ -57,9 +61,17 @@ log " mount ${ROOT} as ${FSTYPE} with ${FLAGS}"
|
||||||
if ! mount -o "${FLAGS}" -t "${FSTYPE}" "${ROOT}" /mnt
|
if ! mount -o "${FLAGS}" -t "${FSTYPE}" "${ROOT}" /mnt
|
||||||
then
|
then
|
||||||
err "Can't mount root!"
|
err "Can't mount root!"
|
||||||
|
[ Xtrue = "X$NOSEC" ] && exec sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ISIRDSH -> shell for debugging, testing, what ever...
|
||||||
|
if [ Xtrue = "X$NOSEC" ] && cmdline -c ISIRDSH
|
||||||
|
then
|
||||||
exec sh
|
exec sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
INIT="$(cmdline -c init)"
|
||||||
|
INIT="${INIT:-/sbin/init}"
|
||||||
cd /mnt
|
cd /mnt
|
||||||
log " Change to new root"
|
log " Change to new root"
|
||||||
exec switch_root /mnt /bin/sh
|
exec switch_root /mnt "$INIT"
|
||||||
|
|
Loading…
Reference in a new issue