ref: 338e7f1e776b46dce97fd64e52e3551f08067071
parent: d9a8fe9f014b9081222cf1981b6ad3fa0603bef4
author: Natanael Copa <ncopa@alpinelinux.org>
date: Thu Dec 17 04:48:11 CST 2015
init: add tty from cmdline to securetty
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -136,10 +136,15 @@
[ "$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
}