r2686 - in dists/trunk/live-helper: docs functions helpers

daniel at alioth.debian.org daniel at alioth.debian.org
Sat Aug 4 18:47:14 UTC 2007


Author: daniel
Date: 2007-08-04 18:47:14 +0000 (Sat, 04 Aug 2007)
New Revision: 2686

Modified:
   dists/trunk/live-helper/docs/ChangeLog
   dists/trunk/live-helper/functions/packages.sh
   dists/trunk/live-helper/helpers/lh_losetup
Log:


Modified: dists/trunk/live-helper/docs/ChangeLog
===================================================================
--- dists/trunk/live-helper/docs/ChangeLog	2007-08-04 18:05:51 UTC (rev 2685)
+++ dists/trunk/live-helper/docs/ChangeLog	2007-08-04 18:47:14 UTC (rev 2686)
@@ -16,6 +16,8 @@
 	    system (Closes: #435699).
 	* helpers/lh_config:
 	  - Added argument handling.
+	* helpers/lh_losetup:
+	  - Simplified and corrected to make it actually work.
 	* helpers/make-live:
 	  - Replaced with a dummy: make-live is deprecated now, use lh_config
 	    and lh_build instead.

Modified: dists/trunk/live-helper/functions/packages.sh
===================================================================
--- dists/trunk/live-helper/functions/packages.sh	2007-08-04 18:05:51 UTC (rev 2685)
+++ dists/trunk/live-helper/functions/packages.sh	2007-08-04 18:47:14 UTC (rev 2686)
@@ -16,14 +16,16 @@
 
 	Check_installed "${FILE}" "${PACKAGE}"
 
-	if [ ${INSTALL_STATUS} -eq 1 ]
-	then
-		PACKAGES="${PACKAGES} ${PACKAGE}"
-	elif [ ${INSTALL_STATUS} -eq 2 ]
-	then
-		Echo_error "You need to install ${PACKAGE} on your host system."
-		exit 1
-	fi
+	case "${INSTALL_STATUS}" in
+		1)
+			PACKAGES="${PACKAGES} ${PACKAGE}"
+			;;
+
+		2)
+			Echo_error "You need to install ${PACKAGE} on your host system."
+			exit 1
+			;;
+	esac
 }
 
 Install_package ()

Modified: dists/trunk/live-helper/helpers/lh_losetup
===================================================================
--- dists/trunk/live-helper/helpers/lh_losetup	2007-08-04 18:05:51 UTC (rev 2685)
+++ dists/trunk/live-helper/helpers/lh_losetup	2007-08-04 18:47:14 UTC (rev 2686)
@@ -20,7 +20,7 @@
 # Setting static variables
 DESCRIPTION="wrapper around losetup"
 HELP=""
-USAGE="${PROGRAM} <device> <file> <partition>"
+USAGE="${PROGRAM} DEVICE FILE [PARTITION]"
 
 Arguments "${@}"
 
@@ -32,30 +32,26 @@
 Read_conffile config/source
 Set_defaults
 
-if [ -z "${1}" ]
-then
-	DEVICE="`${LH_ROOT_COMMAND} ${LH_LOSETUP} -f`"
-else
-	DEVICE="${1}"
-fi
-
+DEVICE="${1}"
 FILE="${2}"
-PARTITION="${3}"
+PARTITION="${3:=1}"
 
 ${LH_ROOT_COMMAND} ${LH_LOSETUP} "${DEVICE}" "${FILE}"
 FDISK_OUT="`fdisk -l -u ${DEVICE} 2>&1`"
 ${LH_ROOT_COMMAND} ${LH_LOSETUP} -d "${DEVICE}"
 
-LOOPDEVICE="`echo ${DEVICE}p${PARTITION:=1}`"
-CYL=`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"`
-#OFFSET="`expr ${CYL} * 512`"
-OFFSET="$((${CYL}*512))"
+LOOPDEVICE="`echo ${DEVICE}p${PARTITION}`"
 
-echo loop $DEVICE at offset $OFFSET
-
 if [ "${PARTITION}" = "0" ]
 then
+	Echo_message "Mounting ${DEVICE} with offset 0"
+
 	${LH_ROOT_COMMAND} ${LH_LOSETUP} "${DEVICE}" "${FILE}"
 else
+	CYLINDERS="`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"`"
+	OFFSET="`expr ${CYLINDERS} * 512`"
+
+	Echo_message "Mounting ${DEVICE} with offset ${OFFSET}"
+
 	${LH_ROOT_COMMAND} ${LH_LOSETUP} -o "${OFFSET}" "${DEVICE}" "${FILE}"
 fi




More information about the debian-live-changes mailing list