ref: f97090ab1539ee680d4040b17ca54368879f6d62
parent: d7a45796d5997150b969500c41067e1de010e5b3
author: Natanael Copa <ncopa@alpinelinux.org>
date: Thu Aug 20 02:54:35 CDT 2009
init: setup serial login in inittab if console=ttyS*
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -147,6 +147,17 @@
done
}
+setup_inittab_serial(){
+ local tty=$1
+ local speed=$2
+
+ # do nothing if inittab already have the tty set up
+ grep -q "^$tty:" $sysroot/etc/inittab && return 0
+ echo "# enable login on serial console" >> $sysroot/etc/inittab
+ echo "$tty::respawn:/sbin/getty -L $tty $speed vt100" \
+ >> $sysroot/etc/inittab
+}
+
# gotta start from somewhere :)
echo "Alpine Init $VERSION"
@@ -365,6 +376,11 @@
fi
apk add --root $sysroot $repo_opt $apkflags $pkgs >/dev/null
eend $?
+
+# fix inittab if serial console
+case "$KOPT_console" in
+ ttyS*) setup_inittab_serial $(echo "$KOPT_console" | tr ',' ' ')
+esac
# copy alpine release info
cp $ALPINE_MNT/.alpine-release $sysroot/