From: Daniel Baumann Date: Sun, 18 Apr 2010 18:41:54 +0000 (+0200) Subject: Adding upstream version 1.136.1. X-Git-Tag: upstream/1.136.1^0 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=b5307f7e721586c8cb062fbb8004a2aec1301a74;p=live-boot-grml.git Adding upstream version 1.136.1. --- diff --git a/Makefile b/Makefile index 30af16d..ed1af45 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ install: test build cp -r COPYING docs/* $(DESTDIR)/usr/share/doc/live-initramfs mkdir -p $(DESTDIR)/usr/share/doc/live-initramfs/examples - cp -r conf/live.conf $(DESTDIR)/usr/share/doc/live-initramfs/examples + cp -r conf/* $(DESTDIR)/usr/share/doc/live-initramfs/examples # Installing manpages set -e; for MANPAGE in manpages/*.en.1; \ diff --git a/bin/live-snapshot b/bin/live-snapshot index dc1fa6d..b81a6af 100755 --- a/bin/live-snapshot +++ b/bin/live-snapshot @@ -3,15 +3,16 @@ # live-snapshot - utility to manage Debian Live systems snapshots # # This program mounts a device (fallback to /tmpfs under $MOUNTP -# and saves the /live/cow (or a different dir) filesystem in it for reuse -# in another live-initramfs session. Look at manpage for more info. +# and saves the /live/cow (or a different directory) filesystem in it +# for reuse in another live-initramfs session. +# Look at the manpage for more informations. # # Copyright (C) 2006-2008 Marco Amadori # Copyright (C) 2008 Chris Lamb # -# This program is free software; you can redistribute it and/or modify +# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -20,32 +21,43 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# along with this program. If not, see . # # On Debian systems, the complete text of the GNU General Public License -# can be found in /usr/share/common-licenses/GPL-2 file. +# can be found in /usr/share/common-licenses/GPL-3 file. + +# declare here two vars from /etc/live.conf because of "set -u" +ROOTSNAP="" +HOMESNAP="" set -eu . /usr/share/initramfs-tools/scripts/live-helpers -. /etc/live.conf + +LIVE_CONF="/etc/live.conf" +. "${LIVE_CONF}" export USERNAME USERFULLNAME HOSTNAME -PROGRAM="$(basename $0)" +EXECUTABLE="${0}" +PROGRAM=$(basename "${EXECUTABLE}") # Needs to be available at run and reboot time SAFE_TMPDIR="/live" # Permits multiple runs MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)" -SNAP_COW="/live/cow" -SNAP_DEV="" DEST="${MOUNTP}/live-sn.cpio.gz" -SNAP_TYPE="cpio" -DESKTOP_LINK="/home/${USERNAME}/Desktop/live-snapshot" +DEF_SNAP_COW="/live/cow" +TMP_FILELIST="${PROGRAM}.list" + +# Command line defaults and declarations +SNAP_COW="${DEF_SNAP_COW}" +SNAP_DEV="" +SNAP_OUTPUT="" SNAP_RESYNC_STRING="" +SNAP_TYPE="cpio" +SNAP_LIST="/etc/live-snapshot.list" Error () { @@ -64,6 +76,7 @@ Header () echo echo "usage: ${PROGRAM} [-c|--cow DIRECTORY] [-d|--device DEVICE] [-o|--output FILE] [-t|--type TYPE]" echo " ${PROGRAM} [-r|--resync-string STRING]" + echo " ${PROGRAM} [-f|--refresh]" echo " ${PROGRAM} [-h|--help]" echo " ${PROGRAM} [-u|--usage]" echo " ${PROGRAM} [-v|--version]" @@ -79,6 +92,7 @@ Help () echo " -d, --device: output snapshot device (default: ${SNAP_DEV:-auto})." echo " -o, --output: output image file (default: ${DEST})." echo " -r, --resync-string: internally used to resync previous made snapshots." + echo " -f, --refresh: try to sync a running snapshot." echo " -t, --type: snapshot filesystem type. Options: \"squashfs\", \"ext2\", \"ext3\", \"jffs2\" or \"cpio\".gz archive (default: ${SNAP_TYPE})" echo echo "Look at live-snapshot(1) man page for more information." @@ -125,16 +139,24 @@ Version () exit 0 } -Is_same_mount () +Try_refresh () { - dir1="$(Base_path ${1})" - dir2="$(Base_path ${2})" + FOUND="" + if [ -n "${ROOTSNAP}" ]; then + "${EXECUTABLE}" --resync-string="${ROOTSNAP}" + FOUND="Yes" + fi - if [ "${dir1}" = "${dir2}" ] + if [ -n "${HOMESNAP}" ]; then + "${EXECUTABLE}" --resync-string="${HOMESNAP}" + FOUND="Yes" + fi + + if [ -z "${FOUND}" ] then - return 0 - else - return 1 + echo "No autoconfigured snapshots found at boot;" > /dev/null 1>&2 + echo "(no resync string in ${LIVE_CONF})." > /dev/null 1>&2 + exit 1 fi } @@ -142,7 +164,7 @@ Parse_args () { # Parse command line ARGS="${*}" - ARGUMENTS="$(getopt --longoptions cow:,device:,output,resync-string:,type:,help,usage,version --name=${PROGRAM} --options c:d:o:t:r:,h,u,v --shell sh -- ${ARGS})" + ARGUMENTS="$(getopt --longoptions cow:,device:,output,resync-string:,refresh,type:,help,usage,version --name=${PROGRAM} --options c:d:o:t:r:fhuv --shell sh -- ${ARGS})" eval set -- "${ARGUMENTS}" @@ -174,6 +196,11 @@ Parse_args () break ;; + -f|--refresh) + Try_refresh + exit 0 + ;; + -h|--help) Help ;; @@ -206,7 +233,7 @@ Defaults () then SNAP_COW=$(echo "${SNAP_RESYNC_STRING}" | cut -f1 -d ':') SNAP_DEV=$(echo "${SNAP_RESYNC_STRING}" | cut -f2 -d ':') - DEST=$(echo "${SNAP_RESYNC_STRING}" | cut -f3 -d ':') + DEST="${MOUNTP}/$(echo ${SNAP_RESYNC_STRING} | cut -f3 -d ':')" case "${DEST}" in *.cpio.gz) @@ -228,7 +255,8 @@ Defaults () Error "unrecognized resync string" ;; esac - else + elif [ -z "${SNAP_OUTPUT}" ] + then # Set target file based on image case "${SNAP_TYPE}" in cpio) @@ -243,6 +271,8 @@ Defaults () DEST="${MOUNTP}/live-sn.ext2" ;; esac + else + DEST="${SNAP_OUTPUT}" fi } @@ -270,8 +300,6 @@ Validate_input () Mount_device () { - mkdir -p "${MOUNTP}" - case "${SNAP_DEV}" in "") # create a temp @@ -287,21 +315,61 @@ Mount_device () esac } +Do_filelist () +{ + # BUGS: supports only cpio.gz types right now + TMP_FILELIST=$1 + if [ -f "${SNAP_LIST}" ] + then + # Generate include list + for entry in $(cat "${SNAP_LIST}" | grep -v '^#.*$' | grep -v '^ *$') + do + if [ -f "${entry}" ] + then + printf "%s\000" "${entry}" >> "${TMP_FILELIST}" + elif [ -d "${entry}" ] + then + cd / + find "${entry}" -print0 >> "${TMP_FILELIST}" + cd "${OLDPWD}" + fi + done + + if [ "${SNAP_COW}" = "${DEF_SNAP_COW}" ] + then + # Relative to rootfs + echo "/" + else + # Mostly "/home" + echo "${SNAP_COW}" + fi + else + cd "${SNAP_COW}" + find . -path '*.wh.*' -prune -o -print0 >> "${TMP_FILELIST}" + cd "${OLDPWD}" + echo "${SNAP_COW}" + fi +} + Do_snapshot () { + TMP_FILELIST=$(mktemp -p "${SAFE_TMPDIR}" "${TMP_FILELIST}.XXXXXX") + case "${SNAP_TYPE}" in squashfs) - EXCLUDE_LIST="$(mktemp -p ${SAFE_TMPDIR} live-snapshot-exclude-list.XXXXXX)" - echo "./${EXCLUDE_LIST}" > "${EXCLUDE_LIST}" + echo ".${TMP_FILELIST}" > "${TMP_FILELIST}" + # Removing whiteheads of unionfs cd "${SNAP_COW}" - find . -name '*.wh.*' >> "${EXCLUDE_LIST}" + find . -name '*.wh.*' >> "${TMP_FILELIST}" cd "${OLDPWD}" - mksquashfs "${SNAP_COW}" "${DEST}" -ef "${EXCLUDE_LIST}" - rm -f "${EXCLUDE_LIST}" + mksquashfs "${SNAP_COW}" "${DEST}" -ef "${TMP_FILELIST}" ;; cpio) - ( cd "${SNAP_COW}" && find . -path '*.wh.*' -prune -o -print0 | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" ) || exit 1 + WORKING_DIR=$(Do_filelist "${TMP_FILELIST}") + cd "${WORKING_DIR}" + cat "${TMP_FILELIST}" | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" || exit 1 + cd "${OLDPWD}" ;; ext2|ext3) @@ -314,11 +382,16 @@ Do_snapshot () mkfs.jffs2 --root="${SNAP_COW}" --output="${DEST}" ;; esac + + if [ -f "${TMP_FILELIST}" ] + then + rm -f "${TMP_FILELIST}" + fi } Clean () { - if echo "${DEST}" | grep -q "${MOUNTP}" + if [ -z "${SNAP_RESYNC_STRING}" ] && echo "${DEST}" | grep -q "${MOUNTP}" then echo "${DEST} is present on ${MOUNTP}, therefore no automatic unmounting the latter." > /dev/null 1>&2 else @@ -327,6 +400,33 @@ Clean () fi } +Warn_user () +{ + if [ -z "${SNAP_RESYNC_STRING}" ] + then + case ${SNAP_TYPE} in + cpio|ext2|ext3) + echo "Please move ${DEST} (if is not already in it)" > /dev/null 1>&2 + echo "in a supported writable partition (e.g ext3, vfat)." > /dev/null 1>&2 + ;; + + squashfs) + echo "To use ${DEST} you need to rebuild your media or add it" > /dev/null 1>&2 + echo "to your multisession disc under the \"/live\" directory." > /dev/null 1>&2 + ;; + + jffs2) + echo "Please cat or flashcp ${DEST} to your partition in order to start using it." > /dev/null 1>&2 + ;; + esac + + if grep -qv persistent /proc/cmdline + then + echo "Remember to boot this live system with \"persistent\" specified at boot prompt." > /dev/null 1>&2 + fi + fi +} + Main () { Parse_args "${@}" @@ -335,6 +435,7 @@ Main () trap 'Clean' EXIT Mount_device Do_snapshot + Warn_user } Main "${@:-}" diff --git a/conf/live-snapshot.list b/conf/live-snapshot.list new file mode 100644 index 0000000..30fe29d --- /dev/null +++ b/conf/live-snapshot.list @@ -0,0 +1,18 @@ +# /etc/live-snapshot resync list example +# +# If this file is present, each uncommented not empty line will be parsed when +# running live-snapshot and included in target snapshot. +# +# 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. + +# Include itself for reuse +/etc/live-snapshot.list + +# Include networking setups +/etc/network/interfaces +/etc/resolv.conf +/etc/hosts + +# Include the whole Desktop directory of the default user +/home/user/Desktop diff --git a/docs/ChangeLog.casper b/docs/ChangeLog.casper index 4e17e6c..564e69b 100644 --- a/docs/ChangeLog.casper +++ b/docs/ChangeLog.casper @@ -1,3 +1,47 @@ +casper (1.136) intrepid; urgency=low + + * Remove bad-and-wrong setting of PATH to include directories under /root; + now that grep links to more libraries than before, this broke a number + of things. Requires initramfs-tools (>= 0.92bubuntu5) because this + doesn't work with klibc chroot. + + -- Colin Watson Fri, 11 Jul 2008 12:34:35 +0100 + +casper (1.135) intrepid; urgency=low + + [ Loic Minier ] + * Fix use of PREREQ instead of PREREQS in hooks/casper. + + [ Colin Watson ] + * Fix mount argument ordering for klibc mount. + + -- Colin Watson Wed, 09 Jul 2008 12:34:26 +0100 + +casper (1.134) intrepid; urgency=low + + [ Evan Dandrea ] + * Do not use mode= when mounting /cow using persistent mode (LP: #219192). + + [ Colin Watson ] + * Support ?= (set value but don't mark as seen) preseeding syntax for + console-setup/* (LP: #64058). + + -- Colin Watson Mon, 30 Jun 2008 23:52:41 +0100 + +casper (1.133) intrepid; urgency=low + + [ Tormod Volden ] + * Do not use swap on RAID raw devices (LP: #136804) + + [ Agostino Russo ] + * Test if livemedia is a directory before trying to mount it as a + loopfile + * Reverted changes to casper-helpers as requested by Mithrandir since + replaying the journal on a hibernated system would lead to file system + corruption. + + -- Evan Dandrea Wed, 18 Jun 2008 12:34:58 -0400 + casper (1.132) intrepid; urgency=low [ Colin Watson ] diff --git a/docs/parameters.txt b/docs/parameters.txt index a9ac3ed..16b5b46 100644 --- a/docs/parameters.txt +++ b/docs/parameters.txt @@ -46,7 +46,7 @@ live showmounts live timezone=TIMEZONE live todisk=DEVICE live toram -live union=unionfs|aufs +live union=aufs|unionfs live utc=yes|no live xdebconf live xvideomode=RESOLUTION diff --git a/hooks/live b/hooks/live index b85f646..4c72f0b 100755 --- a/hooks/live +++ b/hooks/live @@ -93,9 +93,9 @@ manual_add_modules squashfs manual_add_modules sqlzma manual_add_modules unlzma -# Filesystem: unionfs/aufs -manual_add_modules unionfs +# Filesystem: aufs/unionfs manual_add_modules aufs +manual_add_modules unionfs # Filesystem: vfat manual_add_modules nls_cp437 @@ -126,7 +126,7 @@ fi copy_exec /usr/bin/md5sum /bin # Program: udev -copy_exec /sbin/udevtrigger /sbin +copy_exec /sbin/udevadm /sbin copy_exec /sbin/udevsettle /sbin copy_exec /usr/bin/udevinfo /bin @@ -135,3 +135,24 @@ if [ -x /usr/bin/wget ] then copy_exec /usr/bin/wget /bin fi + +# FUSE kernel module +manual_add_modules fuse + +# FUSE filesystem: httpfs +if [ -x /usr/bin/httpfs_ssl ] +then + copy_exec /usr/bin/httpfs2_ssl /bin/httpfs +else + if [ -x /usr/bin/httpfs ] + then + copy_exec /usr/bin/httpfs2 /bin/httpfs + fi +fi + +# FUSE filesystem: curlftpfs +if [ -x /usr/bin/curlftpfs ] +then + copy_exec /usr/bin/curlftpfs /bin +fi + diff --git a/manpages/live-initramfs.en.7.txt b/manpages/live-initramfs.en.7.txt index 0b1a4bf..eb2e302 100644 --- a/manpages/live-initramfs.en.7.txt +++ b/manpages/live-initramfs.en.7.txt @@ -21,7 +21,7 @@ This includes the Debian Live isos, netboot tarballs, and usb stick images. At boot time it will look for a (read-only) media containing a "/live" directory where a root filesystems (often a compressed filesystem image like squashfs) is stored. If found, it will create a writable environment, using -unionfs, for Debian like systems to boot from. +aufs, for Debian like systems to boot from. You probably do not want to install this package onto a non-live system, although it will do no harm. @@ -252,10 +252,10 @@ Adding this parameter, live-initramfs will try to copy the whole read-only media to the computer's RAM before mounting the root filesystem. This could need a lot of ram, according to the space used by the read-only media. - union=**unionfs**|**aufs**:: + union=**aufs**|**unionfs**:: -By default, live-initramfs uses unionfs. With this parameter, you can switch to -aufs. +By default, live-initramfs uses aufs. With this parameter, you can switch to +unionfs. utc=**yes**|**no**:: @@ -283,9 +283,9 @@ Some variables can be configured via this config file (inside the live system). This optional file (inside the live media) contains a list of white-space or carriage-return-separated file names corresponding to disk images in the "/live" directory. If this file exists, only images listed here will be merged into the -root unionfs, and they will be loaded in the order listed here. The first entry -in this file will be the "lowest" point in the unionfs, and the last file in -this list will be on the "top" of the unionfs, directly below /cow. Without +root aufs, and they will be loaded in the order listed here. The first entry +in this file will be the "lowest" point in the aufs, and the last file in +this list will be on the "top" of the aufs, directly below /cow. Without this file, any images in the "/live" directory are loaded in alphanumeric order. See also diff --git a/manpages/live-snapshot.en.1.txt b/manpages/live-snapshot.en.1.txt index e880b08..f57413d 100644 --- a/manpages/live-snapshot.en.1.txt +++ b/manpages/live-snapshot.en.1.txt @@ -55,6 +55,12 @@ the filename/label used for the output file/partition. If left blank, live-snaps internally used on resyncs. + -f, --refresh:: + +try to do the same operation that should be done at reboot or halt, resyncing +boot-time auto discovered snapshots. Useful to prevent a crash or surge +power-off. + -t, --type **TYPE**:: Type could be one of "cpio", "squashfs", "ext2", "ext3" or "jffs2". @@ -71,6 +77,14 @@ show usage and exit output version information and exit +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. +Beware, it is an experimental feature that only works for cpio targets now. + See also -------- diff --git a/manpages/live-snapshot.it.1.txt b/manpages/live-snapshot.it.1.txt index e396efe..fd1ac04 100644 --- a/manpages/live-snapshot.it.1.txt +++ b/manpages/live-snapshot.it.1.txt @@ -61,6 +61,12 @@ del device oppure user`a l'intera partizione. usato internamente nelle sincronizzazioni dallo script di init di live-initramfs. Il formato pu\`o cambiare, usatelo a vostro rischio. + -f, --refresh:: + +scatena la stessa operazione che verrebbe fatta al reboot o all'halt della +macchina, provando a fare il resync degli snapshot trovati al boot, usabile +per salvare le modifiche in vista di un crash o di una mancanza di corrente. + -t, --type **TYPE**:: il tipo pu`o essere "cpio", "squashfs" o "ext2". @@ -77,6 +83,15 @@ mostra l'utilizzo ed esce da informazioni sulla versione ed esce +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. +Attenzione, e` una funzionalita` sperimentale che funziona attualmente solo con gli snapshot di tipo "cpio". + + See also -------- diff --git a/scripts/live b/scripts/live index 0d84533..f4a4029 100755 --- a/scripts/live +++ b/scripts/live @@ -65,6 +65,16 @@ Arguments () export HOOK ;; + ftpfs=*) + FTPFS="${ARGUMENT#ftpfs=}" + export FTPFS + ;; + + httpfs=*) + HTTPFS="${ARGUMENT#httpfs=}" + export HTTPFS + ;; + hostname=*) HOSTNAME="${ARGUMENT#hostname=}" LIVECONF="changed" @@ -446,7 +456,7 @@ Arguments () if [ -z "${UNIONTYPE}" ] then - UNIONTYPE="unionfs" + UNIONTYPE="aufs" export UNIONTYPE fi } @@ -479,7 +489,7 @@ matches_uuid () path="${1}" uuid="$(cat /conf/uuid.conf)" - for try_uuid_file in "${mountpoint}/.disk/casper-uuid"* + for try_uuid_file in "${mountpoint}/.disk/live-uuid"* do [ -e "${try_uuid_file}" ] || continue @@ -640,7 +650,7 @@ do_netmount () modprobe -q af_packet # For DHCP - udevtrigger + udevadm trigger udevsettle ipconfig ${DEVICE} | tee /netboot.config @@ -656,7 +666,7 @@ do_netmount () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi - if [ -n "${FETCH}" ] && do_httpmount + if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount then rc=0 return ${rc} @@ -686,20 +696,53 @@ do_netmount () do_httpmount () { rc=1 - extension=$(echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/') - - case "${extension}" in - squashfs|tgz|tar) - [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})" - mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}" - wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})" - [ ${?} -eq 0 ] && rc=0 - [ "${extension}" = "tgz" ] && live_dest="ram" - ;; + dest="${mountpoint}/${LIVE_MEDIA_PATH}" + mount -t ramfs ram "${mountpoint}" + mkdir -p "${dest}" - *) - [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}" - esac + for webfile in HTTPFS FTPFS FETCH + do + url="$(eval echo \"\$\{${webfile}\}\")" + extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')" + + if [ -n "$url" ] + then + case "${extension}" in + squashfs|tgz|tar) + if [ "${webfile}" = "FETCH" ] + then + [ "${quiet}" != "y" ] && + log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})" + wget "${url}" -O "${dest}/$(basename ${url})" + else + [ "${quiet}" != "y" ] && + log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})" + if [ "${webfile}" = "FTPFS" ] + then + FUSE_MOUNT="curlftpfs" + url="$(dirname ${url})" + else + FUSE_MOUNT="httpfs" + fi + modprobe fuse + $FUSE_MOUNT "${url}" "${dest}" + fi + [ ${?} -eq 0 ] && rc=0 + [ "${extension}" = "tgz" ] && live_dest="ram" + break + ;; + + *) + [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${url}" + ;; + esac + fi + done + + if [ ${rc} != 0 ] + then + umount "${mountpoint}" + fi return ${rc} } @@ -832,7 +875,7 @@ try_snap () fi else # cpio.gz snapshot - if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null) + if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1) then log_warning_msg "Impossible to include the ${snapfile} Snapshot" return 1 @@ -965,7 +1008,12 @@ setup_unionfs () rofslist="${image} ${rofslist}" elif [ -f "${image}" ] then - backdev=$(get_backing_device "${image}" "-r") + if /sbin/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 [ "${fstype}" = "unknown" ] @@ -993,7 +1041,7 @@ setup_unionfs () modprobe -q -b ${module} done - udevtrigger + udevadm trigger udevsettle # For some reason, udevsettle does not block in this scenario, @@ -1016,10 +1064,12 @@ setup_unionfs () then cowdevice=${cowprobe} cow_fstype=$(get_fstype "${cowprobe}") + cow_mountopt="rw,noatime" else [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium" cowdevice="tmpfs" cow_fstype="tmpfs" + cow_mountopt="rw,noatime,mode=755" fi elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ] then @@ -1052,7 +1102,7 @@ setup_unionfs () nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \ panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow" else - mount -t ${cow_fstype} -o rw,noatime ${cowdevice} /cow || \ + mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \ panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow" fi @@ -1130,7 +1180,7 @@ setup_unionfs () # shows cow fs on /cow for use by live-snapshot mkdir -p "${rootmnt}/live/cow" - mount -o move /cow "${rootmnt}/live/cow" + mount -o move /cow "${rootmnt}/live/cow" || mount -o bind /cow "${rootmnt}/live/cow" || [ "${quiet}" != "y" ] && log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow" } check_dev () @@ -1144,12 +1194,6 @@ check_dev () devname=$(sys2dev "${sysdev}") fi - if [ -n "${LIVE_MEDIA_OFFSET}" ] - then - loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '') - devname="${loopdevname}" - fi - if [ -d "${devname}" ] then mount -o bind "${devname}" $mountpoint || continue @@ -1163,6 +1207,12 @@ check_dev () fi fi + if [ -n "${LIVE_MEDIA_OFFSET}" ] + then + loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '') + devname="${loopdevname}" + fi + fstype=$(get_fstype "${devname}") if is_supported_fs ${fstype} @@ -1281,7 +1331,7 @@ mountroot () set_usplash_timeout - if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] + if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ] then if do_netmount then diff --git a/scripts/live-bottom/13swap b/scripts/live-bottom/13swap index f3af1cc..303fbbb 100755 --- a/scripts/live-bottom/13swap +++ b/scripts/live-bottom/13swap @@ -41,6 +41,8 @@ do continue fi + /lib/udev/vol_id ${device%%[0-9]*} | grep -q "^ID_FS_USAGE=raid" && continue + magic=$(/bin/dd if="${device}" bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null) || continue if [ "${magic}" = "SWAPSPACE2" -o "${magic}" = "SWAP-SPACE" ] diff --git a/scripts/live-bottom/14locales b/scripts/live-bottom/14locales index db26f0b..94e3cf2 100755 --- a/scripts/live-bottom/14locales +++ b/scripts/live-bottom/14locales @@ -93,7 +93,7 @@ EOF if [ -z "${LANG}" ] then - log_warning_message "Locale ${locale} is unsupported." + log_warning_msg "Locale ${locale} is unsupported." locale="en_US.UTF-8" LANG="${locale}" fi diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking index 6c726c6..429a135 100755 --- a/scripts/live-bottom/23networking +++ b/scripts/live-bottom/23networking @@ -46,7 +46,7 @@ iface lo inet loopback EOF -udevtrigger +udevadm trigger udevsettle if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ] diff --git a/scripts/live-helpers b/scripts/live-helpers index 02c3e55..b8b9cf1 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -72,12 +72,9 @@ where_is_mounted () if grep -q "^${device} " /proc/mounts then - grep "^${device} " /proc/mounts | read d mountpoint rest - echo ${mountpoint} - return 0 + # return the first found + grep "^${device} " /proc/mounts | cut -f2 -d ' ' fi - - return 1 } lastline () @@ -120,9 +117,9 @@ fs_size () if [ -z "${mountp}" ] then - mountp=$(where_is_mounted "${dev}") + mountp="$(where_is_mounted ${dev})" - if [ "${?}" -gt 0 ] + if [ -z "${mountp}" ] then mountp="/mnt/tmp_fs_size" @@ -181,7 +178,10 @@ setup_loop () if [ -n ${readonly} ] then - options="${options} -r" + if /sbin/losetup --help 2>&1 | grep -q -- "-r\b" + then + options="${options} -r" + fi fi if [ 0 -lt "${offset}" ] @@ -240,10 +240,12 @@ try_mount () mountp="${2}" opts="${3}" - if where_is_mounted ${dev} > /dev/null + old_mountp="$(where_is_mounted ${dev})" + + if [ -n "${old_mountp}" ] then - mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed" - mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount" + mount -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed" + mount -o bind "${old_mountp}" "${mountp}" || panic "Cannot bind-mount ${old_mountp} on ${mountp}" else mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}" fi diff --git a/scripts/local-top/live b/scripts/live-premount/modules similarity index 92% rename from scripts/local-top/live rename to scripts/live-premount/modules index 8d18786..408e873 100755 --- a/scripts/local-top/live +++ b/scripts/live-premount/modules @@ -28,4 +28,5 @@ esac # * http://lists.alioth.debian.org/pipermail/debian-live-devel/2007-June/001517.html # * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363047 -modprobe ide-generic +modprobe -q ide-generic +modprobe -q esp