aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-09-23 19:56:38 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-09-23 19:56:38 +0000
commite45d7d7006340e5503863b0a44d46662f5a3ad71 (patch)
treef05ac65bd9292b41a082430322985462ea0a096e /target
parent5fc14dfb873c5d50e470c6b124fec05f8b4b2feb (diff)
downloadupstream-e45d7d7006340e5503863b0a44d46662f5a3ad71.tar.gz
upstream-e45d7d7006340e5503863b0a44d46662f5a3ad71.tar.bz2
upstream-e45d7d7006340e5503863b0a44d46662f5a3ad71.zip
ar71xx: enable login only on the system console by default
SVN-Revision: 28294
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/base-files/etc/inittab2
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup25
2 files changed, 25 insertions, 2 deletions
diff --git a/target/linux/ar71xx/base-files/etc/inittab b/target/linux/ar71xx/base-files/etc/inittab
index af4bf80dc0..17f829f6d4 100644
--- a/target/linux/ar71xx/base-files/etc/inittab
+++ b/target/linux/ar71xx/base-files/etc/inittab
@@ -1,4 +1,2 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
-ttyS0::askfirst:/bin/ash --login
-ttyATH0::askfirst:/bin/ash --login
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup b/target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup
new file mode 100755
index 0000000000..4836817bef
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+enable_console_login() {
+ local cons=$1
+ local initline="$cons::askfirst:/bin/ash --login"
+
+ grep -qs "^$initline" /etc/inittab || {
+ echo "$initline" >> /etc/inittab
+ sync
+ kill -HUP 1
+ }
+}
+
+inittab_console_fixup() {
+ for cons in ttyS0 ttyATH0; do
+ grep -qs "console=$cons" /proc/cmdline && {
+ enable_console_login $cons
+ }
+ done
+}
+
+inittab_console_fixup