[Lunar-commits] r18562 - lunar-iso/trunk/lunar-install/sbin

Auke Kok sofar at lunar-linux.org
Tue Feb 7 16:22:53 UTC 2006


Author: sofar
Date: 2006-02-07 16:22:50 +0000 (Tue, 07 Feb 2006)
New Revision: 18562

Modified:
   lunar-iso/trunk/lunar-install/sbin/lunar-install
Log:
Major revision:
* fixes to grub code (again)
* delete vc/X code - replaced with a decent inittab
* speed up disk/part detection code
* streamline some gui output/menus


Modified: lunar-iso/trunk/lunar-install/sbin/lunar-install
===================================================================
--- lunar-iso/trunk/lunar-install/sbin/lunar-install	2006-02-07 16:10:14 UTC (rev 18561)
+++ lunar-iso/trunk/lunar-install/sbin/lunar-install	2006-02-07 16:22:50 UTC (rev 18562)
@@ -1,13 +1,17 @@
 #!/bin/bash
 #############################################################
+#                                                           #
 # portions Copyright 2001 by Kyle Sallee                    #
 # portions Copyright 2002 by Kagan Kongar                   #
 # portions Copyright 2002 by rodzilla                       #
 # portions Copyright 2003, 2004 by tchan, kc8apf            #
-# portions Copyright 2004, 2005 by Auke Kok                 #
+# portions Copyright 2004, 2005, 2006 by Auke Kok           #
 #                                                           #
-# This file in released under the GPL                       #
 #############################################################
+#                                                           #
+# This file in released under the GPLv2                     #
+#                                                           #
+#############################################################
 
 
 is_26()
@@ -93,7 +97,11 @@
 		shutdown -r now
 		exit 0
 	else
-		kill `jobs -p` &> /dev/null
+		# bump the init level so we can exit safely!
+		init 3
+		# wait a bit so that we don't restart before level 3 has
+		# been reached
+		sleep 5
 		exit 0
 	fi
 }
@@ -155,8 +163,8 @@
 		if [ -f "$CHOICE" ]; then
 			MODULE=`/bin/basename $MODULE | /bin/sed -e "s/\.o$//" -e "s/\.ko$//"`
 			PARAMETERS=`input_module_parameters` &&
-			/sbin/modprobe $CHOICE $PARAMETERS
-			/bin/sleep 2
+			modprobe $CHOICE $PARAMETERS
+			sleep 2
 		elif [ -d "$CHOICE" ]; then
 			cd "$CHOICE"
 		fi
@@ -178,15 +186,9 @@
 	case $1 in
 		init)
 			# fill the list with devices
-			for DEVICE in $(list_discs); do
-				block_devices add "$DEVICE:disc"
+			for DEVICE in $(list_block_devices); do
+				block_devices add $DEVICE
 			done
-			for DEVICE in $(list_partitions); do
-				block_devices add "$DEVICE:part"
-			done
-			for DEVICE in $(list_other_block_devices); do
-				block_devices add "$DEVICE:other"
-			done
 			;;
 		add)
 			DEVICES=( ${DEVICES[@]} $2 )
@@ -240,39 +242,28 @@
 )}
 
 
-list_discs()
-{(
+list_block_devices()
+{
 	local NAME MAJOR MINOR
 	fetch_system_block_devices | while read NAME MAJOR MINOR ; do
-		if [ "$MAJOR" == 3 -o "$MAJOR" == 8 ] && [ $((MINOR % 16)) == "0" ]; then
-			echo $NAME
-		fi
+		case $MAJOR in
+			3|8|104)
+				# ide/scsi/cciss devices
+				if [ $(($MINOR % 16)) == 0 ]; then
+					echo "$NAME:disc"
+				else
+					echo "$NAME:part"
+				fi
+				;;
+			*)
+				# anything else we tag as 'other' for now
+				echo "$NAME:other"
+				;;
+		esac
 	done
-)}
+}
 
 
-list_partitions()
-{(
-	local NAME MAJOR MINOR
-	fetch_system_block_devices | while read NAME MAJOR MINOR ; do
-		if [ "$MAJOR" == 3 -o "$MAJOR" == 8 ] && [ $((MINOR % 16)) != "0" ]; then
-			echo $NAME
-		fi
-	done
-)}
-
-
-list_other_block_devices()
-{(
-	local NAME MAJOR MINOR
-	fetch_system_block_devices | while read NAME MAJOR MINOR ; do
-		if [ "$MAJOR" != 3 -a "$MAJOR" != 8 ] ; then
-			echo $NAME
-		fi
-	done
-)}
-
-
 menu_list_devices()
 {
 	local DEVICE
@@ -856,23 +847,26 @@
 
 install_grub()
 {
-	GRUB_ROOT=$(lsh map_device_to_grub $ROOT)
-	GRUB_DISC=$(echo $GRUB_ROOT | cut -d, -f1)
+	# grub lives on the "/" partition unless we have a separate
+	# "/boot" partition. Hence we use $BOOT to determine the grub location.
+	GRUB_PART=$(lsh map_device_to_grub $BOOT)
+	# and we go straight to the MBR
+	GRUB_MBR=$(echo $GRUB_PART | cut -d, -f1)
 	
 	(
-		echo "root ($GRUB_ROOT)"
-		echo "setup ($GRUB_DISC)"
+		echo "root ($GRUB_PART)"
+		echo "setup ($GRUB_MBR)"
 		echo "quit"
 	) | grub --no-curses
 	sleep 2
 
-	# setup grub details
+	# setup details needed for frub later:
 	if [ "$BOOT" == "$ROOT" ]; then
 		GRUB_BOOT=/boot
 	else
 		GRUB_BOOT=""
 	fi
-	GRUB_ROOT="($GRUB_ROOT)"
+	GRUB_ROOT="($(lsh map_device_to_grub $ROOT))"
 	export GRUB_ROOT GRUB_BOOT
 
 	echo ""
@@ -881,7 +875,7 @@
 	echo "  kernel $GRUB_BOOT/\${ image name }"
 	echo ""
 
-	echo "grub was installed on the MBR of $GRUB_DISC"
+	echo "grub was installed on the MBR of $GRUB_MBR"
 	sleep 4
 }
 
@@ -1110,6 +1104,8 @@
 	
 		# really we are done now ;^)
 		) | $DIALOG --title " Installing Lunar-Linux " --gauge "" 10 70 0 
+
+		cd /
 		
 		if (( STEP == 6 )); then
 			(( STEP++ ))
@@ -1124,7 +1120,10 @@
 shell()
 {
 	echo "Press CTRL-D or type exit to return to the installer"
-	/bin/bash -ls
+	(
+		cd
+		SHELL=/bin/bash HOME=/root /bin/bash -ls
+	)
 }
 
 
@@ -1546,7 +1545,7 @@
 		K_OK="\\Z1"
 	
 		R_LABEL="Set root password"
-		R_HELP="Set the default root password needed to access this system (the default password is empty)"
+		R_HELP="Set root password needed to access this system (the default password is empty)"
 		R_OK="\\Z1"
 		U_LABEL="Setup user accounts"
 		U_HELP="Create, edit, delete users and group accounts on the system"
@@ -1700,6 +1699,7 @@
 }  
 
 
+# start up the code
 . /etc/lunar/config
 
 DIALOG="dialog
@@ -1712,28 +1712,12 @@
 
 trap ":" INT QUIT
 
-# don't do all this when we are fully booted
-if [ "$(runlevel)" == "unknown" ]; then
-	# no screen blanking
-	/usr/bin/setterm -blank 0
+$DIALOG --infobox "Lunar-Linux Installer %VERSION% - %CODENAME% starting... " 4 60
 
-	cd /
+# turn off console blanking
+/usr/bin/setterm -blank 0
+cd /
 
-	# start shells on vt's
-	for i in 2 3 4; do
-	  (
-		export PS1="[vt$i] \033[0;32m\]\u@\h \w $ \[\033[0m\]"
-		while true; do
-			/sbin/agetty -n -l /bin/bash 38400 tty$i linux
-		done
-	  ) &
-	done
-	export PS1="[vt1] \033[0;36m\]\u@\h \w $ \[\033[0m\]"
-
-fi
-
-
-
 # allow custom startup scripts to run instead of the installer
 if [ -x /run.sh ]; then
 	echo ""



More information about the Lunar-commits mailing list