Adding casper 1.77+debian-6. debian/1.77+debian-6
authorDaniel Baumann <daniel@debian.org>
Sun, 23 Sep 2007 12:46:28 +0000 (14:46 +0200)
committerDaniel Baumann <daniel@debian.org>
Sun, 23 Sep 2007 12:46:28 +0000 (14:46 +0200)
bin/casper-snapshot
debian/changelog
debian/manpage/casper.7
scripts/casper
scripts/casper-bottom/23networking
scripts/casper-helpers

index 33dede4..c0c8662 100644 (file)
@@ -208,7 +208,7 @@ Mount_device ()
                mkdir -p "${MOUNTP}"
        fi
 
-       if [ -n "${dev}" ]; then
+       if [ -z "${dev}" ]; then
                # create a temp
                mount -t tmpfs -o rw tmpfs "${MOUNTP}"
                if [ ! -L /home/$USERNAME/Desktop/casper-snapshot ]; then
index 4b85a68..83768c2 100644 (file)
@@ -1,3 +1,12 @@
+casper (1.77+debian-6) unstable; urgency=medium
+
+  * Improved snapshots features (even still experimental).
+  * Added "live-media-offset=BYTES" boot param, to enable "hiding"
+    feature, thanks to Sebastien Raveau <sebastien.raveau@epita.fr>.
+  * Now it creates /etc/resolv.conf if netbooted.
+
+ -- Marco Amadori <marco.amadori@gmail.com>  Fri,  1 Dec 2006 17:43:30 +0100
+
 casper (1.77+debian-5) unstable; urgency=low
 
   * Fixed preseeding locale and keyboard's variant and options.
index aac3eca..c195d9f 100644 (file)
@@ -30,12 +30,15 @@ Let you specify the name(s) and the options of the interface(s) that should be c
 .BR ip[= frommedia ]
 If this variable is set, dhcp and static configuration are just skipped and the system will use the (must be) media-preconfigured /etc/network/interfaces instead.
 .TP
-.BI "locale=" LOCALE " | debian-installer/locale=" LOCALE
-Configure the running locale as specified, if not present the live-media rootfs configured locale will be used and if also this one misses casper behave as "locale=en_US.UTF-8" was specified. If only 2 lowercase letter are specified (like "it"), the "maybe wanted" locale is generated (like it:IT.UTF-8), in this case if also "keyb=" is unspecified is set with those 2 lowercase letters (keyb=it).
-.TP
 .BI "{live-media|bootfrom}=" DEVICE
 If you specify one of this two equivalent forms, casper will first try to find this device for the "/casper" directory where the read-only root filesystem should reside. If it did not find something usable, the normal scan for block devices is performed.
 .TP
+.BI "live-media-offset=" BYTES
+This way you could tell casper that your image starts at offset BYTES in the above specified or autodiscovered device, this could be useful to hide the debian-live iso or image inside another iso or image, to create "clean" images.
+.TP
+.BI "locale=" LOCALE " | debian-installer/locale=" LOCALE
+Configure the running locale as specified, if not present the live-media rootfs configured locale will be used and if also this one misses casper behave as "locale=en_US.UTF-8" was specified. If only 2 lowercase letter are specified (like "it"), the "maybe wanted" locale is generated (like it:IT.UTF-8), in this case if also "keyb=" is unspecified is set with those 2 lowercase letters (keyb=it).
+.TP
 .BR "netboot[=" nfs "|" cifs ]
 This tells casper to perform a network mount. The parameter "nfsroot=" (with optional "nfsopts="), should specify where is the location of the root filesystem.  With no args, will try cifs first, and if it fails nfs.
 .TP
index 8cfc0df..7358f85 100644 (file)
@@ -73,6 +73,8 @@ parse_cmdline ()
                 export LIVEMEDIA=${x#*=} ;;
             live-media-timeout=*)
                 export LIVEMEDIA_TIMEOUT=${x#live-media-timeout=} ;;
+            live-media-offset=*)
+                export LIVEMEDIA_OFFSET=${x#live-media-offset=} ;;
             locale=*|debian-installer/locale=*)
                 export LOCALE=${x#*=} ;;
             keyb=*|kbd-chooser/method=*)
@@ -224,7 +226,7 @@ do_netmount() {
 
     modprobe "${MP_QUIET}" af_packet # For DHCP
 
-    ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf
+    ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
 
     if [ "${NFSROOT}" = "auto" ]; then
         NFSROOT=${ROOTSERVER}:${ROOTPATH}
@@ -482,6 +484,12 @@ check_dev ()
     if [ -z "${devname}" ]; then
         devname=$(sys2dev "${sysdev}")
     fi
+
+    if [ -n "${LIVEMEDIA_OFFSET}" ]; then
+        loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVEMEDIA_OFFSET}")
+        devname="${loopdevname}" 
+    fi
+
     fstype=$(get_fstype "${devname}")
     if is_supported_fs ${fstype}; then
         mount -t ${fstype} -o ro "${devname}" $mountpoint || continue
@@ -492,6 +500,10 @@ check_dev ()
             umount $mountpoint
         fi
     fi
+
+    if [ -n "${LIVEMEDIA_OFFSET}" ]; then
+        losetup -d "${loopdevname}"
+    fi
     return 1
 }
 
index 2bdf9b0..129ca35 100755 (executable)
@@ -21,7 +21,7 @@ esac
 
 log_begin_msg "$DESCRIPTION"
 
-if [ "${STATICIP}" == "frommedia" ] && [ -e  "$IFFILE" ] ; then
+if [ "${STATICIP}" == "frommedia" -a -e  "$IFFILE" ] ; then
     # will use existent /etc/network/interfaces
     log_end_msg
     exit 0
@@ -35,7 +35,7 @@ EOF
 
 udevtrigger
 
-if [ -z "${NETBOOT}" -a -n "${STATICIP}" ] && [ "${STATICIP}" != "frommedia" ]; then
+if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then
     parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
     for ifline in ${parsed}; do
         ifname="$(echo ${ifline} | cut -f1 -d ',')"
@@ -71,6 +71,28 @@ iface ${i} inet ${method}
 
 EOF
     done
+    if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ] ; then
+        # create a resolv.conf if it is not present
+        cp /netboot.config /root/var/log/netboot.config
+        rc_search=$(cat netboot.config | awk '/domain/{print $3}')
+        rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
+        rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
+        rc_server0="nameserver ${rc_server0}"
+        if [ "${rc_server1}" = "0.0.0.0" ]; then
+            rc_server1=""
+        else
+            rc_server1="nameserver ${rc_server1}"
+        fi
+        cat > /root/etc/resolv.conf <<EOF
+# /etc/resolv.conf
+# Autogenerated by casper
+search ${rc_search}
+domain ${rc_search}
+${rc_server0}
+${rc_server1}
+EOF
+        cat /root/etc/resolv.conf >> /root/var/log/netboot.config
+    fi
 fi
 
 log_end_msg
index cfbc3c6..f8bd206 100644 (file)
@@ -110,6 +110,7 @@ setup_loop() {
     local fspath=$1
     local module=$2
     local pattern=$3
+    local offset=$4
 
     modprobe "${MP_QUIET}" -b "$module"
     udevsettle
@@ -117,7 +118,11 @@ setup_loop() {
     for loopdev in $pattern; do
         if [ "$(cat $loopdev/size)" -eq 0 ]; then
             dev=$(sys2dev "${loopdev}")
-            losetup "$dev" "$fspath"
+            if [ -n "$offset" ]; then
+                losetup -o "$offset" "$dev" "$fspath"
+            else
+                losetup "$dev" "$fspath"
+            fi
             echo "$dev"
             return 0
         fi