From e0a050e3bcf51cf0bb1df9490487e0619d4aa9f9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 18 Apr 2010 20:41:57 +0200 Subject: [PATCH] Adding upstream version 1.154.1. --- bin/live-snapshot | 77 ++++++- conf/live-persistence.binds | 15 ++ conf/live-snapshot.exclude_list | 17 ++ docs/ChangeLog.casper | 142 +++++++++++++ docs/parameters.txt | 4 +- hooks/live | 9 + manpages/live-initramfs.en.7.txt | 22 +- manpages/live-snapshot.en.1.txt | 9 +- manpages/live-snapshot.it.1.txt | 6 +- scripts/live | 254 ++++++++++++++++------- scripts/live-bottom/05mountpoints | 2 +- scripts/live-bottom/06hostname | 15 +- scripts/live-bottom/08persistence_excludes | 77 +++++++ scripts/live-bottom/10adduser | 22 ++ scripts/live-bottom/12fstab | 6 +- scripts/live-bottom/13swap | 4 +- scripts/live-bottom/15autologin | 4 +- scripts/live-bottom/19keyboard | 3 + scripts/live-bottom/20xconfig | 6 +- scripts/live-bottom/21xdriver | 6 +- scripts/live-bottom/21xvidemode | 6 +- scripts/live-bottom/22gnome_panel_data | 2 +- scripts/live-bottom/30accessibility | 15 +- scripts/live-bottom/32disable_hibernation | 2 +- scripts/live-bottom/38disable_restricted_manager | 39 ---- scripts/live-bottom/38jockey_disable_check | 29 +++ scripts/live-bottom/44pk_allow | 9 + scripts/live-functions | 62 ++---- scripts/live-helpers | 71 +++++-- 29 files changed, 715 insertions(+), 220 deletions(-) create mode 100644 conf/live-persistence.binds create mode 100644 conf/live-snapshot.exclude_list create mode 100755 scripts/live-bottom/08persistence_excludes delete mode 100755 scripts/live-bottom/38disable_restricted_manager create mode 100755 scripts/live-bottom/38jockey_disable_check diff --git a/bin/live-snapshot b/bin/live-snapshot index b81a6af..3d4efad 100755 --- a/bin/live-snapshot +++ b/bin/live-snapshot @@ -30,7 +30,12 @@ ROOTSNAP="" HOMESNAP="" -set -eu +if [ -n "${LIVE_SNAPSHOT_CHECK_UNBOUND}" ] +then + set -eu +else + set -e +fi . /usr/share/initramfs-tools/scripts/live-helpers @@ -58,6 +63,7 @@ SNAP_OUTPUT="" SNAP_RESYNC_STRING="" SNAP_TYPE="cpio" SNAP_LIST="/etc/live-snapshot.list" +EXCLUDE_LIST="/etc/live-snapshot.exclude_list" Error () { @@ -315,23 +321,49 @@ Mount_device () esac } +Entry_is_modified () +{ + # Returns true if file exists and it is also present in "cow" directory + # This means it is modified in respect to read-only media, so it deserve + # to be saved + + entry="${1}" + + if [ -e "${entry}" ] || [ -L "${entry}" ] + then + if [ -e "${DEF_SNAP_COW}/${entry}" ] || [ -L "${DEF_SNAP_COW}/${entry}" ] + then + return 0 + fi + fi + return 1 +} + Do_filelist () { - # BUGS: supports only cpio.gz types right now + # BUGS: supports only cpio.gz types, and does not handle deleted files yet + TMP_FILELIST=$1 if [ -f "${SNAP_LIST}" ] then - # Generate include list - for entry in $(cat "${SNAP_LIST}" | grep -v '^#.*$' | grep -v '^ *$') + # Generate include list removing empty and commented lines + for entry in $(sed -e '/^ *$/d' -e '/^#.*$/d' "${SNAP_LIST}") do - if [ -f "${entry}" ] - then - printf "%s\000" "${entry}" >> "${TMP_FILELIST}" - elif [ -d "${entry}" ] + if [ -d "${entry}" ] then cd / - find "${entry}" -print0 >> "${TMP_FILELIST}" + find "${entry}" | while read line + do + if Entry_is_modified "${line}" + then + 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 @@ -361,6 +393,13 @@ Do_snapshot () # Removing whiteheads of unionfs cd "${SNAP_COW}" find . -name '*.wh.*' >> "${TMP_FILELIST}" + + if [ -e "${EXCLUDE_LIST}" ] + then + # Add explicitly excluded files + grep -v '^#.*$' "${EXCLUDE_LIST}" | grep -v '^ *$' >> "${TMP_FILELIST}" + fi + cd "${OLDPWD}" mksquashfs "${SNAP_COW}" "${DEST}" -ef "${TMP_FILELIST}" ;; @@ -368,10 +407,28 @@ Do_snapshot () cpio) WORKING_DIR=$(Do_filelist "${TMP_FILELIST}") cd "${WORKING_DIR}" - cat "${TMP_FILELIST}" | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" || exit 1 + if [ -e "${EXCLUDE_LIST}" ] + then + # Convert \0 to \n and tag existing (rare but possible) \n in filenames, + # this to let grep -F -v do a proper work in filtering out + cat "${TMP_FILELIST}" | \ + tr '\n' '\1' | \ + tr '\0' '\n' | \ + grep -F -v -f "${EXCLUDE_LIST}" | \ + tr '\n' '\0' | \ + tr '\1' '\n' | \ + cpio --quiet -o0 -H newc | \ + gzip -9c > "${DEST}" || exit 1 + else + cat "${TMP_FILELIST}" | \ + cpio --quiet -o0 -H newc | \ + gzip -9c > "${DEST}" || exit 1 + fi cd "${OLDPWD}" ;; + # ext2|ext3 and jffs2 does not easily support an exclude list; files + # should be copied to another directory in order to filter content ext2|ext3) DU_DIM="$(du -ks ${SNAP_COW} | cut -f1)" REAL_DIM="$(expr ${DU_DIM} + ${DU_DIM} / 20)" # Just 5% more to be sure, need something more sophistcated here... diff --git a/conf/live-persistence.binds b/conf/live-persistence.binds new file mode 100644 index 0000000..b2c3833 --- /dev/null +++ b/conf/live-persistence.binds @@ -0,0 +1,15 @@ +# /etc/live-persistence.binds example +# +# If this file is present in the proper path, each uncommented not empty line +# will be treated as a directory which should not be made persistent and +# which it's content should be volatile. +# +# This is achieved by bind mounting on it a tmpfs clone of the directory specified + +# Exclude some standard temporary paths +/tmp +/var/log +/var/cache + +# Firefox profiles are not always useful to remember +/root/.mozilla diff --git a/conf/live-snapshot.exclude_list b/conf/live-snapshot.exclude_list new file mode 100644 index 0000000..82972e3 --- /dev/null +++ b/conf/live-snapshot.exclude_list @@ -0,0 +1,17 @@ +# /etc/live-snapshot.exclude_list example +# +# If this file is present in the proper path, each uncommented not empty line +# will be excluded in the target snapshot when live-snapshot is run. +# +# The syntax for the line is just a full file or directory pathname. + +# Each line is treated like a plain match string for "grep -F -v", +# so be careful: e.g. "/tmp" will exclude also "/var/tmp" ! + +# Exclude some standard temporary paths +/tmp +/var/log +/var/cache + +# Firefox profiles are not always useful to remember +/root/.mozilla diff --git a/docs/ChangeLog.casper b/docs/ChangeLog.casper index 153901c..d366027 100644 --- a/docs/ChangeLog.casper +++ b/docs/ChangeLog.casper @@ -1,3 +1,145 @@ +casper (1.154) jaunty; urgency=low + + [ Evan Dandrea ] + * scripts/casper-bottom/02timezone: + - Remove as it's no longer needed and resets the timezone when + persistence is enabled (LP: #296855). + + [ Colin Watson ] + * Preseed console-setup/optionscode and console-setup/codesetcode to the + empty string on boot to avoid debris from the live filesystem build + process getting in the way of installation (LP: #94177). + + -- Colin Watson Sun, 23 Nov 2008 12:44:45 +0000 + +casper (1.153) jaunty; urgency=low + + * scripts/casper-bottom/10adduser: + - Create links for Mythbuntu items on the Desktop too. + - Don't show removable drives on Mythbuntu desktop + * scripts/casper-bottom/46disable_services: + - New script for disabling services unnecessary to Live + mode that should still start after being installed. + + -- Mario Limonciello Tue, 04 Nov 2008 01:25:59 -0600 + +casper (1.152) intrepid; urgency=low + + * Use kde4rc now for accessibility profiles + + -- Jonathan Riddell Sat, 25 Oct 2008 23:44:54 +0100 + +casper (1.151) intrepid; urgency=low + + * Force ubiquity to --automatic mode for ubuntu-mid + + -- Emmet Hikory Thu, 16 Oct 2008 15:31:16 +0100 + +casper (1.150) intrepid; urgency=low + + * Fix path to Kubuntu help file in 10adduser (really) + + -- Jonathan Riddell Thu, 16 Oct 2008 12:16:54 +0100 + +casper (1.149) intrepid; urgency=low + + * scripts/casper-bottom/30accessibility & + ubiquity-hooks/30accessibility: + - Revert to using gconf keys for starting orca, as this is now what + orca does when the user chooses to automatically start orca from Orca's + preferences window. + - Explicitly set orca as the program to start up for magnification, + speech, and braille. + + -- Luke Yelavich Thu, 16 Oct 2008 11:33:02 +1100 + +casper (1.148) intrepid; urgency=low + + * Skip remounting read-only in try_mount as it's unnecessary and + breaks persistence. Thanks James Westby (LP: #274076). + + -- Evan Dandrea Wed, 15 Oct 2008 13:09:57 -0400 + +casper (1.147) intrepid; urgency=low + + * Fix path to Kubuntu help file in 10adduser + + -- Jonathan Riddell Wed, 15 Oct 2008 12:49:29 +0100 + +casper (1.146) intrepid; urgency=low + + * Update About Kubuntu link in 10adduser for KDE 4 + + -- Jonathan Riddell Mon, 06 Oct 2008 17:54:15 +0100 + +casper (1.145) intrepid; urgency=low + + * 38disable_restricted_manager: Remove some obsolete l-r-m and + restricted-manager code, and rename the script to 38jockey_disable_check + to better reflect its purpose. + + -- Martin Pitt Mon, 06 Oct 2008 09:21:40 +0200 + +casper (1.144) intrepid; urgency=low + + * Bump media detection timeout to a minute; thanks to Tormod Volden and + Steve Beattie for analysis (LP: #258432). + * Note that this changes (fixes?) the semantics of LIVEMEDIA_TIMEOUT due + to not using hex values in a for loop which aren't understood by test + -lt (thanks, Steve Beattie). + + -- Colin Watson Fri, 26 Sep 2008 18:35:13 +0100 + +casper (1.143) intrepid; urgency=low + + * scripts/casper-bottom/30accessibility & + ubiquity-hooks/30accessibility: Change the way that orca is set to + automatically start. Orca can be started via a gconf key, however this + is not reflected in the orca UI, and doesn't easily allow the user to + prevent orca from autostarting on an installed system. + + -- Luke Yelavich Wed, 24 Sep 2008 10:37:35 +1000 + +casper (1.142) intrepid; urgency=low + + * Fix syntax error introduced by is_nice_device regex fix. + + -- Colin Watson Fri, 19 Sep 2008 02:30:59 +0100 + +casper (1.141) intrepid; urgency=low + + [ Johannes Ballé ] + * Handle spaces in file names in md5sum.txt (LP: #251112). + + [ Colin Watson ] + * Support ?= (set value but don't mark as seen) preseeding syntax in + preseed script; previously we only supported it in the keyboard script, + which confusingly doesn't deal with propagating console-setup/* preseeds + to the target filesystem (LP: #253749). + * Update to localechooser's new languagelist format. + + [ Tormod Volden ] + * scripts/casper: don't scan floppy drives for livefs images (LP: #97306) + * scripts/casper: fix broken RE in is_nice_device() (LP: #250328) + * scripts/casper: properly use argument $1 in matches_uuid() + + -- Colin Watson Fri, 19 Sep 2008 02:14:05 +0100 + +casper (1.140) intrepid; urgency=low + + [ Colin Watson ] + * Disable jockey as well as the old restricted-manager. While jockey does + do more than restricted-manager did, it also still uses a good chunk of + memory for a use case that's fairly limited on the live CD. + + [ Luke Yelavich ] + * scripts/casper-bottom/30accessibility & + ubiquity-hooks/30accessibility: + - Check that usr/bin/orca exists and is executable before creating user + settings files. + + -- Luke Yelavich Fri, 12 Sep 2008 19:23:41 +1000 + casper (1.139) intrepid; urgency=low * add compcache conf.d configuration for initramfs-tools diff --git a/docs/parameters.txt b/docs/parameters.txt index 16b5b46..fd05339 100644 --- a/docs/parameters.txt +++ b/docs/parameters.txt @@ -35,10 +35,10 @@ live noxautologin live nofastboot live nopersistent live nosudo -live noswap +live swapon live nouser live noxautoconfig -live persistent +live persistent[=nofiles] live {preseed/file|file}=FILE live package/question=VALUE live quickreboot diff --git a/hooks/live b/hooks/live index dea7f0c..f2984f4 100755 --- a/hooks/live +++ b/hooks/live @@ -128,6 +128,15 @@ fi # Program: md5sum copy_exec /usr/bin/md5sum /bin +# Program: cpio +# busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots +if [ -e "${DESTDIR}/bin/cpio" ] +then + # Override already present cpio's, mostly klibc's + rm "${DESTDIR}/bin/cpio" +fi +copy_exec /bin/cpio /bin + # Program: udev if [ -x /sbin/udevadm ] then diff --git a/manpages/live-initramfs.en.7.txt b/manpages/live-initramfs.en.7.txt index eb2e302..de8a67c 100644 --- a/manpages/live-initramfs.en.7.txt +++ b/manpages/live-initramfs.en.7.txt @@ -183,9 +183,9 @@ Do not prompt to eject the CD on reboot. This parameter disables the automatic configuration of sudo. - noswap:: + swapon:: -This parameter disables usage of local swap partitions. +This parameter enables usage of local swap partitions. nouser:: @@ -197,14 +197,16 @@ This parameter disables Xorg auto-reconfiguration at boot time. This is valuable if you either do the detection on your own, or, if you want to ship a custom, premade xorg.conf in your live system. - persistent:: + persistent[=nofiles]:: live-initramfs will look for persistent and snapshot partitions or files labeled "live-rw", "home-rw", and files called "live-sn*", "home-sn*" and will try to, in order: mount as /cow the first, mount the second in /home, and just copy the contents of the latter in appropriate locations (snapshots). Snapshots will be tried to be updated on reboot/shutdown. Look at live-snapshot(1) for more -informations. +informations. If "nofiles" is specified, only filesystems with matching labels +will be searched; no filesystems will be traversed looking for archives or image +files. This results in shorter boot times. {preseed/file|file}=**FILE**:: @@ -288,6 +290,18 @@ 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. + /etc/live-persistence.binds + +This optional file (which resides in the rootfs system, not in the live media) +is used as a list of directories which not need be persistent: ie. their +content does not need to survive reboots when using the persistence features. + +This saves expensive writes and speeds up operations on volatile data such as +web caches and temporary files (like e.g. /tmp and .mozilla) which are +regenerated each time. This is achieved by bind mounting each listed directory +with a tmpfs on the original path. + + See also -------- diff --git a/manpages/live-snapshot.en.1.txt b/manpages/live-snapshot.en.1.txt index f57413d..e2c6241 100644 --- a/manpages/live-snapshot.en.1.txt +++ b/manpages/live-snapshot.en.1.txt @@ -82,8 +82,13 @@ 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. +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. + + /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. + See also -------- diff --git a/manpages/live-snapshot.it.1.txt b/manpages/live-snapshot.it.1.txt index fd1ac04..dc8a992 100644 --- a/manpages/live-snapshot.it.1.txt +++ b/manpages/live-snapshot.it.1.txt @@ -89,8 +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. -Attenzione, e` una funzionalita` sperimentale che funziona attualmente solo con gli snapshot di tipo "cpio". +Funziona attualmente solo con gli snapshot di tipo "cpio". + /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. See also -------- diff --git a/scripts/live b/scripts/live index 0363daf..389fc21 100755 --- a/scripts/live +++ b/scripts/live @@ -21,6 +21,17 @@ HOSTNAME="host" mkdir -p "${mountpoint}" +# Create /etc/mtab for debug purpose and future syncs +if [ ! -d /etc ] +then + mkdir /etc/ +fi + +if [ ! -f /etc/mtab ] +then + touch /etc/mtab +fi + [ -f /etc/live.conf ] && . /etc/live.conf export USERNAME USERFULLNAME HOSTNAME @@ -275,9 +286,9 @@ Arguments () export NOPROGRAMCRASHES ;; - norestrictedmanager) - NORESTRICTEDMANAGER="Yes" - export NORESTRICTEDMANAGER + nojockey) + NOJOCKEY="Yes" + export NOJOCKEY ;; nosudo) @@ -285,9 +296,9 @@ Arguments () export NOSUDO ;; - noswap) - NOSWAP="Yes" - export NOSWAP + swapon) + SWAPON="Yes" + export SWAPON ;; noupdatenotifier) @@ -315,6 +326,15 @@ Arguments () export PERSISTENT ;; + persistent=*) + PERSISTENT="${ARGUMENT#persistent=}" + if [ -z "${PERSISTENT}" ] + then + PERSISTENT="Yes" + fi + export PERSISTENT + ;; + nopersistent) NOPERSISTENT="Yes" export NOPERSISTENT @@ -333,9 +353,9 @@ Arguments () url=*) location="${ARGUMENT#url=}" - mount -n -o bind /sys /root/sys - mount -n -o bind /proc /root/proc - mount -n -o bind /dev /root/dev + mount -o bind /sys /root/sys + mount -o bind /proc /root/proc + mount -o bind /dev /root/dev mkdir -p /root/var/run/network chroot /root dhclient eth0 @@ -489,7 +509,7 @@ matches_uuid () path="${1}" uuid="$(cat /conf/uuid.conf)" - for try_uuid_file in "${mountpoint}/.disk/live-uuid"* + for try_uuid_file in "${path}/.disk/live-uuid"* do [ -e "${try_uuid_file}" ] || continue @@ -538,7 +558,7 @@ mount_images_in_directory () { directory="${1}" rootmnt="${2}" - mac="${3}" + mac="${3}" if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" || @@ -550,7 +570,7 @@ mount_images_in_directory () [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}" setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}" else - : + panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}." fi } @@ -558,7 +578,7 @@ is_nice_device () { sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])" + if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb))" then return 0 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$' @@ -593,7 +613,7 @@ copy_live_to () if [ "${copytodev}" = "ram" ] then # copying to ram: - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) ) + freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\