aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-12-17 10:48:11 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-12-18 07:58:17 +0000
commit338e7f1e776b46dce97fd64e52e3551f08067071 (patch)
tree1cabfc2ab82064c7a249aee368aa1a1d0f0580fb
parentd9a8fe9f014b9081222cf1981b6ad3fa0603bef4 (diff)
downloadmkinitfs-338e7f1e776b46dce97fd64e52e3551f08067071.tar.bz2
mkinitfs-338e7f1e776b46dce97fd64e52e3551f08067071.tar.xz
init: add tty from cmdline to securetty
-rwxr-xr-xinitramfs-init.in13
1 files changed, 9 insertions, 4 deletions
diff --git a/initramfs-init.in b/initramfs-init.in
index cdf50b9..e9155e0 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -136,10 +136,15 @@ setup_inittab_console(){
[ "$tty" = "tty0" ] && continue
# do nothing if inittab already have the tty set up
- grep -q "^$tty:" $sysroot/etc/inittab && continue
- echo "# enable login on alternative console" >> $sysroot/etc/inittab
- echo "$tty::respawn:/sbin/getty $line $speed $tty $term" \
- >> $sysroot/etc/inittab
+ if ! grep -q "^$tty:" $sysroot/etc/inittab; then
+ echo "# enable login on alternative console" \
+ >> $sysroot/etc/inittab
+ echo "$tty::respawn:/sbin/getty $line $speed $tty $term" \
+ >> $sysroot/etc/inittab
+ fi
+ if [ -e "$sysroot"/etc/securetty ] && ! grep -q -w "$tty"; then
+ echo "$tty" >> "$sysroot"/etc/securetty
+ fi
done
}