SF.net SVN: morphix: [2621] trunk/scripts-base

[email protected] Sun, 30 Mar 2008 13:09:24 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2621
          http://morphix.svn.sourceforge.net/morphix/?rev=2621&view=rev
Author:   alextreme
Date:     2008-03-30 13:09:22 -0700 (Sun, 30 Mar 2008)

Log Message:
-----------
 * small number of fixes to base bootscripts

Modified Paths:
--------------
    trunk/scripts-base/debian/changelog
    trunk/scripts-base/etc/init.d/alsa-autoconfig
    trunk/scripts-base/etc/init.d/knoppix-autoconfig
    trunk/scripts-base/etc/init.d/morphix-start
    trunk/scripts-base/usr/sbin/rebuildfstab-morphix

Modified: trunk/scripts-base/debian/changelog
===================================================================
--- trunk/scripts-base/debian/changelog	2008-03-27 16:46:19 UTC (rev 2620)
+++ trunk/scripts-base/debian/changelog	2008-03-30 20:09:22 UTC (rev 2621)
@@ -1,3 +1,9 @@
+morphix-base-scripts (0.5-66) unstable; urgency=low
+
+  * bug-fix
+
+ -- Alex de Landgraaf <[email protected]>  Fri, 28 Mar 2008 12:04:01 +0100
+
 morphix-base-scripts (0.5-65) unstable; urgency=low
 
   * Large cleanup of pre-udev stuff, restructuring loading of main/minimods

Modified: trunk/scripts-base/etc/init.d/alsa-autoconfig
===================================================================
--- trunk/scripts-base/etc/init.d/alsa-autoconfig	2008-03-27 16:46:19 UTC (rev 2620)
+++ trunk/scripts-base/etc/init.d/alsa-autoconfig	2008-03-30 20:09:22 UTC (rev 2621)
@@ -22,6 +22,7 @@
 
 if [ -n "$ALSAPATH" ]; 
 then
+mkdir /etc/modutils
 cat << EOF > /etc/modutils/1alsa
 path[misc]=$ALSAPATH
 depfile=$ALSAPATH/modules.dep

Modified: trunk/scripts-base/etc/init.d/knoppix-autoconfig
===================================================================
--- trunk/scripts-base/etc/init.d/knoppix-autoconfig	2008-03-27 16:46:19 UTC (rev 2620)
+++ trunk/scripts-base/etc/init.d/knoppix-autoconfig	2008-03-30 20:09:22 UTC (rev 2621)
@@ -642,6 +642,20 @@
     done </etc/fstab
 fi
 
+# Mount all filesystems listed in fstab (read-only)
+# fstab has been generated by rebuildfstab-morphix in knoppix-autoconfig
+
+mount -a -r
+
+# Proc and sys need to be writable
+
+mount -t proc proc /proc 2>/dev/null
+mount -t sysfs /sys /sys 2>/dev/null
+
+# /media/cdrom doesn't mount automatically
+
+mount /media/cdrom
+
 if test -n "$SPLASH"; then
     echo "show 32000">/proc/splash 2>/dev/null
 fi
@@ -721,12 +735,12 @@
 fi
 # Check for extra shellscript on CD-Rom (/cdrom/base/morphix.sh)
 for i in morphix.sh MORPHIX.SH MORPHIX.sh Morphix.sh; do
-    if [ -f /cdrom/base/$i ]; then
+    if [ -f /media/cdrom/base/$i ]; then
 	echo ""
 	FOUND_CONFIG="yes"
-	echo " ${GREEN}Morphix Configuration file found in /cdrom/base, executing ${MAGENTA}$i${GREEN}.${NORMAL}"
+	echo " ${GREEN}Morphix Configuration file found in /media/cdrom/base, executing ${MAGENTA}$i${GREEN}.${NORMAL}"
 	echo "6" > /proc/sys/kernel/printk
-	. /cdrom/base/$i /cdrom/base || true
+	. /media/cdrom/base/$i /media/cdrom/base || true
 	echo "0" > /proc/sys/kernel/printk
 	break
     fi

Modified: trunk/scripts-base/etc/init.d/morphix-start
===================================================================
--- trunk/scripts-base/etc/init.d/morphix-start	2008-03-27 16:46:19 UTC (rev 2620)
+++ trunk/scripts-base/etc/init.d/morphix-start	2008-03-30 20:09:22 UTC (rev 2621)
@@ -44,83 +44,6 @@
      unset SPLASH
 fi
 
-findfile(){
-    FOUND=""
-# search all partitions for a file in the root directory
-    for i in /mnt/[sh]d[a-z] /mnt/[sh]d[a-z][1-9] /mnt/[sh]d[a-z][1-9]?*; do
-# See if it's already mounted
-	[ -f "$i/$1" ] &&  { echo "$i/$1"; return 0; }
-	if [ -d "$i" ] && mount -r "$i" 2>/dev/null; then
-	    [ -f "$i/$1" ] && FOUND="$i/$1"
-	    umount -l "$i" 2>/dev/null
-	    [ -n "$FOUND" ] && { echo "$FOUND"; return 0; }
-	fi
-    done
-    return 2
-}
-
-###
-#
-# create the home image
-# look for USB memory device first
-#
-###
-
-createfile(){
-FOUND=""
-# search all partitions for a file in the root directory
-for i in /mnt/sd[a-z] /mnt/sd[a-z][1-9] /mnt/hd[a-z][1-9] /mnt/hd[a-z] /mnt/[sh]d[a-z][1-9]?*; do
-  # See if it's already mount ant exist
-    [ -f "$i/$1" ] &&  { echo "$i/$1"; return 0; }
-    
-  # mountit and create
-    if [ -d "$i" ] && mount -o rw "$i" 2>/dev/null; 
-	then
-    # See if it's already exist
-	if [ -f "$i/$1" ];then
-	    FOUND="$i/$1"
-	    umount -l "$i" 2>/dev/null
-	    echo "$FOUND" 
-	    return 0
-	fi  
-	
-	MIN_HOME="51200"
-	MAX_HOME="102400"
-	fs=`mount | grep $i |while read  mdev mon mount mtype mfs mopt;do echo $mfs;done`;
-	case "$fs" in *[Nn][Tt][Ff][Ss]*)
-;;
-*)
-        DEVICE_SIZE=`LANG=C df -hk $i | tail -n1| cut -c 41-50`
-	if test -n "$DEVICE_SIZE" -a "$(expr $DEVICE_SIZE / 1)" -gt "$MAX_HOME"; then
-	    if dd if=/dev/zero of=$i/$1 bs=1K count=$MAX_HOME;then
-	        mke2fs -q -F $i/$1
-	        e2fsck -y $i/$1
-	        umount -l "$i" 2>/dev/null
-	        FOUND="$i/$1"
-	        echo "$FOUND" 
-	        return 0
-	    fi
-	fi
-
-	if test -n "$DEVICE_SIZE" -a "$(expr $DEVICE_SIZE / 1)" -gt "$MIN_HOME"; then
-	    if dd if=/dev/zero of=$i/$1 bs=1K count=$MIN_HOME;then
-	        mke2fs -q -F $i/$1
-	        e2fsck -y $i/$1
-	        umount -l "$i" 2>/dev/null
-	        FOUND="$i/$1"
-	        echo "$FOUND" 
-	        return 0
-	    else
-	        umount -l "$i" 2>/dev/null		
-	    fi
-	fi
-	;;
-	esac
-  fi
-  done
-return 2
-}
-
 # Try to mount this filesystem read-only, without or with encryption
 
 trymount(){
@@ -187,67 +110,6 @@
 
 ###
 #
-# MiniModule loading section
-#
-###
-
-# Mount MiniModules here so we can determine the mount overlay command options
-mount_mini_modules() {
-
-    CdromMiniModules="$(ls /cdrom/minimod/*.mod 2> /dev/null )"
-    CdromMiniModulesCount="$(ls -1 /cdrom/minimod/*.mod 2> /dev/null | wc -l  )"
-
-    for file in $CdromMiniModules; do
-	load_mini_module "$file" $MiniModuleCount >/dev/null 2>&1
-	if [ $? -eq 0 ]; then
-	      ((MiniModuleCount += 1))
-	fi
-    done
-
-}
-
-load_mini_module() {
-
-    file="$1"
-    countarg="$2"
-    count=$(($countarg+2)) # we have a base module, and a mainmodule loaded
-
-    if [ ! -d /mnt/main/mnt/mini/mod$count ]; then
-	mkdir -p /mnt/main/mnt/mini/mod$count
-	mount_module $file /mnt/main/mnt/mini/mod$count $count
-    fi
-    return 0
-}
-
-# Work out mount options so we can support minimodule overlays.
-mount_options () {
-
-    # Currently we only support unionfs
-    UNIONFS="on"
-    export UNIONFS
-
-    # This shouldn't be necessary,
-    # as --add overlaying is in load-minimodules.sh
-
-    for d in /mnt/main/mnt/mini/mod*; do
-	if [ -f ${d}/morphix/mini_module.conf ]; then
-	    unset MINI_MODULE_OVERLAY
-	    . ${d}/morphix/mini_module.conf >/dev/null 2>&1
-	    if [ -n $MINI_MODULE_OVERLAY  ]; then
-		if [ $MINI_MODULE_OVERLAY == "1" ] || [ $MINI_MODULE_OVERLAY == "[yY][eE][sS]" ]; then
-		    # add support for other overlayfs's here.
-		    if [ "$UNIONFS" == "on" ]; then
-	     		UNIONFS_MOUNT_OPT=${UNIONFS_MOUNT_OPT}:${d}=ro
-		    fi
-		fi
-	    fi
-	fi
-    done
-
-}
-
-###
-#
 # MainModule loading section
 #
 ###
@@ -314,7 +176,6 @@
 	mkdir -p $DIR2/modules >/dev/null 2>&1
 
 	mount -t unionfs -o dirs=$DIR2/root=rw:/mnt/main_ro=ro${UNIONFS_MOUNT_OPT} none /mnt/main
-        fi
 	eend $?
 
 	mount -t unionfs -o dirs=$DIR2/modules=rw:/MorphixCD/lib/modules=ro none /mnt/main/lib/modules
@@ -363,15 +224,6 @@
 mount --bind /home /mnt/main/home
 mount --bind /home/root /mnt/main/root
 
-# Mount all harddisk partitions read-only (backgrounded)
-# Updated for udev
-
-for i in /mnt/main/media/[sh]d[a-z][1-9]; do
-    if [ -d "$i" ]; then
-	mount -r "$i" &
-    fi
-done
-
 mkdir /mnt/main/MorphixCD 2> /dev/null
 mount --bind -o ro /MorphixCD /mnt/main/MorphixCD
 
@@ -391,6 +243,7 @@
 mkdir /mnt/main/floppy >/dev/null 2>&1
 
 mount --bind /mnt /mnt/main/mnt
+mount --bind /media /mnt/main/media
 mount --bind -o ro /cdrom /mnt/main/cdrom
 
 chroot /mnt/main mount -t sysfs /sys /sys > /dev/null 2>&1
@@ -506,6 +359,7 @@
 fi
 
 chroot /mnt/main useradd -s /bin/bash $USERNAME
+chroot /mnt/main mkdir -p /home/$USERNAME
 chroot /mnt/main chown -R $USERNAME.users /home/$USERNAME
 
 # make sure our users will have the locale exported by default
@@ -631,14 +485,8 @@
     echo "nameserver $ETHDNS" >> /mnt/main/etc/resolv.conf
 fi
 
-# If not using usb as /cdrom, also check the mounted /mnt/usb for
-# DCE directories
+deb_copy_exec /media/cdrom
 
-deb_copy_exec /cdrom
-if [ -z "$USBSTORAGE" ]; then
-    deb_copy_exec /mnt/usb
-fi
-
 # ---
 # Load minimodules
 
@@ -783,82 +631,38 @@
 # Check devices for mainmodule
 #
 
-if [ -z "$USBSTORAGE" ]; then
-    MainModules="$(ls -d1 /media/*/mainmod/*.mod 2> /dev/null)"
-    MainModulesCount="$(ls -d1 /media/*/mainmod/*.mod 2> /dev/null | wc -l)"
-    if [ $MainModulesCount = 0 ]; then
-	einfo "No MainModules found on connected devices"
-    fi
-    if [ $MainModulesCount = 1 ]; then
-	einfo "Loading MainModule from connected device"
-	MainModuleLoaded="$MainModules"
-	load_module "$MainModules"
-    elif [ $MainModulesCount > 1 ]; then
-	    echo
-	    einfo "More than one MainModule found on devices"
-	    einfo "List of modules:"
-	    einfo "${WHITE} $UsbMainModules ${NORMAL}" 
-	    echo
-	    PS3='Please enter the desired MainModule: '
-	    
-	    select MainMod in $MainModules
-	    do
-	    echo
-	    einfo "Loading $MainMod"
-	    echo
-	    MainModuleLoaded="$MainMod"
-	    load_module "$MainMod"
-	    break
-	    done
-	fi
-    fi
-fi
 
-###
-#
-# Find MainModules from /cdrom, select if > 1
-#
-###
-
-if [ -z "$MYMAINDIR" ]; then
-    MainModules="$(ls -d1 /cdrom/mainmod/*.mod 2> /dev/null )"
-    MainModulesCount="$(ls -d1 /cdrom/mainmod/*.mod 2> /dev/null | wc -l  )"
-fi
-
-if [ $MainModulesCount = 0 ];  
-then
-    einfo "No MainModules found"
-    einfo "Continuing with MorphixBase..."
-    echo 
-    einfo "This is a thinned-down distribution based on Debian GNU/Linux"
-    einfo " Check to see if your MainModule is on the liveCD in /cdrom/mainmod"
+MainModules="$(ls -d1 /media/*/mainmod/*.mod 2> /dev/null)"
+MainModulesCount="$(ls -d1 /media/*/mainmod/*.mod 2> /dev/null | wc -l)"
+if [ $MainModulesCount = 0 ]; then
+    einfo "No MainModules found on connected devices"
+elif [ $MainModulesCount = 1 ]; then
+    einfo "Loading MainModule from connected device"
+    MainModuleLoaded="$MainModules"
+    load_module "$MainModules"
+elif [ $MainModulesCount > 1 ]; then
     echo
-elif [ $MainModulesCount = 1 ]; 
-	then
-# start single-module section
-        echo
-	einfo "One MainModule found: $MainModules"
-	echo
-	mount_mini_modules
-	mount_options
-	load_module "$MainModules"
-
-# start multiple-module section
-elif [ $MainModulesCount -gt 1 ]; then
-	echo
-	einfo "More than one MainModule found"
-	einfo "List of modules:"
-	einfo "${WHITE} $MainModules${NORMAL}" 
-	echo
-	PS3='Please enter the desired MainModule: '
-	
-	select MainMod in $MainModules
-	do
-	echo
-	load_module "$MainMod"
-	break
-	done
-else
-	eerror "Error reading CDROM?"
+    einfo "More than one MainModule found on devices"
+    einfo "List of modules:"
+    einfo "${WHITE} $UsbMainModules ${NORMAL}" 
+    echo
+    PS3='Please enter the desired MainModule: '
+	    
+    select MainMod in $MainModules
+    do
+    echo
+    einfo "Loading $MainMod"
+    echo
+    MainModuleLoaded="$MainMod"
+    load_module "$MainMod"
+    break
+    done
 fi
 
+einfo "No MainModules found"
+einfo "Continuing with MorphixBase..."
+echo 
+einfo "This is a thinned-down distribution based on Debian GNU/Linux"
+einfo " Check to see if your MainModule is on the liveCD in /media/cdrom/mainmod"
+echo
+

Modified: trunk/scripts-base/usr/sbin/rebuildfstab-morphix
===================================================================
--- trunk/scripts-base/usr/sbin/rebuildfstab-morphix	2008-03-27 16:46:19 UTC (rev 2620)
+++ trunk/scripts-base/usr/sbin/rebuildfstab-morphix	2008-03-30 20:09:22 UTC (rev 2621)
@@ -27,10 +27,13 @@
 /dev/fd0 /media/floppy auto user,noauto,exec,umask=000,uid=" + username + " 0 0\n\
 /dev/cdrom /media/cdrom auto user,noauto,exec,ro,uid=" + username + " 0 0\n"
 
+os.system("mkdir -p /media/cdrom")
+os.system("mkdir -p /media/floppy")
+
 def add_to_fstab(fstab, partitions, username):
 
     for p in partitions:
-        system("mkdir -p /media/" + p[2])
+        os.system("mkdir -p /media/" + p[2])
         line = "/dev/" + p[2] + " /media/" + p[2] + " auto defaults,users,uid=" + username + " 0 0\n"
         fstab += line
     return fstab


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace