[Midnightbsd-cvs] CVS Commit: etc/rc.d: Add firstboot script to do last minute

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Aug 5 20:23:52 EDT 2007


Log Message:
-----------
Add firstboot script to do last minute configuration.

Currently, we just want to install packages for GNUstep, X11, WindowMaker, and slim.

firstboot needs to start after the network is up so we intentionally position it after dhclient just in case.

Modified Files:
--------------
    src/etc/rc.d:
        Makefile (r1.5 -> r1.6)
        dhclient (r1.2 -> r1.3)

Added Files:
-----------
    src/etc/rc.d:
        firstboot (r1.1)

-------------- next part --------------
--- /dev/null
+++ etc/rc.d/firstboot
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/firstboot,v 1.1 2007/08/06 00:23:51 laffer1 Exp $
+
+# PROVIDE: firstboot
+# REQUIRE: NETWORKING cleanvar
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="firstboot"
+rcvar=
+start_cmd="firstboot_start"
+required_files="/etc/reconfig"
+
+firstboot_start()
+{
+	local lsuffix
+	local red
+	local yellow
+
+	lsuffix="\e[0m"
+	red="\e[1;31;40m"
+	yellow="\e[1;33;40m"
+
+	if [ -f /etc/reconfig ]; then
+		echo -e "\r${red}MidnightBSD FirstBoot Configuration${lsuffix}"
+
+		echo "This utility requires an active Internet connection."
+		echo -e "\r${yellow}Do you wish to install a graphical environment? (yes or no)${lsuffix}"
+		read installgui
+
+		if [ ${installgui} = "yes" ]; then
+			echo -e "\r${red}Installing Graphical User Interface${lsuffix}"
+			/usr/sbin/pkg_add -r gnustep
+			/usr/sbin/pkg_add -r slim
+			/usr/sbin/pkg_add -r windowmaker
+			echo -e "\r${yellow}Done.${lsuffix}"
+		else
+			echo "To run this utility again, touch /etc/reconfig and restart."
+		fi
+		rm -f /etc/reconfig
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
Index: dhclient
===================================================================
RCS file: /home/cvs/src/etc/rc.d/dhclient,v
retrieving revision 1.2
retrieving revision 1.3
diff -Letc/rc.d/dhclient -Letc/rc.d/dhclient -u -r1.2 -r1.3
--- etc/rc.d/dhclient
+++ etc/rc.d/dhclient
@@ -6,7 +6,7 @@
 
 # PROVIDE: dhclient
 # KEYWORD: nojail nostart
-#
+# BEFORE: firstboot
 
 . /etc/rc.subr
 . /etc/network.subr
Index: Makefile
===================================================================
RCS file: /home/cvs/src/etc/rc.d/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -Letc/rc.d/Makefile -Letc/rc.d/Makefile -u -r1.5 -r1.6
--- etc/rc.d/Makefile
+++ etc/rc.d/Makefile
@@ -10,7 +10,7 @@
 	devd devfs dhclient \
 	dmesg dumpon \
 	early.sh encswap \
-	fsck ftpd \
+	firstboot fsck ftpd \
 	gbde geli geli2 \
 	hcsecd \
 	hostapd hostname \


More information about the Midnightbsd-cvs mailing list