Adding upstream version 1.154.1. upstream/1.154.1
authorDaniel Baumann <daniel@debian.org>
Sun, 18 Apr 2010 18:41:57 +0000 (20:41 +0200)
committerDaniel Baumann <daniel@debian.org>
Sun, 18 Apr 2010 18:41:57 +0000 (20:41 +0200)
29 files changed:
bin/live-snapshot
conf/live-persistence.binds [new file with mode: 0644]
conf/live-snapshot.exclude_list [new file with mode: 0644]
docs/ChangeLog.casper
docs/parameters.txt
hooks/live
manpages/live-initramfs.en.7.txt
manpages/live-snapshot.en.1.txt
manpages/live-snapshot.it.1.txt
scripts/live
scripts/live-bottom/05mountpoints
scripts/live-bottom/06hostname
scripts/live-bottom/08persistence_excludes [new file with mode: 0755]
scripts/live-bottom/10adduser
scripts/live-bottom/12fstab
scripts/live-bottom/13swap
scripts/live-bottom/15autologin
scripts/live-bottom/19keyboard
scripts/live-bottom/20xconfig
scripts/live-bottom/21xdriver
scripts/live-bottom/21xvidemode
scripts/live-bottom/22gnome_panel_data
scripts/live-bottom/30accessibility
scripts/live-bottom/32disable_hibernation
scripts/live-bottom/38disable_restricted_manager [deleted file]
scripts/live-bottom/38jockey_disable_check [new file with mode: 0755]
scripts/live-bottom/44pk_allow
scripts/live-functions
scripts/live-helpers

index b81a6af..3d4efad 100755 (executable)
 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 (file)
index 0000000..b2c3833
--- /dev/null
@@ -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 (file)
index 0000000..82972e3
--- /dev/null
@@ -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
index 153901c..d366027 100644 (file)
@@ -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 <cjwatson@ubuntu.com>  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 <superm1@ubuntu.com>  Tue, 04 Nov 2008 01:25:59 -0600
+
+casper (1.152) intrepid; urgency=low
+
+  * Use kde4rc now for accessibility profiles
+
+ -- Jonathan Riddell <jriddell@ubuntu.com>  Sat, 25 Oct 2008 23:44:54 +0100
+
+casper (1.151) intrepid; urgency=low
+
+  * Force ubiquity to --automatic mode for ubuntu-mid
+
+ -- Emmet Hikory <persia@ubuntu.com>  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 <jriddell@ubuntu.com>  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 <themuso@ubuntu.com>  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 <evand@ubuntu.com>  Wed, 15 Oct 2008 13:09:57 -0400
+
+casper (1.147) intrepid; urgency=low
+
+  * Fix path to Kubuntu help file in 10adduser
+
+ -- Jonathan Riddell <jriddell@ubuntu.com>  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 <jriddell@ubuntu.com>  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 <martin.pitt@ubuntu.com>  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 <cjwatson@ubuntu.com>  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 <themuso@ubuntu.com>  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 <cjwatson@ubuntu.com>  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 <cjwatson@ubuntu.com>  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 <themuso@ubuntu.com>  Fri, 12 Sep 2008 19:23:41 +1000
+
 casper (1.139) intrepid; urgency=low
 
   * add compcache conf.d configuration for initramfs-tools
index 16b5b46..fd05339 100644 (file)
@@ -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
index dea7f0c..f2984f4 100755 (executable)
@@ -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
index eb2e302..de8a67c 100644 (file)
@@ -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
 --------
 
index f57413d..e2c6241 100644 (file)
@@ -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
 --------
index fd1ac04..dc8a992 100644 (file)
@@ -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
 --------
index 0363daf..389fc21 100755 (executable)
@@ -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 '/\<Cached/{print $2}' /proc/meminfo ) )
                mount_options="-o size=${size}k"
                free_string="memory"
                fstype="tmpfs"
@@ -621,14 +641,14 @@ copy_live_to ()
        # begin copying (or uncompressing)
        mkdir "${copyto}"
        echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
-       mount -n -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
+       mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
 
        if [ "${extension}" = "tgz" ]
        then
                cd "${copyto}"
                tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
                rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
-               mount -n -r -o move "${copyto}" "${rootmnt}"
+               mount -r -o move "${copyto}" "${rootmnt}"
                cd "${OLDPWD}"
        else
                if [ -n "${MODULETORAMFILE}" ]
@@ -638,9 +658,8 @@ copy_live_to ()
                        cp -a ${copyfrom}/* ${copyto}   # "cp -a" from busybox also copies hidden files
                fi
 
-               livefs_root
                umount ${copyfrom}
-               mount -n -r -o move ${copyto} ${copyfrom}
+               mount -r -o move ${copyto} ${copyfrom}
        fi
 
        rmdir ${copyto}
@@ -672,6 +691,15 @@ do_netmount ()
        [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
        export HOSTNAME
 
+       # Check if we have a network device at all
+       if ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
+          ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
+          ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
+          ! ls /sys/class/net/ra0 > /dev/null 2>&1
+       then
+               panic "No supported network device found, maybe a non-mainline driver is required."
+       fi
+
        if [ "${NFSROOT}" = "auto" ]
        then
                NFSROOT=${ROOTSERVER}:${ROOTPATH}
@@ -708,7 +736,7 @@ do_httpmount ()
 {
        rc=1
        dest="${mountpoint}/${LIVE_MEDIA_PATH}"
-       mount -n -t ramfs ram "${mountpoint}"
+       mount -t ramfs ram "${mountpoint}"
        mkdir -p "${dest}"
 
        for webfile in HTTPFS FTPFS FETCH
@@ -779,11 +807,13 @@ do_nfsmount ()
 
        log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
 
-       # FIXME: This for loop is an ugly HACK round an nfs bug
-       for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
+       # FIXME: This while loop is an ugly HACK round an nfs bug
+       i=0
+       while [ "$i" -lt 60 ]
        do
                nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
                sleep 1
+               i="$(($i + 1))"
        done
 
        return ${rc}
@@ -826,10 +856,10 @@ do_snap_copy ()
                # look for free mem
                if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
                then
-                       todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
-                       freespace=$(df -k  | grep -s ${todev} | awk '{print $4}')
+                       todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts)
+                       freespace=$(df -k | awk '/'${todev}'/{print $4}')
                else
-                       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 '/\<Cached/{print $2}' /proc/meminfo))
                fi
 
                tomount="/mnt/tmpsnap"
@@ -844,7 +874,7 @@ do_snap_copy ()
                if [ -n "${fstype}" ]
                then
                        # Copying stuff...
-                       mount -n -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
+                       mount -o ro -t "${fstype}" "${fromdev}" "${tomount}" || log_warning_msg "Error in mount -t ${fstype} -o ro ${fromdev} ${tomount}"
                        cp -a "${tomount}"/* ${todir}
                        umount "${tomount}"
                else
@@ -866,72 +896,102 @@ do_snap_copy ()
        fi
 }
 
+find_snap ()
+{
+       # Look for ${snap_label}.* in block devices
+       snap_label="${1}"
+
+       if [ "${PERSISTENT}" != "nofiles" ]
+       then
+               # search for image files
+               snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
+       fi
+
+       if [ -z "${snapdata}" ]
+       then
+               snapdata=$(find_cow_device "${snap_label}")
+       fi
+       echo "${snapdata}"
+}
+
 try_snap ()
 {
-       # Look for ${snap_label}.* in block devices and copy the contents to ${snap_mount}
+        # copy the contents of previously found snapshot to ${snap_mount}
        # and remember the device and filename for resync on exit in live-initramfs.init
 
-       snap_label="${1}"
+       snapdata="${1}"
        snap_mount="${2}"
        snap_type="${3}"
-       snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
 
        if [ ! -z "${snapdata}" ]
        then
+               log_success_msg "found snapshot: ${snapdata}"
                snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
                snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
                snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
 
+               RES=""
+               if ! try_mount "${snapdev}" "${snapback}" "ro"
+               then
+                       break
+               fi
+
                if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|jffs2\)'
                then
                        # squashfs, jffs2 or ext2/ext3 snapshot
                        dev=$(get_backing_device "${snapback}/${snapfile}")
 
-                       if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
-                       then
-                               log_warning_msg "Impossible to include the ${snapfile} Snapshot"
-                               return 1
-                       fi
+                       do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
+                       RES=$?
                else
                        # cpio.gz snapshot
-                       if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1)
+                       cd "${snap_mount}"
+                       zcat "${snapback}/${snapfile}" | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1
+                       RES=$?
+                       if [ "${RES}" != "0" ]
                        then
-                               log_warning_msg "Impossible to include the ${snapfile} Snapshot"
-                               return 1
+                               log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories\""
                        fi
+                       cd "${OLDPWD}"
                fi
 
-               umount "${snapback}"
-       else
-               dev=$(find_cow_device "${snap_label}")
+               umount "${snapback}" ||  log_warning_msg "failure to \"umount ${snapback}\""
 
-               if [ -b ${dev} ]
+               if [ "${RES}" != "0" ]
                then
-                       if echo "${dev}" | grep -qs loop
-                       then
-                               # strange things happens, user confused?
-                               snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
-                               snapfile=$(basename ${snaploop})
-                               snapdev=$(cat /proc/mounts | awk '{print $2,$1}' | grep -es "^$( dirname ${snaploop} )" | cut -f2 -d ' ')
-                       else
-                               snapdev="${dev}"
-                       fi
+                       log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
+               fi
 
-                       if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
-                       then
-                               log_warning_msg "Impossible to include the ${snap_label} Snapshot"
-                               return 1
-                       else
-                               if [ -n "${snapfile}" ]
-                               then
-                                       # it was a loop device, user confused
-                                       umount ${snapdev}
-                               fi
-                       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}"
+               if echo "${dev}" | grep -qs loop
+               then
+                       # strange things happens, user confused?
+                       snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
+                       snapfile=$(basename ${snaploop})
+                       snapdev=$(awk -v pat="$( dirname ${snaploop})" '$2 == pat { print $1 }' /proc/mounts)
                else
-                       log_warning_msg "Impossible to include the ${snap_label} Snapshot"
+                       snapdev="${dev}"
+               fi
+
+               if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
+               then
+                       log_warning_msg "Impossible to include the ${snap_type} Snapshot"
                        return 1
+               else
+                       if [ -n "${snapfile}" ]
+                       then
+                               # it was a loop device, user confused
+                               umount ${snapdev}
+                       fi
                fi
+       else
+               log_warning_msg "Impossible to include the ${snap_type} Snapshot"
+               return 1
        fi
 
        echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
@@ -1040,9 +1100,15 @@ setup_unionfs ()
                                panic "Unknown file system type on ${backdev} (${image})"
                        fi
 
+                       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 -n -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}"
+                       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
@@ -1086,7 +1152,30 @@ setup_unionfs ()
                        fi
                done
 
+               # search for label and files (this could be hugely optimized)
                cowprobe=$(find_cow_device "${root_persistence}")
+               if [ -b "${cowprobe}" ]
+               then
+                       # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots
+                       # makes sense to have both persistence for /cow and /home mounted, maybe also with
+                       # snapshots to be sure to really store some e.g key config files,
+                       # but not on the same media
+                       blacklistdev="${cowprobe}"
+                       PERSISTENCE_IS_ON="1"
+                       export PERSISTENCE_IS_ON
+               fi
+               # homecow just mount something on /home, this should be generalized some way
+               homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}")
+               if [ -b "${homecow}" ]
+               then
+                       PERSISTENCE_IS_ON="1"
+                       export PERSISTENCE_IS_ON
+               fi
+               root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}")
+               # This second type should be removed when snapshot will get smarter,
+               # hence when "/etc/live-snapshot*list" will be supported also by
+               # ext2|ext3|jffs2 snapshot types.
+               home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}")
 
                if [ -b "${cowprobe}" ]
                then
@@ -1131,7 +1220,7 @@ setup_unionfs ()
                nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
                        panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
        else
-               mount -n -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
+               mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
                        panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
        fi
 
@@ -1145,7 +1234,7 @@ setup_unionfs ()
                fi
                exposedrootfs=${rofslist%% }
 
-               mount -n --bind ${exposedrootfs} ${rootmnt} || \
+               mount --bind ${exposedrootfs} ${rootmnt} || \
                        panic "bind mount of ${exposedrootfs} failed"
 
                cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
@@ -1153,14 +1242,14 @@ setup_unionfs ()
 
                for dir in ${cow_dirs}; do
                        mkdir -p /cow${dir}
-                       mount -n -t ${UNIONTYPE} \
+                       mount -t ${UNIONTYPE} \
                                -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
                                ${UNIONTYPE} "${rootmnt}${dir}" || \
                                panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
                                        rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
                done
        else
-               mount -n -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
+               mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
                        ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
                        ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
        fi
@@ -1168,26 +1257,26 @@ setup_unionfs ()
        # tmpfs file systems
        touch /etc/fstab
        mkdir -p "${rootmnt}/live"
-       mount -n -t tmpfs tmpfs ${rootmnt}/live
+       mount -t tmpfs tmpfs ${rootmnt}/live
 
        # Adding other custom mounts
        if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
        then
                # directly mount /home
                # FIXME: add a custom mounts configurable system
-               homecow=$(find_cow_device "${home_persistence}" )
 
                if [ -b "${homecow}" ]
                then
-                       mount -n -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
+                       mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
                        export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
                else
                        log_warning_msg "Unable to find the persistent home medium"
                fi
 
                # Look for other snapshots to copy in
-               try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
-               try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
+               try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
+               # This second type should be removed when snapshot grow smarter
+               try_snap "${home_snapdata}" "${rootmnt}/home" "HOME"
        fi
 
        if [ -n "${SHOWMOUNTS}" ]
@@ -1202,7 +1291,7 @@ setup_unionfs ()
                                        ;;
 
                                *)
-                                       mount -n -o move "${d}" "${rootmnt}/live/${d##*/}"
+                                       mount -o move "${d}" "${rootmnt}/live/${d##*/}"
                                        ;;
                        esac
                done
@@ -1210,7 +1299,7 @@ setup_unionfs ()
 
        # shows cow fs on /cow for use by live-snapshot
        mkdir -p "${rootmnt}/live/cow"
-       mount -n -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -n -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
+       mount -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
 }
 
 check_dev ()
@@ -1226,7 +1315,7 @@ check_dev ()
 
        if [ -d "${devname}" ]
        then
-               mount -n -o bind "${devname}" $mountpoint || continue
+               mount -o bind "${devname}" $mountpoint || continue
 
                if is_live_path $mountpoint
                then
@@ -1247,7 +1336,7 @@ check_dev ()
 
        if is_supported_fs ${fstype}
        then
-               mount -n -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
+               mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
 
                if is_live_path ${mountpoint} && \
                        ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
@@ -1290,7 +1379,7 @@ find_livefs ()
        fi
 
        # or do the scan of block devices
-       for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-' | grep -v fd )
+       for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
        do
                devname=$(sys2dev "${sysblock}")
                fstype=$(get_fstype "${devname}")
@@ -1332,12 +1421,13 @@ set_usplash_timeout ()
        if [ -x /sbin/usplash_write ]
        then
                /sbin/usplash_write "TIMEOUT 120"
-       fi
+       else if [ -x /sbin/splashy_update ] ; then
+               /sbin/splashy_update "TIMEOUT 120"
+       fi ; fi
 }
 
 mountroot ()
 {
-    
         if [ -x /scripts/local-top/cryptroot ]; then
            /scripts/local-top/cryptroot
        fi
@@ -1350,11 +1440,13 @@ mountroot ()
        tailpid="${!}"
 
        # Ensure 'panic' function is overridden
-       . /scripts/live-functions
+       . /scripts/live-functions
 
        Arguments
 
        set_usplash_timeout
+
+       maybe_break live-premount
        log_begin_msg "Running /scripts/live-premount"
        run_scripts /scripts/live-premount
        log_end_msg
@@ -1379,7 +1471,8 @@ mountroot ()
                        livefs_root=${ROOT}
                else
                        # Scan local devices for the image
-                       for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+                       i=0
+                       while [ "$i" -lt 60 ]
                        do
                                livefs_root=$(find_livefs ${i})
 
@@ -1389,6 +1482,7 @@ mountroot ()
                                fi
 
                                sleep 1
+                               i="$(($i + 1))"
                        done
                fi
        fi
index a8717d7..ce151e1 100755 (executable)
@@ -30,7 +30,7 @@ log_begin_msg "Moving mount points"
 if [ ! -d /root/live/image ]
 then
        mkdir -p /root/live/image
-       mount -n --move /live/image /root/live/image
+       mount --move /live/image /root/live/image
 fi
 
 log_end_msg
index 29a080f..b14703a 100755 (executable)
@@ -31,9 +31,19 @@ log_begin_msg "Setting hostname"
 
 # live-initramfs script
 
-echo "${HOSTNAME}" > /root/etc/hostname
+# Change hostname only if it is not set
+if [ ! -f /root/etc/hostname ] || grep -qs localhost\.localdomain /root/etc/hostname
+then
+       echo "${HOSTNAME}" > /root/etc/hostname
+else
+       HOSTNAME="$(cat /root/etc/hostname)"
+       really_export HOSTNAME
+fi
 
-cat >> /root/etc/hosts << EOF
+# Create /etc/hosts only if it is not present or empty
+if [ ! -s /root/etc/hosts ]
+then
+       cat > /root/etc/hosts << EOF
 127.0.0.1 localhost
 127.0.1.1 ${HOSTNAME}
 
@@ -45,6 +55,7 @@ ff02::1 ip6-allnodes
 ff02::2 ip6-allrouters
 ff02::3 ip6-allhosts
 EOF
+fi
 
 hostname "${HOSTNAME}"
 
diff --git a/scripts/live-bottom/08persistence_excludes b/scripts/live-bottom/08persistence_excludes
new file mode 100755 (executable)
index 0000000..b7aac92
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# Persistence enhancer script
+# This script saves precious time on slow persistence devices/image files
+# and writes on flash based device.
+# a tmpfs on $PERSTMP is mounted and directories listed in
+# /etc/live-persistence.binds will be copied there and then bind mounted back.
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+       echo "${PREREQ}"
+}
+
+case "${1}" in
+       prereqs)
+               prereqs
+               exit 0
+               ;;
+esac
+
+# live-initramfs header
+
+if [ -z "${PERSISTENT}" ] || [ -n "${NOPERSISTENT}" ] || [ -z "${PERSISTENCE_IS_ON}" ] || [ ! -f /root/etc/live-persistence.binds ]
+then
+       exit 0
+fi
+
+. /scripts/live-functions
+
+# live-initramfs script
+
+dirs="$(sed -e '/^ *$/d' -e '/^#.*$/d' /root/etc/live-persistence.binds | tr '\n' '\0')"
+if [ -z "${dirs}" ]
+then
+       exit 0
+fi
+
+log_begin_msg "Moving persistence bind mounts"
+
+PERSTMP="/root/live/persistence-binds"
+CPIO="/bin/cpio"
+
+if [ ! -d "${PERSTMP}" ]
+then
+       mkdir -p "${PERSTMP}"
+fi
+
+mount -t tmpfs tmpfs "${PERSTMP}"
+
+for dir in $(echo "${dirs}" | tr '\0' '\n')
+do
+       if [ ! -e "/root/${dir}" ] && [ ! -L "/root/${dir}" ]
+       then
+               # directory do not exists, create it
+               mkdir -p "/root/${dir}"
+       elif [ ! -d "/root/${dir}" ]
+       then
+               # it is not a directory, skip it
+               break
+       fi
+
+       # Copy previous content if any
+       cd "/root/${dir}"
+       find . -print0 | ${CPIO} -pumd0 "${PERSTMP}/${dir}"
+       cd "${OLDPWD}"
+
+       # Bind mount it to origin
+       mount -o bind "${PERSTMP}/${dir}" "/root/${dir}"
+done
+
+log_end_msg
index 7498476..4c0fe80 100755 (executable)
@@ -58,6 +58,28 @@ set passwd/username
 set passwd/user-uid
 EOF
 
+if ! grep "${USERNAME}" /root/etc/passwd
+then
+       echo "The default user (${USERNAME}) is not present,"
+       first_user=$(grep '^[^:]*:[^:]*:[12]\?[0-9][0-9][0-9][0-9]:' /root/etc/passwd | head -1 | cut -f1 -d ':')
+       if [ -n "${first_user}" ];
+       then
+               echo "setting default user to: ${first_user}."
+               USERNAME="${first_user}"
+               really_export USERNAME
+       else
+               echo "no other valid users found, disabling autologin."
+               NOAUTOLOGIN="Yes"
+               NOXAUTOLOGIN="Yes"
+               USERNAME=""
+               really_export NOAUTOLOGIN
+               really_export NOXAUTOLOGIN
+               really_export USERNAME
+               log_end_msg
+               exit 0
+       fi
+fi
+
 if [ -z "${NOSUDO}" ]
 then
        if ! grep -q "${USERNAME}" /root/etc/sudoers
index ee242a4..f38eee7 100755 (executable)
@@ -32,7 +32,10 @@ log_begin_msg "Configuring fstab"
 
 # live-initramfs script
 
-cat >> ${FSTAB} << EOF
+# Create a fake fstab only if it is not already there
+if [ ! -f "${FSTAB}" ] || grep -qs 'UNCONFIGURED FSTAB FOR BASE SYSTEM' "${FSTAB}"
+then
+       cat >> ${FSTAB} << EOF
 # /etc/fstab: static file system information.
 #
 # <file system> <mount point>   <type>  <options>       <dump>  <pass>
@@ -40,6 +43,7 @@ cat >> ${FSTAB} << EOF
 ${UNIONTYPE} / ${UNIONTYPE} rw 0 0
 tmpfs /tmp tmpfs nosuid,nodev 0 0
 EOF
+fi
 
 # disabled for now
 #rm -f /root/etc/rcS.d/S*checkroot.sh
index ecbdce1..8fc718c 100755 (executable)
@@ -20,7 +20,7 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOSWAP}" ] || [ -n "${NOFSTAB}" ]
+if [ -z "${SWAPON}" ] || [ -n "${NOFSTAB}" ]
 then
        exit 0
 fi
@@ -41,7 +41,7 @@ do
                continue
        fi
 
-       /lib/udev/vol_id ${device%%[0-9]*} | grep -q "^ID_FS_USAGE=raid" && continue
+       /lib/udev/vol_id ${device%%[0-9]*} 2>/dev/null | 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
 
index bb9902e..7fb2b13 100755 (executable)
@@ -20,7 +20,9 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOXAUTOLOGIN}" ]
+. /live.vars
+
+if [ -n "${NOXAUTOLOGIN}" ] || [ -z "${USERNAME}" ]
 then
        exit 0
 fi
index 5f1d9e7..2bf0b1c 100755 (executable)
@@ -89,6 +89,9 @@ then
                live-preseed /root console-setup/modelcode '' false
        fi
 
+       live-preseed /root console-setup/optionscode '' false
+       live-preseed /root console-setup/codesetcode '' false
+
        sed -i 's/CONSOLE_SCREEN=$/CONSOLE_SCREEN=setupcon/; t END; b; : END; n; b END' /root/etc/init.d/usplash
 else
        chroot /root /usr/sbin/install-keymap ${kbd}
index 3e927a3..947b7ec 100755 (executable)
@@ -50,9 +50,9 @@ log_begin_msg "Configuring X"
 
 locale=en_US.UTF-8
 
-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
 
 if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]
 then
index 075a53e..5232f5f 100755 (executable)
@@ -38,9 +38,9 @@ log_begin_msg "Configuring X video driver"
 
 if [ -n "$XDRIVER" ]
 then
-       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
 
 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
 set xserver-xorg/autodetect_video_card false
index 24116e9..23eb212 100755 (executable)
@@ -38,9 +38,9 @@ log_begin_msg "Configuring X video modes"
 
 if [ -n "$XVIDEOMODE" ]
 then
-       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
 
 chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
 set xserver-xorg/config/monitor/mode-list ${XVIDEOMODE}
index 9767e45..bd0be26 100755 (executable)
@@ -41,7 +41,7 @@ fi
 
 panel_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-panel-data 2>/dev/null) || panel_version=""
 
-if [ -n "${panel_version}" ]
+if [ -n "${panel_version}" ] && [ -n "${USERNAME}" ]
 then
        chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true
 fi
index 7753154..3f88e2f 100755 (executable)
@@ -27,6 +27,12 @@ fi
 
 . /scripts/live-functions
 
+if [ -z "${USERNAME}" ]
+then
+       echo "No default user for accessibility options."
+       exit 0
+fi
+
 log_begin_msg "Configuring accessibility options"
 
 # live-initramfs script
@@ -62,9 +68,11 @@ case ${ACCESS} in
                # Moderate Visual Impairment
                gct -s -t bool /desktop/gnome/interface/accessibility true
                gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+               gct -s -t string /desktop/gnome/applications/at/visual/exec orca
                gct -s -t bool /apps/gksu/disable-grab true
+               gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
 
-               if type orca > /dev/null 2>&1
+               if [ -x /root/usr/bin/orca ]
                then
                        mkdir -p /root/home/${USERNAME}/.orca
                        echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
@@ -80,18 +88,21 @@ case ${ACCESS} in
                #gct -s -t bool /desktop/gnome/sound/enable_esd false
                gct -s -t bool /desktop/gnome/interface/accessibility true
                gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+               gct -s -t string /desktop/gnome/applications/at/visual/exec orca
                gct -s -t bool /apps/gksu/disable-grab true
                gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
+
                ;;
 
        braille=ask)
                # Braille
                gct -s -t bool /desktop/gnome/interface/accessibility true
                gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+               gct -s -t string /desktop/gnome/applications/at/visual/exec orca
                gct -s -t bool /apps/gksu/disable-grab true
                gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
 
-               if type orca > /dev/null 2>&1
+               if [ -x /root/usr/bin/orca ]
                then
                        mkdir -p /root/home/${USERNAME}/.orca
                        echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
index 8c9eb9a..f4960e6 100755 (executable)
@@ -33,7 +33,7 @@ log_begin_msg "Configuring power management"
 
 gpm_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-power-manager 2>/dev/null) || panel_version=""
 
-if [ -n "${gpm_version}" ]
+if [ -n "${gpm_version}" ] && [ -n "${USERNAME}" ]
 then
        #live-reconfigure /root gnome-power-manager
        # Gnome < 2.20
diff --git a/scripts/live-bottom/38disable_restricted_manager b/scripts/live-bottom/38disable_restricted_manager
deleted file mode 100755 (executable)
index d585d3c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-PREREQ=""
-
-prereqs()
-{
-       echo "$PREREQ"
-}
-
-case $1 in
-# get pre-requisites
-prereqs)
-       prereqs
-       exit 0
-       ;;
-esac
-
-if [ -n "${NORESTRICTEDMANAGER}" ]
-then
-       exit 0
-fi
-
-. /scripts/live-functions
-
-log_begin_msg "Disabling restricted-manager"
-
-rm -f /root/etc/xdg/autostart/restricted-manager.desktop
-rm -f /root/etc/xdg/autostart/restricted-manager-kde.desktop
-
-# Since we disable restricted-manager, there isn't much point generating the
-# fglrx or nvidia modules either. The other restricted modules may still be
-# useful.
-if [ -e /root/etc/default/linux-restricted-modules-common ]
-then
-       sed -i 's/^DISABLED_MODULES=""/DISABLED_MODULES="fglrx nv"/' \
-               /root/etc/default/linux-restricted-modules-common
-fi
-
-log_end_msg
diff --git a/scripts/live-bottom/38jockey_disable_check b/scripts/live-bottom/38jockey_disable_check
new file mode 100755 (executable)
index 0000000..1a642e1
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+       echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+if [ -n "${NOJOCKEY}" ]
+then
+       exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling jockey driver check"
+
+rm -f /root/etc/xdg/autostart/jockey*.desktop
+
+log_end_msg
index 7fd026e..fec6401 100755 (executable)
@@ -40,10 +40,19 @@ cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
        <match user="root">
                <return result="yes"/>
        </match>
+EOF
+
+if [ -n "${USERNAME}" ]
+then
+       cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
        <!-- don't ask password for user in live session -->
        <match user="$USERNAME">
                <return result="yes"/>
        </match>
+EOF
+fi
+
+cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
        <define_admin_auth group="admin"/>
 </config>
 EOF
index 0684dc0..8bf9c38 100644 (file)
@@ -2,47 +2,6 @@
 . /scripts/functions
 . /live.vars
 
-# Override log_*_msg until #494257 is merged
-
-_log_msg()
-{
-       if [ "$quiet" = "y" ]; then return; fi
-       printf "$@"
-}
-
-log_success_msg()
-{
-       _log_msg "Success: $@\n"
-}
-
-log_failure_msg()
-{
-       _log_msg "Failure: $@\n"
-}
-
-log_warning_msg()
-{
-       _log_msg "Warning: $@\n"
-}
-
-log_begin_msg()
-{
-       if [ -x /sbin/usplash_write ]; then
-               /sbin/usplash_write "TEXT $@"
-       fi
-       _log_msg "Begin: $@ ... "
-}
-
-log_end_msg()
-{
-       if [ -x /sbin/usplash_write ]; then
-               /sbin/usplash_write "SUCCESS ok"
-       fi
-       _log_msg "done.\n"
-}
-
-##
-
 log_wait_msg ()
 {
        # Print a message and wait for enter
@@ -50,7 +9,9 @@ log_wait_msg ()
        then
                /sbin/usplash_write "INPUTENTER ${@}"
                read nunya < /dev/.initramfs/usplash_outfifo
-       fi
+       else if [ -x /sbin/splashy_update ] ; then
+               /sbin/splashy_update "getstring ${@}" | read nunya
+       fi ; fi
 
        _log_msg "Waiting: ${@} ... \n"
 }
@@ -60,7 +21,7 @@ really_export ()
        STRING="${1}"
        VALUE="$(eval echo -n \${$STRING})"
 
-       if [ -f /live.vars ] && cat /live.vars | grep -sq "export ${STRING}"
+       if [ -f /live.vars ] && grep -sq "export ${STRING}" /live.vars
        then
                sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars
        else
@@ -99,6 +60,16 @@ lang2locale() {
        fi
 }
 
+# Override maybe_break from scripts/functions
+maybe_break()
+{
+       if [ "${break}" = "$1" ]; then
+               # Call original panic
+               . /scripts/functions
+               panic "Spawning shell within the initramfs"
+       fi
+}
+
 # Override panic from scripts/functions
 panic() {
 
@@ -122,9 +93,8 @@ panic() {
        printf "     ${DEB_4}  This Debian Live image failed to boot.\n\n"
 
        printf "  Please file a bug against the 'live-initramfs' package or email the Debian\n"
-       printf "  Live mailing list at <debian-live-devel@lists.alioth.debian.org>, making\n"
-       printf "  sure to note the exact version, name and distribution of the image you were\n"
-       printf "  attempting to boot.\n\n"
+       printf "  Live mailing list at <debian-live@lists.debian.org>, making sure to note the\n"
+       printf "  exact version, name and distribution of the image you were attempting to boot.\n\n"
 
        printf "  The file ${LIVELOG} contains some debugging information but booting with the\n"
        printf "  ${DEBUG} command-line parameter will greatly increase its verbosity which is\n"
index 70c7f34..f6b8b8b 100644 (file)
@@ -77,7 +77,7 @@ get_fstype ()
            return
        fi
 
-       eval $(fstype < ${1})
+       eval $(fstype < ${1} 2>/dev/null)
 
        if [ "${FSTYPE}" != "unknown" ]
        then
@@ -146,7 +146,7 @@ fs_size ()
                        mountp="/mnt/tmp_fs_size"
 
                        mkdir -p "${mountp}"
-                       mount -n -t $(get_fstype "${dev}") -o ro "${dev}" "${mountp}"
+                       mount -t $(get_fstype "${dev}") -o ro "${dev}" "${mountp}" || log_warning_msg "cannot mount -t $(get_fstype ${dev}) -o ro ${dev} ${mountp}"
 
                        doumount=1
                fi
@@ -163,7 +163,7 @@ fs_size ()
 
        if [ -n "${doumount}" ]
        then
-               umount "${mountp}"
+               umount "${mountp}" || log_warning_msg "cannot umount ${mountp}"
                rmdir "${mountp}"
        fi
 
@@ -269,22 +269,35 @@ try_mount ()
        dev="${1}"
        mountp="${2}"
        opts="${3}"
+       fstype="${4}"
 
        old_mountp="$(where_is_mounted ${dev})"
 
        if [ -n "${old_mountp}" ]
        then
-               mount -n -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed"
-               mount -n -o bind "${old_mountp}" "${mountp}" || panic "Cannot bind-mount ${old_mountp} on ${mountp}"
+               if [ "${opts}" != "ro" ]
+               then
+                       mount -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed"
+               fi
+
+               mount -o bind "${old_mountp}" "${mountp}" || panic "Cannot bind-mount ${old_mountp} on ${mountp}"
        else
-               mount -n -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}"
+               if [ -z "${fstype}" ]
+               then
+                       fstype=$(get_fstype "${dev}")
+               fi
+               mount -t "${fstype}" -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}, fstype=${fstype}, options=${opts}"
        fi
 }
 
 find_cow_device ()
 {
+       # Returns a device containing a partition labeled "${pers_label}" or containing a file named the same way
+       #  in the latter case the partition containing the file is left mounted
+       #  if is not in black_listed_devices
        pers_label="${1}"
        cow_backing="/${pers_label}-backing"
+       black_listed_devices="${2}"
 
        for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
        do
@@ -292,16 +305,32 @@ find_cow_device ()
                do
                        devname=$(sys2dev "${dev}")
 
+                       if echo "${black_listed_devices}" | grep -q "${devname}"
+                       then
+                               # skip this device enterely
+                               break
+                       fi
+
                        if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${pers_label}" ]
                        then
                                echo "${devname}"
                                return
                        fi
 
+                       if [ "${PERSISTENT}" = "nofiles" ]
+                       then
+                               # do not mount the device to find for image files
+                               # just skip this
+                               break
+                       fi
+
                        case "$(get_fstype ${devname})" in
                                vfat|ext2|ext3|jffs2)
                                        mkdir -p "${cow_backing}"
-                                       try_mount "${devname}" "${cow_backing}" "rw"
+                                       if ! try_mount "${devname}" "${cow_backing}" "rw"
+                                       then
+                                               break
+                                       fi
 
                                        if [ -f "${cow_backing}/${pers_label}" ]
                                        then
@@ -320,11 +349,12 @@ find_cow_device ()
 
 find_files ()
 {
-       # return the first of ${filenames} found on vfat and ext2/ext3 devices
+       # return the a string composed by device name, mountpoint an the first of ${filenames} found on a supported partition
        # FIXME: merge with above function
 
        filenames="${1}"
        snap_backing="/snap-backing"
+       black_listed_devices="${2}"
 
        for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
        do
@@ -333,19 +363,28 @@ find_files ()
                        devname=$(sys2dev "${dev}")
                        devfstype="$(get_fstype ${devname})"
 
+                       if echo "${black_listed_devices}" | grep -q "${devname}"
+                       then
+                               # skip this device enterely
+                               break
+                       fi
+
                        if is_supported_fs ${devfstype}
                        then
                                mkdir -p "${snap_backing}"
-                               try_mount "${devname}" "${snap_backing}" "ro"
 
-                               for filename in ${filenames}
+                               if try_mount "${devname}" "${snap_backing}" "ro" "${devfstype}"
+                               then
+                                       for filename in ${filenames}
                                        do
-                                       if [ -f "${snap_backing}/${filename}" ]
-                                       then
-                                               echo "${devname} ${snap_backing} ${filename}"
-                                               return 0
-                                       fi
-                               done
+                                               if [ -f "${snap_backing}/${filename}" ]
+                                               then
+                                                       echo "${devname} ${snap_backing} ${filename}"
+                                                       umount ${snap_backing}
+                                                       return 0
+                                               fi
+                                       done
+                               fi
 
                                umount ${snap_backing}
                        fi