From 2d95c9a756c4c7b9301e04c274c3b139e0d1aef4 Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Thu, 10 Jan 2008 23:22:46 +0000
Subject: Loads of NetBSD tweaks here.

---
 etc.BSD/rc                 |  3 --
 etc.BSD/rc.shutdown        |  9 ++----
 init.d.BSD/clock           | 79 ----------------------------------------------
 init.d.FreeBSD/clock       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 init.d/bootmisc            |  5 ++-
 net.BSD/ifconfig.sh        |  2 +-
 runlevels.FreeBSD/Makefile |  2 +-
 runlevels.Linux/Makefile   |  2 +-
 runlevels/Makefile         |  2 +-
 src/libeinfo/libeinfo.c    |  1 +
 src/librc/librc-misc.c     | 11 ++++---
 11 files changed, 98 insertions(+), 97 deletions(-)
 delete mode 100755 init.d.BSD/clock
 create mode 100644 init.d.FreeBSD/clock

diff --git a/etc.BSD/rc b/etc.BSD/rc
index 39b84526..d1bd1761 100644
--- a/etc.BSD/rc
+++ b/etc.BSD/rc
@@ -23,9 +23,6 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-# Ensure we are called by init
-[ "$PPID" = "1" ] || exit 0
-
 # If $TERM is not set then assume default of cons25
 # This gives us a nice colour boot :)
 [ -z "$TERM" -o "$TERM" = "dumb" ] && export TERM="cons25"
diff --git a/etc.BSD/rc.shutdown b/etc.BSD/rc.shutdown
index 691e94ad..6f3e852f 100644
--- a/etc.BSD/rc.shutdown
+++ b/etc.BSD/rc.shutdown
@@ -23,9 +23,6 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-# Ensure we are called by init
-[ "$PPID" = "1" ] || exit 0
-
 # Handle interrupts 
 trap : SIGINT SIGQUIT
 
@@ -41,8 +38,8 @@ export LD_LIBRARY_PATH="/lib${LD_LIBRARY_PATH:+:}${LDLIBRARY_PATH}"
 # This block should 'translate' from the way init calls it to the way it would
 # be called by sysvinit on linux.
 case "$1" in
-    reboot) 	export RUNLEVEL=6;;
-    shutdown)	export RUNLEVEL=0;;
-    single)		export RUNLEVEL=S;;
+	reboot) 	export RUNLEVEL=6;;
+	shutdown)	export RUNLEVEL=0;;
+	single)		export RUNLEVEL=S;;
 esac
 exec /sbin/rc "$1"
diff --git a/init.d.BSD/clock b/init.d.BSD/clock
deleted file mode 100755
index 85b47fa8..00000000
--- a/init.d.BSD/clock
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/sbin/runscript
-# Copyright 2007 Roy Marples
-# All rights reserved
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-extra_commands="save"
-
-description="Sets the local clock to UTC or Local Time." 
-description_save="Saves the current time in the BIOS."
-
-clock=${clock:-${CLOCK:-UTC}}
-if [ "${clock}" = "UTC" ]; then
-	utc="UTC"
-else
-	utc="Local Time"
-fi
-
-depend() {
-	# BSD adjkerntz needs to be able to write to /etc
-	if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] ||
-	   [ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
-		need checkroot
-	fi
-}
-
-start() {
-	ebegin "Starting the System Clock Adjuster [${utc}]"
-	if [ "${clock}" != "UTC" ]; then
-		echo >/etc/wall_cmos_clock
-		start-stop-daemon --start --exec /sbin/adjkerntz -- -i
-	else
-		rm -f /etc/wall_cmos_clock
-		/sbin/adjkerntz -i
-	fi
-	eend $?
-}
-
-save() {
-	ebegin "Setting hardware clock using the system clock [${utc}]"
-	adjkerntz -a
-	eend $?
-}
-
-stop() {
-    # Don't tweak the hardware clock on LiveCD halt.
-	if yesno "${clock_systohc:-${CLOCK_SYSTOHC}}"; then
-	   [ -z "${CDBOOT}" ] && save
-	fi
-
-	ebegin "Stopping the System Clock Adjuster"
-	if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz; then
-		start-stop-daemon --stop --exec /sbin/adjkerntz
-		eend $?
-	else
-		eend 0
-	fi
-}
-
-# vim: set ts=4 :
diff --git a/init.d.FreeBSD/clock b/init.d.FreeBSD/clock
new file mode 100644
index 00000000..85b47fa8
--- /dev/null
+++ b/init.d.FreeBSD/clock
@@ -0,0 +1,79 @@
+#!/sbin/runscript
+# Copyright 2007 Roy Marples
+# All rights reserved
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+extra_commands="save"
+
+description="Sets the local clock to UTC or Local Time." 
+description_save="Saves the current time in the BIOS."
+
+clock=${clock:-${CLOCK:-UTC}}
+if [ "${clock}" = "UTC" ]; then
+	utc="UTC"
+else
+	utc="Local Time"
+fi
+
+depend() {
+	# BSD adjkerntz needs to be able to write to /etc
+	if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] ||
+	   [ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
+		need checkroot
+	fi
+}
+
+start() {
+	ebegin "Starting the System Clock Adjuster [${utc}]"
+	if [ "${clock}" != "UTC" ]; then
+		echo >/etc/wall_cmos_clock
+		start-stop-daemon --start --exec /sbin/adjkerntz -- -i
+	else
+		rm -f /etc/wall_cmos_clock
+		/sbin/adjkerntz -i
+	fi
+	eend $?
+}
+
+save() {
+	ebegin "Setting hardware clock using the system clock [${utc}]"
+	adjkerntz -a
+	eend $?
+}
+
+stop() {
+    # Don't tweak the hardware clock on LiveCD halt.
+	if yesno "${clock_systohc:-${CLOCK_SYSTOHC}}"; then
+	   [ -z "${CDBOOT}" ] && save
+	fi
+
+	ebegin "Stopping the System Clock Adjuster"
+	if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz; then
+		start-stop-daemon --stop --exec /sbin/adjkerntz
+		eend $?
+	else
+		eend 0
+	fi
+}
+
+# vim: set ts=4 :
diff --git a/init.d/bootmisc b/init.d/bootmisc
index 72254f11..5ba11743 100755
--- a/init.d/bootmisc
+++ b/init.d/bootmisc
@@ -56,7 +56,8 @@ cleanup_tmp_dir() {
 			! -path "./aquota.group/*" \
 			! -path ./journal \
 			! -path "./journal/*" \
-			-delete
+			-exec rm -rf -- {} \; \
+			-type d -prune
 		eend 0
 	else
 		ebegin "Cleaning ${dir} directory"
@@ -126,6 +127,8 @@ start() {
 		dmesg > /var/log/dmesg
 		chmod 640 /var/log/dmesg
 	fi
+
+	rm -f /etc/nologin
 }
 
 stop() {
diff --git a/net.BSD/ifconfig.sh b/net.BSD/ifconfig.sh
index d8957e95..438632cf 100644
--- a/net.BSD/ifconfig.sh
+++ b/net.BSD/ifconfig.sh
@@ -128,7 +128,7 @@ _add_address() {
 
 	# ifconfig doesn't like CIDR addresses
 	case "${RC_UNAME}" in
-		NetBSD|OpenBSD)
+		OpenBSD)
 			local ip="${1%%/*}" cidr="${1##*/}" netmask=
 			if [ -n "${cidr}" -a "${cidr}" != "${ip}" ]; then
 				netmask="$(_cidr2netmask "${cidr}")"
diff --git a/runlevels.FreeBSD/Makefile b/runlevels.FreeBSD/Makefile
index f258ba9a..601cf026 100644
--- a/runlevels.FreeBSD/Makefile
+++ b/runlevels.FreeBSD/Makefile
@@ -1,4 +1,4 @@
-BOOT=	dumpon hostid syscons
+BOOT=	clock dumpon hostid syscons
 
 MK=	../mk
 include ${MK}/runlevels.mk
diff --git a/runlevels.Linux/Makefile b/runlevels.Linux/Makefile
index 8271bb56..0e8557b8 100644
--- a/runlevels.Linux/Makefile
+++ b/runlevels.Linux/Makefile
@@ -1,4 +1,4 @@
-BOOT=		consolefont keymaps modules net.lo procfs
+BOOT=		clock consolefont keymaps modules net.lo procfs
 DEFAULT=	hdparm
 
 MK=			../mk
diff --git a/runlevels/Makefile b/runlevels/Makefile
index 5fe03721..7737678e 100644
--- a/runlevels/Makefile
+++ b/runlevels/Makefile
@@ -1,4 +1,4 @@
-BOOT=		bootmisc checkroot checkfs clock hostname localmount \
+BOOT=		bootmisc checkroot checkfs hostname localmount \
 		swap sysctl urandom
 DEFAULT=	local netmount
 
diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c
index 8dfe13f2..bebb3ef3 100644
--- a/src/libeinfo/libeinfo.c
+++ b/src/libeinfo/libeinfo.c
@@ -177,6 +177,7 @@ static const char *const color_terms[] = {
 	"screen-w",
 	"screen.linux",
 	"vt100",
+	"vt220",
 	"xterm",
 	"xterm-256color",
 	"xterm-color",
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index 4a16e9fe..08f5e4e4 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -151,11 +151,14 @@ char **rc_config_list (const char *file)
 		/* Get entry - we do not want comments */
 		token = strsep (&p, "#");
 		if (token && (strlen (token) > 1)) {
-			/* Stip the newline if present */
-			if (token[strlen (token) - 1] == '\n')
-				token[strlen (token) - 1] = 0;
+			/* If not variable assignment then skip */
+			if (strchr (token, '=')) {
+				/* Stip the newline if present */
+				if (token[strlen (token) - 1] == '\n')
+					token[strlen (token) - 1] = 0;
 
-			rc_strlist_add (&list, token);
+				rc_strlist_add (&list, token);
+			}
 		}
 		free (buffer);
 	}
-- 
cgit v1.2.3