From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Po1Jb-00033i-Kx for garchives@archives.gentoo.org; Fri, 11 Feb 2011 22:18:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 68778E0AA3; Fri, 11 Feb 2011 22:18:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 231CEE0AA3 for ; Fri, 11 Feb 2011 22:18:03 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7B8B81B42FC for ; Fri, 11 Feb 2011 22:18:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B078C8006A for ; Fri, 11 Feb 2011 22:18:01 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <5ae07639698fef9d32049919935d478e0c400e2a.williamH@gentoo> Subject: [gentoo-commits] proj/livecd-tools:bl2-only commit in: / X-VCS-Repository: proj/livecd-tools X-VCS-Files: fixinittab livecd-functions.sh X-VCS-Directories: / X-VCS-Committer: williamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 5ae07639698fef9d32049919935d478e0c400e2a Date: Fri, 11 Feb 2011 22:18:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 857fc683619b310dd44e38b1b5ea906c commit: 5ae07639698fef9d32049919935d478e0c400e2a Author: William Hubbs gentoo org> AuthorDate: Fri Feb 11 22:13:36 2011 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Feb 11 22:13:36 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/livecd-tools.= git;a=3Dcommit;h=3D5ae07639 add fixinittab service This is a port of the fix_inittab function from baselayout-1's version of the livecd-tools. In openrc it is set up as a service which should be added to the sysinit runlevel. --- fixinittab | 100 +++++++++++++++++++++++++++++++++++++++++++++= ++++++ livecd-functions.sh | 93 ---------------------------------------------= -- 2 files changed, 100 insertions(+), 93 deletions(-) diff --git a/fixinittab b/fixinittab new file mode 100755 index 0000000..b68be31 --- /dev/null +++ b/fixinittab @@ -0,0 +1,100 @@ +#!/bin/runscript + +depend() +{ + before dev +} + +start() +{ + if [ "${CDBOOT}" =3D "" ] + then + return 1 + fi + + # Create a backup + cp -f /etc/inittab /etc/inittab.old + + # Comment out current getty settings + sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab + sed -i -e '/^s[01]/ s/^/#/' /etc/inittab + + # SPARC & HPPA console magic + if [ "${HOSTTYPE}" =3D "sparc" -o "${HOSTTYPE}" =3D "hppa" -o "${HOSTTY= PE}" =3D "ppc64" ] + then + # Mount openprom tree for user debugging purposes + if [ "${HOSTTYPE}" =3D "sparc" ] + then + mount -t openpromfs none /proc/openprom + fi + + # SPARC serial port A, HPPA mux / serial + if [ -c "/dev/ttyS0" ] + then + LIVECD_CONSOLE_BAUD=3D$(stty -F /dev/ttyS0 speed) + echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ttyS0 vt100" >> /etc/inittab + fi + # HPPA software PDC console (K-models) + if [ "${LIVECD_CONSOLE}" =3D "ttyB0" ] + then + mknod /dev/ttyB0 c 11 0 + LIVECD_CONSOLE_BAUD=3D$(stty -F /dev/ttyB0 speed) + echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ttyB0 vt100" >> /etc/inittab + fi + # FB / STI console + if [ -c "/dev/vc/1" -o -c "/dev/tts/1" -o -c "/dev/tty2" ] + then + MODEL_NAME=3D$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //') + if [ "${MODEL_NAME}" =3D "UML" ] + then + for x in 0 1 2 3 4 5 6 + do + echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin r= oot tty${x}" >> /etc/inittab + done + else + for x in 1 2 3 4 5 6 + do + echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin r= oot tty${x}" >> /etc/inittab + done + fi + fi + if [ -c "/dev/hvc0" ] + then + einfo "Adding hvc console to inittab" + echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 9600 hvc0 vt32= 0" >> /etc/inittab + fi + + + # The rest... + else + if [ "${LIVECD_CONSOLE}" =3D "tty0" -o "${LIVECD_CONSOLE}" =3D "" ] + then + for x in 1 2 3 4 5 6 + do + echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty$= {x} linux" >> /etc/inittab + done + else + einfo "Adding ${LIVECD_CONSOLE} console to inittab" + echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ${LIVECD_CONSOLE} vt100" >> /etc/inittab + fi + fi + + # EFI-based machines should automatically hook up their console lines + if dmesg | grep -q '^Adding console on' + then + dmesg | grep '^Adding console on' | while read x; do + line=3D`echo "$x" | cut -d' ' -f4` + id=3De`echo "$line" | grep -o '.\{1,3\}$'` + [ "${line}" =3D "${LIVECD_CONSOLE}" ] && continue # already setup ab= ove + case "$x" in + *options\ \'[0-9]*) speed=3D`echo "$x" | sed "s/.*options '//; s/[^0= -9].*//"` ;; + *) speed=3D9600 ;; # choose a default, only matters if it is serial + esac + echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${li= ne} vt100" >> /etc/inittab + done + fi + + # force reread of inittab + telinit q + return 0 +} diff --git a/livecd-functions.sh b/livecd-functions.sh index d51dd9e..96a6dd7 100755 --- a/livecd-functions.sh +++ b/livecd-functions.sh @@ -538,96 +538,3 @@ livecd_read_commandline() { done return 0 } - -livecd_fix_inittab() { - if [ "${CDBOOT}" =3D "" ] - then - return 1 - fi - - # Create a backup - cp -f /etc/inittab /etc/inittab.old - - # Comment out current getty settings - sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab - sed -i -e '/^s[01]/ s/^/#/' /etc/inittab - - # SPARC & HPPA console magic - if [ "${HOSTTYPE}" =3D "sparc" -o "${HOSTTYPE}" =3D "hppa" -o "${HOSTTY= PE}" =3D "ppc64" ] - then - # Mount openprom tree for user debugging purposes - if [ "${HOSTTYPE}" =3D "sparc" ] - then - mount -t openpromfs none /proc/openprom - fi - - # SPARC serial port A, HPPA mux / serial - if [ -c "/dev/ttyS0" ] - then - LIVECD_CONSOLE_BAUD=3D$(stty -F /dev/ttyS0 speed) - echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ttyS0 vt100" >> /etc/inittab - fi - # HPPA software PDC console (K-models) - if [ "${LIVECD_CONSOLE}" =3D "ttyB0" ] - then - mknod /dev/ttyB0 c 11 0 - LIVECD_CONSOLE_BAUD=3D$(stty -F /dev/ttyB0 speed) - echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ttyB0 vt100" >> /etc/inittab - fi - # FB / STI console - if [ -c "/dev/vc/1" -o -c "/dev/tts/1" -o -c "/dev/tty2" ] - then - MODEL_NAME=3D$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //') - if [ "${MODEL_NAME}" =3D "UML" ] - then - for x in 0 1 2 3 4 5 6 - do - echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin r= oot tty${x}" >> /etc/inittab - done - else - for x in 1 2 3 4 5 6 - do - echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin r= oot tty${x}" >> /etc/inittab - done - fi - fi - if [ -c "/dev/hvc0" ] - then - einfo "Adding hvc console to inittab" - echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 9600 hvc0 vt32= 0" >> /etc/inittab - fi - - - # The rest... - else - if [ "${LIVECD_CONSOLE}" =3D "tty0" -o "${LIVECD_CONSOLE}" =3D "" ] - then - for x in 1 2 3 4 5 6 - do - echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty$= {x} linux" >> /etc/inittab - done - else - einfo "Adding ${LIVECD_CONSOLE} console to inittab" - echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSO= LE_BAUD} ${LIVECD_CONSOLE} vt100" >> /etc/inittab - fi - fi - - # EFI-based machines should automatically hook up their console lines - if dmesg | grep -q '^Adding console on' - then - dmesg | grep '^Adding console on' | while read x; do - line=3D`echo "$x" | cut -d' ' -f4` - id=3De`echo "$line" | grep -o '.\{1,3\}$'` - [ "${line}" =3D "${LIVECD_CONSOLE}" ] && continue # already setup ab= ove - case "$x" in - *options\ \'[0-9]*) speed=3D`echo "$x" | sed "s/.*options '//; s/[^0= -9].*//"` ;; - *) speed=3D9600 ;; # choose a default, only matters if it is serial - esac - echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${li= ne} vt100" >> /etc/inittab - done - fi - - # force reread of inittab - kill -HUP 1 - return 0 -}