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; \
# 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 <marco.amadori@gmail.com>
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
-# 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,
# 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 <http://www.gnu.org/licenses/>.
#
# 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 ()
{
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]"
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."
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
}
{
# 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}"
break
;;
+ -f|--refresh)
+ Try_refresh
+ exit 0
+ ;;
+
-h|--help)
Help
;;
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)
Error "unrecognized resync string"
;;
esac
- else
+ elif [ -z "${SNAP_OUTPUT}" ]
+ then
# Set target file based on image
case "${SNAP_TYPE}" in
cpio)
DEST="${MOUNTP}/live-sn.ext2"
;;
esac
+ else
+ DEST="${SNAP_OUTPUT}"
fi
}
Mount_device ()
{
- mkdir -p "${MOUNTP}"
-
case "${SNAP_DEV}" in
"")
# create a temp
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)
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
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 "${@}"
trap 'Clean' EXIT
Mount_device
Do_snapshot
+ Warn_user
}
Main "${@:-}"
--- /dev/null
+# /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
+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 <cjwatson@ubuntu.com> 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 <cjwatson@ubuntu.com> 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 <cjwatson@ubuntu.com> 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 <evand@ubuntu.com> Wed, 18 Jun 2008 12:34:58 -0400
+
casper (1.132) intrepid; urgency=low
[ Colin Watson ]
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
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
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
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
+
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.
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**::
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
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".
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
--------
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".
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
--------
export HOOK
;;
+ ftpfs=*)
+ FTPFS="${ARGUMENT#ftpfs=}"
+ export FTPFS
+ ;;
+
+ httpfs=*)
+ HTTPFS="${ARGUMENT#httpfs=}"
+ export HTTPFS
+ ;;
+
hostname=*)
HOSTNAME="${ARGUMENT#hostname=}"
LIVECONF="changed"
if [ -z "${UNIONTYPE}" ]
then
- UNIONTYPE="unionfs"
+ UNIONTYPE="aufs"
export UNIONTYPE
fi
}
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
modprobe -q af_packet # For DHCP
- udevtrigger
+ udevadm trigger
udevsettle
ipconfig ${DEVICE} | tee /netboot.config
NFSROOT=${ROOTSERVER}:${ROOTPATH}
fi
- if [ -n "${FETCH}" ] && do_httpmount
+ if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount
then
rc=0
return ${rc}
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}
}
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
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" ]
modprobe -q -b ${module}
done
- udevtrigger
+ udevadm trigger
udevsettle
# For some reason, udevsettle does not block in this scenario,
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
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
# 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 ()
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
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}
set_usplash_timeout
- if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]
+ if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
then
if do_netmount
then
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" ]
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
EOF
-udevtrigger
+udevadm trigger
udevsettle
if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]
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 ()
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"
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}" ]
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
# * 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