livecd: functions-live - load_profile - cosmetics

havner havner at pld-linux.org
Mon Jul 10 16:03:37 CEST 2006


Author: havner                       Date: Mon Jul 10 14:03:37 2006 GMT
Module: livecd                        Tag: HEAD
---- Log message:
- load_profile
- cosmetics

---- Files affected:
livecd:
   functions-live (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: livecd/functions-live
diff -u livecd/functions-live:1.15 livecd/functions-live:1.16
--- livecd/functions-live:1.15	Tue Jul  4 15:51:57 2006
+++ livecd/functions-live	Mon Jul 10 16:03:32 2006
@@ -143,7 +143,7 @@
 elif [ -f ~/.livecd_remaster ]; then
 	. ~/.livecd_remaster
 elif [ "$1" = "create" ]; then
-	echo "There is no config file in your home dir."
+	echo "There is no config file in your home or \$HOME_ETC dir, creating."
 	if [ -d "$HOME_ETC" ]; then
 		P=$HOME_ETC/.livecd_remaster
 	else
@@ -169,7 +169,7 @@
 	echo "and read README before using this script."
 	exit 1
 else
-	echo "There is no config file in your home or \$HOME_ETC dir"
+	echo "There is no config file in your home or \$HOME_ETC dir."
 	exit 1
 fi
 
@@ -196,6 +196,66 @@
 	shift
 [ "$FAIL" = "true" ] && exit 1
 done
+}
+
+# load_profile device name1 name2 name3...
+# if device=cd load from LiveCD/profiles/
+# it assumes that all modules/devices/mountpoints are ok
+load_profiles() {
+if [ "$#" -lt "2" ]; then
+	echo "${LREDB}Not enough parameters for load_profile()${LNORMAL}"
+	return
+fi
+
+DEV=$1
+shift
+
+if [ "$DEV" = "cd" ]; then
+	DIR=/media/LiveCD/profiles
+else
+	DIR=/media/floppy
+	if ! mount -n -o ro -t auto "$DEV" /media/floppy; then
+		echo "${LREDB}Cannot mount ${DEV}${LNORMAL}"
+		return
+	fi
+fi
+
+while [ ! "$#" = "0" ]; do
+	if [ -f ${DIR}/$1.tar.gz ]; then
+		echo "${LBLUEB}Copying packed profile files ($1)${LNORMAL}"
+		cd /
+		tar xzpf ${DIR}/$1.tar.gz
+	elif [ -f ${DIR}/$1.tgz ]; then
+		echo "${LBLUEB}Copying packed profile files ($1)${LNORMAL}"
+		cd /
+		tar xzpf ${DIR}/$1.tgz
+	elif [ -f ${DIR}/$1.tar.bz2 ]; then
+		echo "${LBLUEB}Copying packed profile files ($1)${LNORMAL}"
+		cd /
+		tar xjpf ${DIR}/$1.tar.bz2
+	elif [ -f ${DIR}/$1.tbz ]; then
+		echo "${LBLUEB}Copying packed profile files ($1)${LNORMAL}"
+		cd /
+		tar xjpf ${DIR}/$1.tbz
+	fi
+	if [ -d ${DIR}/$1 ]; then
+		echo "${LBLUEB}Copying profile files ($1)${LNORMAL}"
+		cp -Rpdf ${DIR}/$1/* /
+	fi
+	if [ -x ${DIR}/$1.exec ]; then
+		echo "${LBLUEB}Executing profile file ($1)${LNORMAL}"
+		cp ${DIR}/$1.exec /tmp
+		chmod 755 /tmp/$1.exec
+		/tmp/$1.exec
+		rm -f /tmp/$1.exec
+	fi
+	shift
+done
+
+if [ ! "$DEV" = "cd" ]; then
+	umount -n "$DEV" > /dev/null 2>&1
+fi
+	
 }
 
 # vi: syntax=sh:shiftwidth=8:
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/livecd/functions-live?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list