# Installing executables
mkdir -p $(DESTDIR)/sbin
- cp bin/live-getty bin/live-login bin/live-new-uuid bin/live-snapshot $(DESTDIR)/sbin
+ cp bin/live-getty bin/live-login bin/live-new-uuid bin/live-snapshot bin/live-swapfile $(DESTDIR)/sbin
mkdir -p $(DESTDIR)/usr/share/live-initramfs
cp bin/live-preseed bin/live-reconfigure contrib/languagelist $(DESTDIR)/usr/share/live-initramfs
rm -f $(DESTDIR)/etc/live.conf
# Uninstalling executables
- rm -f $(DESTDIR)/sbin/live-getty $(DESTDIR)/sbin/live-login $(DESTDIR)/sbin/live-snapshot
+ rm -f $(DESTDIR)/sbin/live-getty $(DESTDIR)/sbin/live-login $(DESTDIR)/sbin/live-snapshot $(DESTDIR)/sbin/live-swapfile
rm -rf $(DESTDIR)/usr/share/live-initramfs
rm -f $(DESTDIR)/usr/share/initramfs-tools/hooks/live
rm -rf $(DESTDIR)/usr/share/initramfs-tools/scripts/live*
# Command line defaults and declarations
SNAP_COW="${DEF_SNAP_COW}"
SNAP_DEV=""
+SNAP_MNT=""
SNAP_OUTPUT=""
SNAP_RESYNC_STRING=""
SNAP_TYPE="cpio"
# 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"
;;
SNAP_TYPE="jffs2"
;;
- ""|*.ext2|*.ext3)
+ *.ext2|*.ext3)
SNAP_TYPE="ext2"
;;
+ "")
+ SNAP_TYPE="whole_partition"
+ ;;
+
*.ext4)
SNAP_TYPE="ext4"
;;
Validate_input ()
{
case "${SNAP_TYPE}" in
- cpio|squashfs|jffs2|ext2|ext3|ext4)
+ cpio|squashfs|jffs2|ext2|ext3|ext4|whole_partition)
;;
*)
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
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}"
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
}
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}" ]
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}"
;;
--- /dev/null
+#!/bin/sh
+
+# File: live-swapfile - create and use a swap file
+# Copyright: (C) 2009 Daniel Baumann <daniel@debian.org>
+# License: GPL-3+
+
+set -e
+
+# Options
+_SWAP_DIRECTORY="${_SWAP_DIRECTORY:-/live/swap}"
+_SWAP_FILE="${_SWAP_FILE:-swapfile.img}"
+
+_SWAP_SIZE="${_SWAP_SIZE:-auto}"
+_SWAP_FACTOR="${_SWAP_FACTOR:-2}"
+
+_SWAP_PURGE="${_SWAP_PURGE:-true}"
+_FORCE="${_FORCE:-true}"
+
+case "${1}" in
+ add)
+ # Reading size of physical memory
+ _MEM_TOTAL_KB="$(awk '/^MemTotal: / { print $2 }' /proc/meminfo)"
+ _MEM_TOTAL_MB="$(expr ${_MEM_TOTAL_KB} / 1024)"
+
+ echo "Found ${_MEM_TOTAL_MB} MB physical memory."
+
+ # Setting size of new swapfile
+ if [ -z "${_SWAP_SIZE}" ] || [ "${_SWAP_SIZE}" = "auto" ]
+ then
+ _SWAP_SIZE_KB="$(expr ${_MEM_TOTAL_KB} '*' ${_SWAP_FACTOR})"
+ _SWAP_SIZE_MB="$(expr ${_SWAP_SIZE_KB} / 1024)"
+ else
+ _SWAP_SIZE_MB="${_SWAP_SIZE}"
+ fi
+
+ echo "Requesting ${_SWAP_SIZE_MB} MB swapfile."
+
+ # Reading size of old swapfile
+ if [ -e "${_SWAP_DIRECTORY}/${_SWAP_FILE}" ]
+ then
+ _SWAP_FILESIZE="$(ls -hl ${_SWAP_DIRECTORY}/${_SWAP_FILE} | awk '{ print $5 }')"
+
+ echo "Found ${_SWAP_FILESIZE} MB swapfile."
+ fi
+
+ # Creating new swap file
+ if [ "${_SWAP_FILESIZE}" != "${_SWAP_SIZE_MB}M" ]
+ then
+ if [ "${_FORCE}" = "true" ]
+ then
+ # Removing old swapfile
+ rm -f "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+
+ echo "Creating ${_SWAP_SIZE_MB} MB swapfile."
+
+ mkdir -p "${_SWAP_DIRECTORY}"
+
+ # Unfortunately, swapon does not support files
+ # with holes, therefore we cannot preallocate.
+ dd if=/dev/zero of="${_SWAP_DIRECTORY}/${_SWAP_FILE}" bs=1024k count="${_SWAP_SIZE_MB}"
+ else
+ echo "Exit."
+ return 1
+ fi
+ fi
+
+ echo "Enabling ${_SWAP_DIRECTORY}/${_SWAP_FILE}."
+
+ mkswap "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+ swapon "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+ ;;
+
+ rm|remove)
+ if grep -qs "${_SWAP_DIRECTORY}/${_SWAP_FILE}" /proc/swaps
+ then
+ echo "Disabling ${_SWAP_DIRECTORY}/${_SWAP_FILE}."
+
+ swapoff "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+ fi
+
+ if [ "${_SWAP_PURGE}" = "true" ]
+ then
+ echo "Removing ${_SWAP_DIRECTORY}/${_SWAP_FILE}."
+
+ rm -f "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+
+ __DIRECTORY="${_SWAP_DIRECTORY}"
+ while [ "${__DIRECTORY}" != "/" ]
+ do
+ rmdir --ignore-fail-on-non-empty "${__DIRECTORY}"
+ __DIRECTORY="$(dirname ${__DIRECTORY})"
+ done
+ fi
+ ;;
+
+ *)
+ echo "Usage: ${0} {add|remove}"
+ exit 1
+ ;;
+esac
#
# 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
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
/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
/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
--------
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
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
;;
*)
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}" ]
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 ' ')"
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?
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
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%:}
${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"
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
log_end_msg
fi
- if [ -n "${MODULETORAMFILE}" ]
+ if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
then
setup_unionfs "${livefs_root}" "${rootmnt}"
else
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
# 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
# live-initramfs header
-if [ -n "${NOGNOMEPANEL}" ]
+if [ ! -e /root/var/lib/dpkg/info/gnome-panel-data.list ] || [ -n "${NOGNOMEPANEL}" ]
then
exit 0
fi
# 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
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
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
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
}
break
fi
+ # Checking for a luks device
+ if [ "${PERSISTENT}" = "cryptsetup" ] && [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
+ then
+ while true
+ do
+ load_keymap
+
+ /lib/cryptsetup/askpass "Enter passphrase for ${pers_label} on ${devname}: " | /sbin/cryptsetup -T 1 luksOpen ${devname} $(basename ${devname}) --key-file=-
+ error=${?}
+
+ devname="/dev/mapper/$(basename ${devname})"
+
+ if [ 0 -eq ${error} ]
+ then
+ unset error
+ break
+ fi
+
+ echo
+ echo -n "There was an error decrypting ${devname} ... Retry? [Y/n] " >&6
+ read answer
+
+ if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
+ then
+ unset answer
+ break
+ fi
+ done
+ fi
+
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
esac
done
done
+ return 1
}
find_files ()