public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/livecd-tools:bl2-only commit in: /
Date: Fri, 11 Feb 2011 22:18:01 +0000 (UTC)	[thread overview]
Message-ID: <5ae07639698fef9d32049919935d478e0c400e2a.williamH@gentoo> (raw)

commit:     5ae07639698fef9d32049919935d478e0c400e2a
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 11 22:13:36 2011 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Feb 11 22:13:36 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/livecd-tools.git;a=commit;h=5ae07639

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}" = "" ]
+	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}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
+	then
+		# Mount openprom tree for user debugging purposes
+		if [ "${HOSTTYPE}" = "sparc" ]
+		then
+			mount -t openpromfs none /proc/openprom
+		fi
+
+		# SPARC serial port A, HPPA mux / serial
+		if [ -c "/dev/ttyS0" ]
+		then
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyS0 speed)
+			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyS0 vt100" >> /etc/inittab
+		fi
+		# HPPA software PDC console (K-models)
+		if [ "${LIVECD_CONSOLE}" = "ttyB0" ]
+		then
+			mknod /dev/ttyB0 c 11 0
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyB0 speed)
+			echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_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=$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //')
+			if [ "${MODEL_NAME}" = "UML" ]
+			then
+			    for x in 0 1 2 3 4 5 6
+			    do
+				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root 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 root 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 vt320" >> /etc/inittab
+		fi
+
+
+	# The rest...
+	else
+		if [ "${LIVECD_CONSOLE}" = "tty0" -o "${LIVECD_CONSOLE}" = "" ]
+		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_CONSOLE_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=`echo "$x" | cut -d' ' -f4`
+			id=e`echo "$line" | grep -o '.\{1,3\}$'`
+			[ "${line}" = "${LIVECD_CONSOLE}" ] && continue  # already setup above
+			case "$x" in
+				*options\ \'[0-9]*) speed=`echo "$x" | sed "s/.*options '//; s/[^0-9].*//"` ;;
+				*) speed=9600 ;;  # choose a default, only matters if it is serial
+			esac
+			echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${line} 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}" = "" ]
-	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}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
-	then
-		# Mount openprom tree for user debugging purposes
-		if [ "${HOSTTYPE}" = "sparc" ]
-		then
-			mount -t openpromfs none /proc/openprom
-		fi
-
-		# SPARC serial port A, HPPA mux / serial
-		if [ -c "/dev/ttyS0" ]
-		then
-			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyS0 speed)
-			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyS0 vt100" >> /etc/inittab
-		fi
-		# HPPA software PDC console (K-models)
-		if [ "${LIVECD_CONSOLE}" = "ttyB0" ]
-		then
-			mknod /dev/ttyB0 c 11 0
-			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyB0 speed)
-			echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_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=$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //')
-			if [ "${MODEL_NAME}" = "UML" ]
-			then
-			    for x in 0 1 2 3 4 5 6
-			    do
-				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root 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 root 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 vt320" >> /etc/inittab
-		fi
-
-
-	# The rest...
-	else
-		if [ "${LIVECD_CONSOLE}" = "tty0" -o "${LIVECD_CONSOLE}" = "" ]
-		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_CONSOLE_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=`echo "$x" | cut -d' ' -f4`
-			id=e`echo "$line" | grep -o '.\{1,3\}$'`
-			[ "${line}" = "${LIVECD_CONSOLE}" ] && continue  # already setup above
-			case "$x" in
-				*options\ \'[0-9]*) speed=`echo "$x" | sed "s/.*options '//; s/[^0-9].*//"` ;;
-				*) speed=9600 ;;  # choose a default, only matters if it is serial
-			esac
-			echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${line} vt100" >> /etc/inittab
-		done
-	fi
-
-	# force reread of inittab
-	kill -HUP 1
-	return 0
-}



             reply	other threads:[~2011-02-11 22:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 22:18 William Hubbs [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-02-17  5:43 [gentoo-commits] proj/livecd-tools:bl2-only commit in: / William Hubbs
2011-02-13 19:27 William Hubbs
2011-02-12 22:15 William Hubbs
2011-02-12 20:04 William Hubbs
2011-02-12  7:19 William Hubbs
2011-02-12  6:32 William Hubbs
2011-02-12  5:33 William Hubbs
2011-02-12  4:33 William Hubbs
2011-02-12  2:17 William Hubbs
2011-02-12  0:45 William Hubbs
2011-02-11 23:45 William Hubbs
2011-02-11 22:34 William Hubbs
2011-02-11 22:27 William Hubbs
2011-02-11 21:14 William Hubbs
2011-02-11 21:07 Robin H. Johnson
2011-02-11 20:35 Robin H. Johnson
2011-02-11 20:21 William Hubbs
2011-02-11 17:43 William Hubbs
2011-02-11  4:22 William Hubbs
2011-02-11  0:26 William Hubbs
2011-02-11  0:06 Robin H. Johnson
2011-02-10 23:57 William Hubbs
2011-02-10 23:26 William Hubbs
2011-02-10 21:11 Robin H. Johnson
2011-02-10 21:11 Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ae07639698fef9d32049919935d478e0c400e2a.williamH@gentoo \
    --to=williamh@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox