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
+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.
.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
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=*)
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}
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
umount $mountpoint
fi
fi
+
+ if [ -n "${LIVEMEDIA_OFFSET}" ]; then
+ losetup -d "${loopdevname}"
+ fi
return 1
}
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
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 ',')"
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
local fspath=$1
local module=$2
local pattern=$3
+ local offset=$4
modprobe "${MP_QUIET}" -b "$module"
udevsettle
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