Synchronise with Debian's version 1.157.3-1
authorMichael Prokop <mika@grml.org>
Fri, 4 Sep 2009 22:26:15 +0000 (00:26 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 4 Sep 2009 22:26:15 +0000 (00:26 +0200)
12 files changed:
bin/live-snapshot
conf/live-snapshot.list
debian/changelog
manpages/live-initramfs.en.7.txt
manpages/live-snapshot.en.1.txt
manpages/live-snapshot.it.1.txt
scripts/live
scripts/live-bottom/10adduser
scripts/live-bottom/21xdriver
scripts/live-bottom/22gnome_panel_data
scripts/live-bottom/25configure_init
scripts/live-helpers

index d942c90..18b067b 100755 (executable)
@@ -59,6 +59,7 @@ TMP_FILELIST="${PROGRAM}.list"
 # Command line defaults and declarations
 SNAP_COW="${DEF_SNAP_COW}"
 SNAP_DEV=""
+SNAP_MNT=""
 SNAP_OUTPUT=""
 SNAP_RESYNC_STRING=""
 SNAP_TYPE="cpio"
@@ -237,11 +238,12 @@ Defaults ()
        # Parse resync string
        if [ -n "${SNAP_RESYNC_STRING}" ]
        then
-               SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | cut -f1 -d ':')
+               SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | sed -e 's|^/root\([^:.]*\).*$|'"${DEF_SNAP_COW}"'\1|')
                SNAP_DEV=$(echo "${SNAP_RESYNC_STRING}" | cut -f2 -d ':')
-               DEST="${MOUNTP}/$(echo ${SNAP_RESYNC_STRING} | cut -f3 -d ':')"
+               SNAP_MNT=$(echo "${SNAP_RESYNC_STRING}" | cut -f3 -d ':')
+               DEST="${MOUNTP}/${SNAP_MNT}"
 
-               case "${DEST}" in
+               case "${SNAP_MNT}" in
                        *.cpio.gz)
                                SNAP_TYPE="cpio"
                                ;;
@@ -254,10 +256,14 @@ Defaults ()
                                SNAP_TYPE="jffs2"
                                ;;
 
-                       ""|*.ext2|*.ext3)
+                       *.ext2|*.ext3)
                                SNAP_TYPE="ext2"
                                ;;
 
+                       "")
+                               SNAP_TYPE="whole_partition"
+                               ;;
+
                        *.ext4)
                                SNAP_TYPE="ext4"
                                ;;
@@ -294,7 +300,7 @@ Defaults ()
 Validate_input ()
 {
        case "${SNAP_TYPE}" in
-               cpio|squashfs|jffs2|ext2|ext3|ext4)
+               cpio|squashfs|jffs2|ext2|ext3|ext4|whole_partition)
                        ;;
 
                *)
@@ -340,7 +346,7 @@ Entry_is_modified ()
 
        if [ -e "${entry}" ] || [ -L "${entry}" ]
        then
-               if [ -e "${DEF_SNAP_COW}/${entry}" ] || [ -L "${DEF_SNAP_COW}/${entry}" ]
+               if [ -e "${SNAP_COW}/${entry}" ] || [ -L "${SNAP_COW}/${entry}" ]
                then
                        return 0
                fi
@@ -350,17 +356,25 @@ Entry_is_modified ()
 
 Do_filelist ()
 {
-       # BUGS: supports only cpio.gz types, and does not handle deleted files yet
-
+       # BUGS: does not handle deleted files yet
        TMP_FILELIST=$1
+
        if [ -f "${SNAP_LIST}" ]
        then
+               # if SNAP_COW == /live/cow/home, SNAP_RW = /home
+               SNAP_RW=$(echo "${SNAP_COW}" | sed -e "s|${DEF_SNAP_COW}||g")
+               if [ -z "${SNAP_RW}" ]
+               then
+                       SNAP_RW="/"
+               fi
+
+               cd "${SNAP_RW}"
                # Generate include list removing empty and commented lines
-               for entry in $(sed -e '/^ *$/d' -e '/^#.*$/d' "${SNAP_LIST}")
+               # and transforming paths to relatives
+               for entry in $(sed -e '/^ *$/d' -e '/^#.*$/d' -e 's#^.*$#./&#' -e 's#/\+#/#g' "${SNAP_LIST}")
                do
                        if [ -d "${entry}" ]
                        then
-                               cd /
                                find "${entry}" | while read line
                                do
                                        if Entry_is_modified "${line}"
@@ -368,26 +382,22 @@ Do_filelist ()
                                                printf "%s\000" "${line}" >> "${TMP_FILELIST}"
                                        fi
                                done
-                               cd "${OLDPWD}"
                        elif Entry_is_modified "${entry}"
                        then
                                # if file exists and it is modified
                                printf "%s\000" "${entry}" >> "${TMP_FILELIST}"
                        fi
                done
+               cd "${OLDPWD}"
 
-               if [ "${SNAP_COW}" = "${DEF_SNAP_COW}" ]
-               then
-                       # Relative to rootfs
-                       echo "/"
-               else
-                       # Mostly "/home"
-                       echo "${SNAP_COW}"
-               fi
+               # echo Working dir
+               echo "${SNAP_RW}"
        else
                cd "${SNAP_COW}"
+               # removing whiteouts from list
                find . -path '*.wh.*' -prune -o -print0 >> "${TMP_FILELIST}"
                cd "${OLDPWD}"
+               # echo Working dir
                echo "${SNAP_COW}"
        fi
 }
@@ -413,7 +423,14 @@ Do_snapshot ()
                        mksquashfs "${SNAP_COW}" "${DEST}" -ef "${TMP_FILELIST}"
                        ;;
 
-               cpio)
+               cpio|whole_partition)
+                       if [ "${SNAP_TYPE}" = "cpio" ]
+                       then
+                               COPY_CMD="cpio --quiet -o0 -H newc | gzip -9c > ${DEST}"
+                       else
+                               COPY_CMD="cpio --quiet -pumd0 ${DEST}/"
+                       fi
+
                        WORKING_DIR=$(Do_filelist "${TMP_FILELIST}")
                        cd "${WORKING_DIR}"
                        if [ -e "${EXCLUDE_LIST}" ]
@@ -426,12 +443,10 @@ Do_snapshot ()
                                        grep -F -v -f "${EXCLUDE_LIST}" | \
                                        tr '\n' '\0' | \
                                        tr '\1' '\n' | \
-                                       cpio --quiet -o0 -H newc | \
-                                       gzip -9c > "${DEST}" || exit 1
+                                       $COPY_CMD || exit 1
                        else
                                cat "${TMP_FILELIST}" | \
-                                       cpio --quiet -o0 -H newc | \
-                                       gzip -9c > "${DEST}" || exit 1
+                                       $COPY_CMD || exit 1
                        fi
                        cd "${OLDPWD}"
                        ;;
index 30fe29d..db05733 100644 (file)
@@ -5,6 +5,8 @@
 #
 # The syntax for the line is just a full file or directory pathname.
 # Those files and directories, and only those will be included on automatic persistence handling.
+#
+# Note that in home-sn snapshot all those paths are treated as relative to /home
 
 # Include itself for reuse
 /etc/live-snapshot.list
index d8667bc..4bddf07 100644 (file)
@@ -1,5 +1,6 @@
-live-initramfs (1.157.1-1grml.08) UNRELEASED; urgency=low
+live-initramfs (1.157.3-1grml.00) UNRELEASED; urgency=low
 
+  * Synchronise with Debian's version 1.157.3-1.
   * debian/patches/07_support_findiso.dpatch: insert a leading "/"
     in front of the FINDISO argument so it doesn't hit persons
     who forget a slash in the bootoption. Suggested by
@@ -7,7 +8,7 @@ live-initramfs (1.157.1-1grml.08) UNRELEASED; urgency=low
   * grml/23networking: add support for bootoption noudev so the
     udev part in initramfs is skipped as well.
 
- -- Michael Prokop <mika@grml.org>  Sat, 05 Sep 2009 00:23:00 +0200
+ -- Michael Prokop <mika@grml.org>  Sat, 05 Sep 2009 00:25:44 +0200
 
 live-initramfs (1.157.1-1grml.07) unstable; urgency=low
 
index c43fa5e..b7ffa11 100644 (file)
@@ -87,7 +87,7 @@ configured at boot time. Do not specify this if you want to use dhcp (default).
 It will be changed in a future release to mimick official kernel boot param
 specification (e.g. ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp).
 
-  ip[=**frommedia**]::
+  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
index 4ead532..4f53e7e 100644 (file)
@@ -82,12 +82,12 @@ Files
 
   /etc/live-snapshot.list
 
-This optional file, if present changes the behaviour of live-snapshot, only files and directories listed there are included (integrally) in the snapshot. It works only for cpio targets.
+This optional file, if present changes the behaviour of live-snapshot, only files and directories listed there are included (integrally) in the snapshot. It works only for cpio and whole partition targets.
 
   /etc/live-snapshot.exclude_list
 
 This optional file, if present will filter the files that will be saved by live-snapshot removing (as in "grep -F -v") all filenames that will be matched by strings listed in it.
-It works for cpio and squashfs snapshot types only; it is pretty useful for filtering temporary files and disk caches.
+It works for cpio, whole partition and squashfs snapshot types only; it is pretty useful for filtering temporary files and disk caches.
 
 
 See also
index dc8a992..1beb791 100644 (file)
@@ -89,12 +89,12 @@ Files
   /etc/live-snapshot.list
 
 Facoltativo, se presente cambia completamente il funzionamento di live-snapshot; solo i files e le directory elencate verranno effettivamente inclusi nello snapshot.
-Funziona attualmente solo con gli snapshot di tipo "cpio".
+Funziona attualmente solo con gli snapshot di tipo "cpio" e "partizione intera".
 
   /etc/live-snapshot.exclude_list
 
 Facoltativo, se presente verrà utilizzato per filtrare i file da includere negli snapshot. Tutte i file che conterranno le stringhe elecate (come "grep -F -v") non verranno salvati da live-snapshot.
-Funziona attualmente solo con gli snapshot di tipo "cpio" e "squashfs"; è utile per filtrare contenuti poco significativi come i file temporanei e la cache.
+Funziona attualmente solo con gli snapshot di tipo "cpio", "partizione intera" e "squashfs"; è utile per filtrare contenuti poco significativi come i file temporanei e la cache.
 
 See also
 --------
index ef7f64d..db1d355 100755 (executable)
@@ -345,6 +345,13 @@ Arguments ()
                                export PERSISTENT_PATH
                                ;;
 
+                       persistent-subtext=*)
+                               root_persistence="${root_persistence}-${ARGUMENT#persistent-subtext=}"
+                               home_persistence="${home_persistence}-${ARGUMENT#persistent-subtext=}"
+                               root_snapshot_label="${root_snapshot_label}-${ARGUMENT#persistent-subtext=}"
+                               home_snapshot_label="${home_snapshot_label}-${ARGUMENT#persistent-subtext=}"
+                               ;;
+
                        nopersistent)
                                NOPERSISTENT="Yes"
                                export NOPERSISTENT
@@ -773,9 +780,11 @@ do_httpmount ()
                                        then
                                                case "$url" in
                                                        tftp*)
-                                                               ip="$(dirname $url | sed -e 's|tftp://||g')"
-                                                               log_begin_msg "Trying tftp -g -b 10240 -r $(basename ${url})  -l ${dest}/$(basename ${url}) $ip"
-                                                               tftp -g -b 10240 -r $(basename ${url})  -l ${dest}/$(basename ${url}) $ip
+                                                               ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
+                                                               rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
+                                                               lfile="$(basename $url)"
+                                                               log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
+                                                               tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
                                                        ;;
 
                                                        *)
@@ -925,7 +934,7 @@ find_snap ()
        if [ "${PERSISTENT}" != "nofiles" ]
        then
                # search for image files
-               snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snal_label}.ext4 ${snap_label}.jffs2")
+               snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.ext4 ${snap_label}.jffs2")
        fi
 
        if [ -z "${snapdata}" ]
@@ -944,7 +953,7 @@ try_snap ()
        snap_mount="${2}"
        snap_type="${3}"
 
-       if [ ! -z "${snapdata}" ]
+       if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
        then
                log_success_msg "found snapshot: ${snapdata}"
                snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
@@ -983,12 +992,11 @@ try_snap ()
                        log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
                fi
 
-
        elif [ -b "${snapdata}" ]
        then
                # Try to find if it could be a snapshot partition
                dev="${snapdata}"
-               log_success_msg "found snapshot device on ${dev}"
+               log_success_msg "found snapshot ${snap_type} device on ${dev}"
                if echo "${dev}" | grep -qs loop
                then
                        # strange things happens, user confused?
@@ -1049,37 +1057,26 @@ setup_unionfs ()
                roopt="ro"
        fi
 
-       # Read image names from ${MODULE}.module if it exists
-       if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
-       then
-               for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
-               do
-                       image_string="${image_string} ${image_directory}/${IMAGE}"
-               done
-       elif [ -e "${image_directory}/${MODULE}.module" ]
+       if [ -z "${PLAIN_ROOT}" ]
        then
-               for IMAGE in $(cat ${image_directory}/${MODULE}.module)
-               do
-                       image_string="${image_string} ${image_directory}/${IMAGE}"
-               done
-       else
-               # ${MODULE}.module does not exist, create a list of images
-               for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
-               do
-                       for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
+               # Read image names from ${MODULE}.module if it exists
+               if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
+               then
+                       for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
                        do
-                               if [ -e "${IMAGE}" ]
-                               then
-                                       image_string="${image_string} ${IMAGE}"
-                               fi
+                               image_string="${image_string} ${image_directory}/${IMAGE}"
                        done
-               done
-
-               if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
+               elif [ -e "${image_directory}/${MODULE}.module" ]
                then
+                       for IMAGE in $(cat ${image_directory}/${MODULE}.module)
+                       do
+                               image_string="${image_string} ${image_directory}/${IMAGE}"
+                       done
+               else
+                       # ${MODULE}.module does not exist, create a list of images
                        for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
                        do
-                               for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
+                               for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
                                do
                                        if [ -e "${IMAGE}" ]
                                        then
@@ -1087,58 +1084,80 @@ setup_unionfs ()
                                        fi
                                done
                        done
-               fi
 
-               # Now sort the list
-               image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
-       fi
+                       if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
+                       then
+                               for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
+                               do
+                                       for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
+                                       do
+                                               if [ -e "${IMAGE}" ]
+                                               then
+                                                       image_string="${image_string} ${IMAGE}"
+                                               fi
+                                       done
+                               done
+                       fi
+
+                       # Now sort the list
+                       image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
+               fi
 
        [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
 
-       mkdir -p "${croot}"
+               mkdir -p "${croot}"
 
-       for image in ${image_string}
-       do
-               imagename=$(basename "${image}")
+               for image in ${image_string}
+               do
+                       imagename=$(basename "${image}")
 
-               export image devname
-               maybe_break live-realpremount
-               log_begin_msg "Running /scripts/live-realpremount"
-               run_scripts /scripts/live-realpremount
-               log_end_msg
+                       export image devname
+                       maybe_break live-realpremount
+                       log_begin_msg "Running /scripts/live-realpremount"
+                       run_scripts /scripts/live-realpremount
+                       log_end_msg
 
-               if [ -d "${image}" ]
-               then
-                       # it is a plain directory: do nothing
-                       rofsstring="${image}=${roopt}:${rofsstring}"
-                       rofslist="${image} ${rofslist}"
-               elif [ -f "${image}" ]
-               then
-                       if losetup --help 2>&1 | grep -q -- "-r\b"
+                       if [ -d "${image}" ]
                        then
-                               backdev=$(get_backing_device "${image}" "-r")
-                       else
-                               backdev=$(get_backing_device "${image}")
-                       fi
-                       fstype=$(get_fstype "${backdev}")
-
-                       if [ "${fstype}" = "unknown" ]
+                               # it is a plain directory: do nothing
+                               rofsstring="${image}=${roopt}:${rofsstring}"
+                               rofslist="${image} ${rofslist}"
+                       elif [ -f "${image}" ]
                        then
-                               panic "Unknown file system type on ${backdev} (${image})"
-                       fi
+                               if losetup --help 2>&1 | grep -q -- "-r\b"
+                               then
+                                       backdev=$(get_backing_device "${image}" "-r")
+                               else
+                                       backdev=$(get_backing_device "${image}")
+                               fi
+                               fstype=$(get_fstype "${backdev}")
 
-                       if [ -z "${fstype}" ]
-                       then
-                               fstype="${imagename##*.}"
-                               log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
-                       fi
+                               if [ "${fstype}" = "unknown" ]
+                               then
+                                       panic "Unknown file system type on ${backdev} (${image})"
+                               fi
 
-                       mkdir -p "${croot}/${imagename}"
-                       log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
-                       mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
-                       log_end_msg
-               fi
-       done
+                               if [ -z "${fstype}" ]
+                               then
+                                       fstype="${imagename##*.}"
+                                       log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
+                               fi
+
+                               mkdir -p "${croot}/${imagename}"
+                               log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
+                               mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
+                               log_end_msg
+                       fi
+               done
+       else
+               # we have a plain root system
+               mkdir -p "${croot}/filesystem"
+               log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
+               mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || panic "Can not mount ${image_directory} on ${croot}/filesystem" && rofsstring="${croot}/filesystem=${roopt}:${rofsstring}" && rofslist="${croot}/filesystem ${rofslist}"
+               # probably broken:
+               mount -o bind ${croot}/filesystem $mountpoint
+               log_end_msg
+       fi
 
        rofsstring=${rofsstring%:}
 
@@ -1285,6 +1304,9 @@ setup_unionfs ()
                        ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
        fi
 
+       # Correct the permissions of /:
+       chmod 0755 "${rootmnt}"
+
        # tmpfs file systems
        touch /etc/fstab
        mkdir -p "${rootmnt}/live"
@@ -1407,7 +1429,8 @@ find_livefs ()
                        do
                                if [ "$(cat ${sysblock}/removable)" = "1" ]
                                then
-                                       if readlink ${sysblock}/device | grep -q usb
+                                       if readlink ${sysblock} | grep -q usb ||
+                                          readlink ${sysblock}/device | grep -q usb # linux < 2.6.29
                                        then
                                                for dev in $(subdevices "${sysblock}")
                                                do
@@ -1609,7 +1632,7 @@ mountroot ()
                log_end_msg
        fi
 
-       if [ -n "${MODULETORAMFILE}" ]
+       if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
        then
                setup_unionfs "${livefs_root}" "${rootmnt}"
        else
index 9295070..bdb972c 100755 (executable)
@@ -117,4 +117,9 @@ then
        mv /root/home/${USERNAME}/Examples /root/home/${USERNAME}/Desktop/
 fi
 
+if [ -e /root/usr/share/applications/live-installer-launcher.desktop ]
+then
+       chroot /root install -D -o ${USERNAME} -g ${USERNAME} /usr/share/applications/live-installer-launcher.desktop /home/${USERNAME}/Desktop/live-installer-launcher.desktop
+fi
+
 log_end_msg
index ef17bff..105f5b2 100755 (executable)
@@ -20,7 +20,7 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOXAUTOCONFIG}" ] || [ ! -x /root/usr/bin/X ] || [ -n "${XDRIVER}" ]
+if [ -n "${NOXAUTOCONFIG}" ] || [ ! -x /root/usr/bin/X ] || [ -z "${XDRIVER}" ]
 then
        exit 0
 fi
index bd0be26..8f24bf4 100755 (executable)
@@ -20,7 +20,7 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOGNOMEPANEL}" ]
+if [ ! -e /root/var/lib/dpkg/info/gnome-panel-data.list ] || [ -n "${NOGNOMEPANEL}" ]
 then
        exit 0
 fi
@@ -31,17 +31,12 @@ log_begin_msg "Configuring gnome-panel-data"
 
 # live-initramfs script
 
-if [ -x /root/usr/sbin/laptop-detect ]
+if chroot /root laptop-detect > /dev/null 2>&1
 then
-       if chroot /root laptop-detect
-       then
-               live-reconfigure /root gnome-panel-data
-       fi
+       live-reconfigure /root gnome-panel-data
 fi
 
-panel_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-panel-data 2>/dev/null) || panel_version=""
-
-if [ -n "${panel_version}" ] && [ -n "${USERNAME}" ]
+if [ -n "${USERNAME}" ]
 then
        chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true
 fi
index bb06eb5..f55dd0e 100755 (executable)
@@ -77,7 +77,8 @@ then
                then
                        for f in /root/etc/event.d/tty*
                        do
-                               sed -i -e "s|^respawn.*|respawn /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+                               sed -i -e "/^respawn$/!s|^respawn.*|respawn /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+                               sed -i -e "s|^exec.*|exec /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
                        done
                fi
        fi
@@ -87,19 +88,16 @@ then
 fi
 
 # do not try to remove files if using file-rc
-if [ -d /etc/rc0.d ]
+if [ -d /root/etc/rc0.d ]
 then
        # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
        # /etc/crontab remaining disabled, yet also not run by anacron
        if [ -x /root/usr/sbin/anacron ]
        then
                chroot /root dpkg-divert --add --rename --quiet /usr/sbin/anacron
-               ln -s /bin/true /usr/sbin/anacron
+               ln -s /bin/true /root/usr/sbin/anacron
        fi
 
-       # No point, really
-       rm -f /root/etc/rc?.d/[SK]??postfix
-
        # Avoid clobbering the user's clock
        rm -f /root/etc/rc?.d/K??hwclock.sh
 fi
index c4fca95..d5ad29f 100644 (file)
@@ -104,7 +104,7 @@ where_is_mounted ()
        if grep -q "^${device} " /proc/mounts
        then
                # return the first found
-               grep "^${device} " /proc/mounts | cut -f2 -d ' '
+               grep -m1 "^${device} " /proc/mounts | cut -f2 -d ' '
        fi
 }
 
@@ -328,21 +328,14 @@ find_cow_device ()
                        fi
 
                        # Checking for a luks device
-                       if [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
+                       if [ "${PERSISTENT}" = "cryptsetup" ] && [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
                        then
                                while true
                                do
                                        load_keymap
 
-                                       echo -n "Enter passphrase for ${pers_label} on ${devname}: " >&6
-                                       read -s passphrase
-                                       echo "${passphrase}" > /tmp/passphrase
-                                       unset passphrase
-                                       exec 9</tmp/passphrase
-                                       /sbin/cryptsetup luksOpen ${devname} $(basename ${devname})
+                                       /lib/cryptsetup/askpass "Enter passphrase for ${pers_label} on ${devname}: " | /sbin/cryptsetup -T 1 luksOpen ${devname} $(basename ${devname}) --key-file=-
                                        error=${?}
-                                       exec 9<&-
-                                       rm -f /tmp/passphrase
 
                                        devname="/dev/mapper/$(basename ${devname})"
 
@@ -367,14 +360,14 @@ find_cow_device ()
                        if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${pers_label}" ]
                        then
                                echo "${devname}"
-                               return
+                               return 0
                        fi
 
                        if [ "${PERSISTENT}" = "nofiles" ]
                        then
                                # do not mount the device to find for image files
                                # just skip this
-                               break
+                               continue
                        fi
 
                        case "$(get_fstype ${devname})" in
@@ -398,6 +391,7 @@ find_cow_device ()
                        esac
                done
        done
+       return 1
 }
 
 find_files ()