From 4042b2eda2107dda511a29ae376d9724e0fd7a33 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 14:46:25 +0200 Subject: [PATCH] Adding casper 1.71+debian-1. --- bin/casper-snapshot | 226 ++++++++++++++++++++++++ debian/casper.init | 12 +- debian/casper.install | 1 + debian/casper.manpages | 1 + debian/changelog | 8 + debian/changelog.upstream | 35 +++- debian/control | 1 + debian/control.debian | 1 + debian/control.ubuntu | 2 + debian/manpage/casper-snapshot.1 | 55 ++++++ debian/manpage/casper.7 | 19 +- debian/rules | 5 + hooks/casper | 2 + scripts/casper | 89 ++++++---- scripts/casper-bottom/05mountpoints | 2 +- scripts/casper-bottom/10adduser | 2 +- scripts/casper-bottom/12fstab | 2 +- scripts/casper-bottom/13swap | 2 +- scripts/casper-bottom/14locales | 2 +- scripts/casper-bottom/15autologin | 2 +- scripts/casper-bottom/18hostname | 2 +- scripts/casper-bottom/19keyboard | 4 +- scripts/casper-bottom/20xconfig | 2 +- scripts/casper-bottom/22gnome_panel_data | 2 +- scripts/casper-bottom/22screensaver | 2 +- scripts/casper-bottom/23etc_modules | 2 +- scripts/casper-bottom/23networking | 2 +- scripts/casper-bottom/24preseed | 5 +- scripts/casper-bottom/25configure_init | 2 +- scripts/casper-bottom/30accessibility | 2 +- scripts/casper-bottom/31disable_update_notifier | 2 +- scripts/casper-bottom/32disable_hibernation | 2 +- scripts/casper-bottom/33disable_binary_drivers | 4 +- scripts/casper-bottom/34disable_kwallet | 25 +++ scripts/casper-bottom/35fix_language_selector | 28 +++ scripts/casper-functions | 12 ++ 36 files changed, 493 insertions(+), 74 deletions(-) create mode 100644 bin/casper-snapshot create mode 100644 debian/manpage/casper-snapshot.1 create mode 100755 scripts/casper-bottom/34disable_kwallet create mode 100755 scripts/casper-bottom/35fix_language_selector create mode 100644 scripts/casper-functions diff --git a/bin/casper-snapshot b/bin/casper-snapshot new file mode 100644 index 0000000..d49034c --- /dev/null +++ b/bin/casper-snapshot @@ -0,0 +1,226 @@ +#!/bin/sh + +# casper-snapshot - utility to do Debian Live systems snapshots +# +# This program mount a /tmpfs under ~/Desktop and save the /cow +# filesystem in it for reusing in another session. +# +# Copyright (C) 2006 Marco Amadori +# +# 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 +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# 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 +# +# On Debian systems, the complete text of the GNU General Public License +# can be found in /usr/share/common-licenses/GPL file. + +PROGRAM="`basename ${1}`" +VERSION=0.0.1 + +# Source casper conf +if [ -e /etc/casper.conf ]; then + . /etc/casper.conf +else + USERNAME=`cat /etc/passwd | grep "999" | cut -f1 -d ':'` +fi + +Header () +{ + echo "${PROGRAM} - utility to do Debian Live snapshots" + echo + echo "Usage: ${PROGRAM} [-c|--cow DIRECTORY] [-d|--dest DIRECTORY] [-o|--output FILE] [-t|--type TYPE]" + echo "Usage: ${PROGRAM} [-h|--help]" + echo "Usage: ${PROGRAM} [-u|--usage]" + echo "Usage: ${PROGRAM} [-v|--version]" +} + +Usage () +{ + MESSAGE=${1} + Header + echo + echo "Try \"${PROGRAM} --help\" for more information." + if [ ! -z "${MESSAGE}" ]; then + echo -e "${MESSAGE}" + exit 1 + else + exit 0 + fi +} + +Help () +{ + Header + echo + echo "Options:" + echo " -c, --cow: specifies the copy on write directory (default: /cow)." + echo " -d, --destination: specifies the output snapshot directory (default: /home/\$USERNAME/Desktop/casper-snapshot)." + echo " -o, --output: specifies the output image file (default: $type dependent)." + echo " -t,--type: specifies the snapshot type between \'squashfs\', \'ext2\' or \'cpio\'.gz archive (default: cpio)" + exit 0 +} + +Version () +{ + echo "${PROGRAM}, version ${VERSION}" + echo + echo "Copyright (C) 2006 Marco Amadori " + echo + echo "This program is free software; you can redistribute it and/or modify" + echo "it under the terms of the GNU General Public License as published by" + echo "the Free Software Foundation; either version 2 of the License, or" + echo "(at your option) any later version." + echo + echo "This program is distributed in the hope that it will be useful," + echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" + echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" + echo "GNU General Public License for more details." + echo + echo "You should have received a copy of the GNU General Public License" + echo "along with this program; if not, write to the Free Software" + echo "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA" + echo + echo "On Debian systems, the complete text of the GNU General Public License" + echo "can be found in /usr/share/common-licenses/GPL file." + echo + echo "Homepage: " + exit 0 +} + +Do_snapshot () +{ + case "${TYPE}" in + squashfs) + mksquashfs "${COW}" "${DEST}" || exit 1 + ;; + cpio) + (cd "${COW}" && find . | cpio --quiet -o -H newc | gzip -9 > "${DEST}") || exit 1 + ;; + ext2) + DU_DIM="`du -ks ${COW} | cut -f1`" + REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here... + genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${COW}" "${DEST}" || exit 1 + ;; + *) + echo "Internal error." + exit 1 + ;; + esac +} + +Lastline() +{ + while read lines ; do + line=${lines} + done + echo "${line}" +} + +Base_path () +{ + testpath="${1}" + mounts="`awk '{print $2}' /proc/mounts`" + testpath="`realpath ${testpath}`" + + while true ; do + if echo "${mounts}" | grep -qs "^${testpath}" ; then + set -- `echo "${mounts}" | grep "^${testpath}" | Lastline` + echo ${1} + break + else + testpath=`dirname $testpath` + fi + done +} + +Is_same_mount () +{ + dir1="`Base_path ${1}`" + dir2="`Base_path ${2}`" + if [ "${dir1}" == "${dir2}" ]; then + return 0 + else + return 1 + fi +} + +Parse_args () +{ + # Parse command line + ARGUMENTS="`getopt --longoptions cow:,destination:,output:,type:,help,usage,version --name=${PROGRAM} --options c:d:o:t:,h,u,v --shell sh -- ${@}`" + + if [ "${?}" != "0" ]; then + echo "Terminating." >&2 + exit 1 + fi + + eval set -- "${ARGUMENTS}" + + while true; do + case "${1}" in + -c|--cow) + SNAP_COW="${2}"; shift 2 ;; + -d|--destination) + SNAP_DEST="${2}"; shift 2 ;; + -o|--output) + SNAP_OUTPUT="${2}"; shift 2 ;; + -t|--type) + SNAP_TYPE="${2}"; shift 2 ;; + -h|--help) + Help; shift ;; + -u|--usage) + Usage ; shift ;; + -v|--version) + Version; shift ;; + --) + shift; break ;; + *) + echo "Internal error."; exit 1 ;; + esac + done +} + +Defaults () +{ + DEF_COW="/cow" + + # Bad options handling + if [ -z "${SNAP_COW}" ]; then + COW="${DEF_COW}" + else + COW="${SNAP_COW}" + fi + if [ ! -d "${COW}" ]; then + Usage "Error: ${COW} is not a directory\nMaybe you booted with \"hide-cow\" as kernel parameter?" + fi + + case "${SNAP_TYPE}" in + "cpio"|"squashfs"|"ext2") + TYPE="${SNAP_TYPE}" + ;; + "") + TYPE="cpio" ;; + *) + Usage "Error: unrecognized snapshot type" + ;; + esac +} + +Main () +{ + Parse_args "${@}" + Defaults + Do_snapshot +} + +Main "${@}" diff --git a/debian/casper.init b/debian/casper.init index c69e387..ae1a1a4 100644 --- a/debian/casper.init +++ b/debian/casper.init @@ -64,11 +64,11 @@ do_stop () eject -p -m /live_media >/dev/null 2>&1 # XXX - i18n - echo -n "Please remove the disc and close the tray (if any) then press ENTER: " + echo "Please remove the disc and close the tray (if any) then press ENTER: " if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "TIMEOUT 0" - /sbin/usplash_write "TEXT Please remove the disc, close the tray (if any)" - /sbin/usplash_write "TEXT and press ENTER to continue" + /sbin/usplash_write "TIMEOUT 86400" + /sbin/usplash_write "TEXT-URGENT Please remove the disc, close the tray (if any)" + /sbin/usplash_write "TEXT-URGENT and press ENTER to continue" fi read x < /dev/console @@ -76,8 +76,10 @@ do_stop () case "$1" in start|restart|reload|force-reload|status) + [ "$VERBOSE" != no ] && log_end_msg 0 ;; stop) + log_begin_msg "Caching reboot files..." do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; @@ -85,7 +87,7 @@ case "$1" in esac ;; *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + log_success_msg "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac diff --git a/debian/casper.install b/debian/casper.install index 436f6d2..13d8134 100644 --- a/debian/casper.install +++ b/debian/casper.install @@ -2,5 +2,6 @@ bin/casper-getty sbin bin/casper-login sbin bin/casper-preseed usr/share/casper bin/casper-reconfigure usr/share/casper +bin/casper-snapshot sbin hooks usr/share/initramfs-tools scripts usr/share/initramfs-tools diff --git a/debian/casper.manpages b/debian/casper.manpages index c16a42d..c455a7e 100644 --- a/debian/casper.manpages +++ b/debian/casper.manpages @@ -1 +1,2 @@ debian/manpage/casper.7 +debian/manpage/casper-snapshot.1 diff --git a/debian/changelog b/debian/changelog index e930683..888457b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +casper (1.71+debian-1) unstable; urgency=low + + * New upstream release. + * Added experimental casper-snapshot script and manpage. + * Tagged for debtags project. + + -- Marco Amadori Thu, 28 Sep 2006 16:04:54 +0200 + casper (1.68+debian-3) unstable; urgency=low * Really add casper manpage (Closes: #389867). diff --git a/debian/changelog.upstream b/debian/changelog.upstream index 0f50d72..e9288e9 100644 --- a/debian/changelog.upstream +++ b/debian/changelog.upstream @@ -1,8 +1,39 @@ -casper (1.69) UNRELEASED; urgency=low +casper (1.71) edgy; urgency=low + * Use TEXT-URGENT in shutdown script to make sure we display the "please + remove disc and press enter" text. Malone: #61533 + * Increase usplash timeout since "TIMEOUT 0" no longer means "spin + forever". + * Don't move-mount all the squashfs-es into / since that confuses mono + (and some other apps too). Malone: #62756 + * Disable kwallet by default. Malone: #47743 + * Add -n to language selector to make it not whine about + not-fully-installed langpacks. Malone. #37568 + * Override definition of log_end_msg in casper-functions. Make sure all + casper-bottom scripts use this. + * Pulsate bar in casper-top and casper-bottom. Malone: #61535 + + -- Tollef Fog Heen Wed, 4 Oct 2006 09:52:06 +0200 + +casper (1.70) edgy; urgency=low + + * Check for new file= alias as well as preseed/file= (closes: Malone + #63145). + + -- Colin Watson Wed, 4 Oct 2006 08:59:53 +0100 + +casper (1.69) edgy; urgency=low + + [ Tollef Fog Heen ] * Use grep -E in scripts/casper. Malone: #57620 + * Fix syntax error in accessibility script + + [ Colin Watson ] + * Run 'sh -n' over everything in build target to avoid future syntax + errors. + * Fix check for /etc/default/console-setup (closes: Malone #62775). - -- Tollef Fog Heen Mon, 25 Sep 2006 14:54:57 +0200 + -- Colin Watson Mon, 2 Oct 2006 10:58:19 +0100 casper (1.68) edgy; urgency=low diff --git a/debian/control b/debian/control index 34be909..1999790 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,7 @@ Depends: initramfs-tools (>= 0.40), user-setup, sudo Conflicts: usplash (<< 0.4-27) Recommends: live-package Suggests: dmsetup +Tag: admin::boot, admin::filesystem, implemented-in::shell, protocol::smb, role::plugin, scope::utility, special::completely-tagged, works-with-format::iso9660 Description: Debian Live initramfs generator Casper provides an initramfs generator suited for booting a Debian Live systems from read only media. Useful to build live CDs. diff --git a/debian/control.debian b/debian/control.debian index 34be909..1999790 100644 --- a/debian/control.debian +++ b/debian/control.debian @@ -12,6 +12,7 @@ Depends: initramfs-tools (>= 0.40), user-setup, sudo Conflicts: usplash (<< 0.4-27) Recommends: live-package Suggests: dmsetup +Tag: admin::boot, admin::filesystem, implemented-in::shell, protocol::smb, role::plugin, scope::utility, special::completely-tagged, works-with-format::iso9660 Description: Debian Live initramfs generator Casper provides an initramfs generator suited for booting a Debian Live systems from read only media. Useful to build live CDs. diff --git a/debian/control.ubuntu b/debian/control.ubuntu index 6767acc..77c9cb2 100644 --- a/debian/control.ubuntu +++ b/debian/control.ubuntu @@ -11,6 +11,7 @@ Section: misc Priority: extra Depends: initramfs-tools (>= 0.40ubuntu11), dmsetup, user-setup, sudo Conflicts: usplash (<< 0.4-27) +Tag: admin::boot, admin::filesystem, implemented-in::shell, protocol::smb, role::plugin, scope::utility, special::completely-tagged, works-with-format::iso9660 Description: Run a "live" preinstalled system from read-only media Package: ubiquity-casper @@ -19,6 +20,7 @@ Depends: laptop-detect, sudo Conflicts: espresso-casper Replaces: espresso-casper Enhances: ubiquity +Tag: admin::boot, admin::filesystem, implemented-in::shell, protocol::smb, role::plugin, scope::utility, special::completely-tagged, works-with-format::iso9660 Description: Configuration hooks for live installer This package provides hook scripts for the Ubiquity live installer that repeat some pieces of configuration done by the live system boot process in diff --git a/debian/manpage/casper-snapshot.1 b/debian/manpage/casper-snapshot.1 new file mode 100644 index 0000000..1e17251 --- /dev/null +++ b/debian/manpage/casper-snapshot.1 @@ -0,0 +1,55 @@ +.TH "CASPER-SNAPSHOT" 1 "Thu, 28 Sep 2006" "0.0.1" "User commands" + +.SH NAME +casper-snapshot \- a simple script to ease persistence usage. + +.SH SYNOPSIS +.B casper-snapshot +.RB [\| \-c \||\| \-\-cow +.IR DIRECTORY \|] +.RB [\| \-d \||\| \-\-destination +.IR DIRECTORY \||\| FILE \|] +.RB [\| \-o \||\| \-\-output +.IR FILE \|] +.RB [\| \-t \||\| \-\-type +.IR TYPE \|] +.PP +.B make-live +.RB \-h \||\| \-\-help +.br +.B make-live +.RB \-u \||\| \-\-usage +.br +.B make-live +.RB \-v \||\| \-\-version + +.SH DESCRIPTION +Casper-snapshot is a script useful to build the right types of persistent image files supported by casper. + +.SH OPTIONS +.TP +.BI "\-c, \-\-cow" DIRECTORY +specifies the input directory to be cloned in the image file. +This parameters often does not need to be specified as the default of "/cow" for it should be right for most uses, however it could be handy to specify "/home" and type ext2 for the type to prepare an image file suited to be directly mounted by casper as home. +.TP +.BI "\-d, \-\-destination" DIRECTORY +.TP +.BI "\-o, \-\-output" FILE +.TP +.BI "\-t, \-\-type" TYPE + +.SH BUGS +.B casper-snapshot +Time (and BTS) will tell. + +.SH HOMEPAGE +Debian Live project + +.SH SEE ALSO +.BR casper(7) + +.SH AUTHOR +casper-snapshot was written Marco Amadori . +.TP +This manual page was written by Marco Amadori , +for the Debian project (but may be used by others). diff --git a/debian/manpage/casper.7 b/debian/manpage/casper.7 index c6763cf..1bc0b22 100644 --- a/debian/manpage/casper.7 +++ b/debian/manpage/casper.7 @@ -1,4 +1,4 @@ -.TH CASPER 7 "Mon, 25 Sep 2006" "1.68" "Initramfs-tools hook" +.TH CASPER 7 "Thu, 28 Sep 2006" "1.69" "Initramfs-tools hook" .SH NAME casper \- an hook for initramfs-tools to boot live systems. @@ -8,15 +8,18 @@ casper \- an hook for initramfs-tools to boot live systems. As kernel parameter boot prompt. .SH DESCRIPTION -Casper is an hook for initramfs-tools used to boot live systems like those created by make-live, this includes the Debian-Live isos, netboot tarballs, and usb stick image and Ubuntu live cds. At boot time it will look for a (often read only) media containing a "/casper" directory where root filesystems (often squashfs compressed) lies and create, using unionfs, a writable environment for debian like systems to boot from. +Casper is an hook for initramfs-tools used to generate initramfs able to boot live systems like those created by make-live, this includes the Debian-Live isos, netboot tarballs, and usb stick image and Ubuntu live cds. At boot time it will look for a (often read-only) media containing a "/casper" directory where root filesystems (often squashfs compressed) lies and create, using unionfs, a writable environment for debian like systems to boot from. .SH RECOGNIZED BOOT OPTIONS .TP +.B casper-getty +This enable a special serial login shell (experimental). +.TP .BI "host=" HOSTNAME " , userfullname=" USERFULLNAME " , username=" USERNAME Those parameters lets you override values read from the config file. .TP -.B casper-getty -This enable a special serial login shell (experimental). +.B "showmounts" +Specifying this will make casper to show on "/" the ro filesystems (mostly compressed) on /casper. This is not enabled by default because could lead to problems by application like "mono" which store binary paths on installation. .TP .BI ip= IFACE,ADDRESS,NETMASK,GATEWAY [ :IFACE,ADDRESS,NETMASK,GATEWAY "]*" Let you specify the name(s) and the options of the interface(s) that should be configured at boot time. Do not specify it if you want to use dhcp (default). @@ -32,7 +35,7 @@ This tells casper to look for a network mount, to be specified by parameter "nfs Casper will look for persistent and snapshot partitions or files labeled "casper-rw", "home-rw", "casper-snap*", "home-snap*" and will try to, in order: mount as /cow the first, mount the second in /home, and just copy the contents of the latters in appropriate locations. .TP .B toram -Adding this parameter, casper will try to copy to ram the whole read-only media before mounting the root filesystem(s), it could need a lot of ram, according to the space used by the read only media. +Adding this parameter, casper will try to copy to ram the whole read-only media before mounting the root filesystem(s), it could need a lot of ram, according to the space used by the read-only media. .SH FILES .B /etc/casper.conf @@ -46,10 +49,10 @@ works fully on amd64, i386 and ppc, it should too on other archs. Debian Live project .SH SEE ALSO -.BR initramfs-tools(8), make-live(8), make-live.conf(8) +.BR casper-snapshot(1), initramfs-tools(8), make-live(1), make-live.conf(5) .SH AUTHOR -casper was written by Tollen Fog Heen , Matt Zimmerman , and Marco Amadori , +casper was written by Tollen Fog Heen , Matt Zimmerman , and Marco Amadori . .TP -This manual was written by Marco Amadori , +This manual page was written by Marco Amadori , for the Debian project (but may be used by others). diff --git a/debian/rules b/debian/rules index cb3bb04..9441b3a 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,11 @@ endif # Building package $(MAKE) -C casper-md5check + set -e; \ + for x in bin/* scripts/casper scripts/casper-bottom/* \ + ubiquity-hooks/*; do \ + sh -n $$x; \ + done touch build-stamp diff --git a/hooks/casper b/hooks/casper index f7fee12..2ebd188 100755 --- a/hooks/casper +++ b/hooks/casper @@ -84,4 +84,6 @@ manual_add_modules ohci1394 # integrity check copy_exec /usr/lib/casper/casper-md5check /bin +cp /usr/share/initramfs-tools/scripts/casper-functions $DESTDIR/scripts + auto_add_modules net diff --git a/scripts/casper b/scripts/casper index dba4b4a..6f7bbb0 100644 --- a/scripts/casper +++ b/scripts/casper @@ -29,28 +29,28 @@ fi # looking for casper specifics options as kernel parameters for x in $(cat /proc/cmdline); do case $x in - userfullname*) - export USERFULLNAME=${x#userfullname=} - export CASPERCONF="changed" - ;; - host*) - export HOST=${x#host=} - export CASPERCONF="changed" - ;; - username*) - export USERNAME=${x#username=} - export CASPERCONF="changed" - ;; + userfullname*) + export USERFULLNAME=${x#userfullname=} + export CASPERCONF="changed" + ;; + host*) + export HOST=${x#host=} + export CASPERCONF="changed" + ;; + username*) + export USERNAME=${x#username=} + export CASPERCONF="changed" + ;; netboot*) export NETBOOT=${x#netboot=} ;; toram) export TORAM=1 ;; - hide-cow) - export HIDECOW=1 ;; + showmounts) + export SHOWMOUNTS=1 ;; persistent) export PERSISTENT=1 ;; ip*) - STATICIP=${x#ip=} + STATICIP=${x#ip=} if [ "${STATICIP}" == "" ]; then STATICIP="frommedia" fi @@ -228,7 +228,7 @@ copy_to_ram() { size=$(expr ${size} + ${size}/20 ) # Fixme: 5% more to be sure needed_space=$(expr ${size} * 1024) freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - )) - + if [ ! ${freespace} -lt ${needed_space} ] ; then [ "$quiet" != "y" ] && log_begin_msg "Not enough free memory to copy to ram" [ "$quiet" != "y" ] && log_end_msg @@ -288,7 +288,7 @@ do_netmount() { fi [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" - + if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then rc=0 elif do_nfsmount ; then @@ -342,9 +342,12 @@ setup_unionfs() { modprobe "${MP_QUIET}" -b unionfs - # run-init can't deal with this, but we're going to move all of these - # away before it runs anyway. - croot="/casper" + # run-init can't deal with images in a subdir, but we're going to + # move all of these away before it runs anyway. No, we're not, + # put them in / since move-mounting them into / breaks mono and + # some other apps. + + croot="/" # Let's just mount the read-only file systems first rofsstring="" @@ -393,20 +396,9 @@ setup_unionfs() { mount ${cowdevice} -t ${cow_fstype} -o rw /cow || panic "Can not mount $cowdevice on /cow" - # Look for a snapshot to copy - - mount -t unionfs -o dirs=/cow=rw:$rofsstring unionfs "$rootmnt" || panic "Unionfs mount failed" - for d in ${rofslist}; do - mkdir -p "${rootmnt}/casper/${d##*/}" - case d in - *.dir) # do nothing # mount -o bind "${d}" "${rootmnt}/casper/${d##*/}" - ;; - *) mount -o move "${d}" "${rootmnt}/casper/${d##*/}" - ;; - esac - done + # Look for a snapshot to copy # Adding other custom mounts if [ ! -z "${PERSISTENT}" ]; then @@ -418,10 +410,21 @@ setup_unionfs() { fi fi - if [ -z "${HIDECOW}" ]; then - mkdir -p "$rootmnt/cow" - mount -o bind /cow "$rootmnt/cow" + if [ ! -z "${SHOWMOUNTS}" ]; then + for d in ${rofslist}; do + mkdir -p "${rootmnt}/casper/${d##*/}" + case d in + *.dir) # do nothing # mount -o bind "${d}" "${rootmnt}/casper/${d##*/}" + ;; + *) mount -o move "${d}" "${rootmnt}/casper/${d##*/}" + ;; + esac + done fi + + # shows cow fs on /cow for use by casper-snapshot + mkdir -p "$rootmnt/cow" + mount -o bind /cow "$rootmnt/cow" } is_usb_device() { @@ -463,11 +466,11 @@ find_livefs() { done elif [ "${fstype}" = "squashfs" || \ "${fstype}" = "ext2" ]; then - + # This is an ugly hack situation, the block device has # an image directly on it. It's hopefully # casper, so take it and run with it. - + ln -s "${devname}" "${devname}.${fstype}" echo "${devname}.${fstype}" return @@ -475,6 +478,12 @@ find_livefs() { done } +pulsate() { + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "PULSATE" + fi +} + set_usplash_timeout() { if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TIMEOUT 120" @@ -486,9 +495,10 @@ mountroot() { exec 7>&2 exec > casper.log exec 2>&1 - + set_usplash_timeout [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-premount" + pulsate run_scripts /scripts/casper-premount [ "$quiet" != "y" ] && log_end_msg @@ -515,7 +525,7 @@ mountroot() { if [ "$?" -gt 0 ]; then panic "Unable to find a medium containing a live file system" fi - + if [ ! -z "${TORAM}" ]; then copy_to_ram "${livefs_root}" fi @@ -529,6 +539,7 @@ mountroot() { maybe_break casper-bottom [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-bottom" + pulsate run_scripts /scripts/casper-bottom [ "$quiet" != "y" ] && log_end_msg diff --git a/scripts/casper-bottom/05mountpoints b/scripts/casper-bottom/05mountpoints index 20a28fd..be76755 100755 --- a/scripts/casper-bottom/05mountpoints +++ b/scripts/casper-bottom/05mountpoints @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Moving mount points..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/10adduser b/scripts/casper-bottom/10adduser index e85f947..af7754b 100755 --- a/scripts/casper-bottom/10adduser +++ b/scripts/casper-bottom/10adduser @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Adding live session user..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/12fstab b/scripts/casper-bottom/12fstab index 00e5c50..ac39396 100755 --- a/scripts/casper-bottom/12fstab +++ b/scripts/casper-bottom/12fstab @@ -4,7 +4,7 @@ PREREQ="" DESCRIPTION="Configuring fstab..." FSTAB=/root/etc/fstab -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/13swap b/scripts/casper-bottom/13swap index 44d73f3..986b079 100755 --- a/scripts/casper-bottom/13swap +++ b/scripts/casper-bottom/13swap @@ -4,7 +4,7 @@ PREREQ="" DESCRIPTION="Setting up swap..." FSTAB=/root/etc/fstab -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/14locales b/scripts/casper-bottom/14locales index f69fa0f..4297a58 100755 --- a/scripts/casper-bottom/14locales +++ b/scripts/casper-bottom/14locales @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up locales..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/15autologin b/scripts/casper-bottom/15autologin index ff88721..cdaa038 100755 --- a/scripts/casper-bottom/15autologin +++ b/scripts/casper-bottom/15autologin @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up automatic login..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/18hostname b/scripts/casper-bottom/18hostname index 7ac5b00..19ac61f 100755 --- a/scripts/casper-bottom/18hostname +++ b/scripts/casper-bottom/18hostname @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting hostname..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/19keyboard b/scripts/casper-bottom/19keyboard index d738faf..1d833ad 100755 --- a/scripts/casper-bottom/19keyboard +++ b/scripts/casper-bottom/19keyboard @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up keyboard..." -. /scripts/functions +. /scripts/casper-functions prereqs() { @@ -39,7 +39,7 @@ for x in $(cat /proc/cmdline); do done if [ "$cslayout" ] && [ -x /root/bin/setupcon ] && \ - [ -f /etc/default/console-setup ]; then + [ -f /root/etc/default/console-setup ]; then chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"$cslayout\"/" \ /etc/default/console-setup if [ "$csvariant" ]; then diff --git a/scripts/casper-bottom/20xconfig b/scripts/casper-bottom/20xconfig index b8a4552..3916f41 100755 --- a/scripts/casper-bottom/20xconfig +++ b/scripts/casper-bottom/20xconfig @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring X..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/22gnome_panel_data b/scripts/casper-bottom/22gnome_panel_data index 5509ce1..4dd5d9d 100755 --- a/scripts/casper-bottom/22gnome_panel_data +++ b/scripts/casper-bottom/22gnome_panel_data @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring gnome-panel-data..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/22screensaver b/scripts/casper-bottom/22screensaver index ff3ec81..e5965e8 100755 --- a/scripts/casper-bottom/22screensaver +++ b/scripts/casper-bottom/22screensaver @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring screensaver..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/23etc_modules b/scripts/casper-bottom/23etc_modules index 622d96e..754a832 100755 --- a/scripts/casper-bottom/23etc_modules +++ b/scripts/casper-bottom/23etc_modules @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Preconfiguring /etc/modules..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/23networking b/scripts/casper-bottom/23networking index 8f4b698..f410321 100755 --- a/scripts/casper-bottom/23networking +++ b/scripts/casper-bottom/23networking @@ -4,7 +4,7 @@ PREREQ="" DESCRIPTION="Preconfiguring networking..." IFFILE="/root/etc/network/interfaces" -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/24preseed b/scripts/casper-bottom/24preseed index 98a9864..cd52467 100755 --- a/scripts/casper-bottom/24preseed +++ b/scripts/casper-bottom/24preseed @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Loading preseed file..." -. /scripts/functions +. /scripts/casper-functions prereqs () { @@ -26,6 +26,9 @@ for x in $(cat /proc/cmdline); do preseed/file=*) location="${x#preseed/file=}" ;; + file=*) + location="${x#file=}" + ;; */*=*) question="${x%%=*}" value="${x#*=}" diff --git a/scripts/casper-bottom/25configure_init b/scripts/casper-bottom/25configure_init index 84fa741..573b2a6 100755 --- a/scripts/casper-bottom/25configure_init +++ b/scripts/casper-bottom/25configure_init @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up init..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/30accessibility b/scripts/casper-bottom/30accessibility index e8e7e8a..cc64832 100755 --- a/scripts/casper-bottom/30accessibility +++ b/scripts/casper-bottom/30accessibility @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring accessibility options..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/31disable_update_notifier b/scripts/casper-bottom/31disable_update_notifier index 082b818..10b86a2 100755 --- a/scripts/casper-bottom/31disable_update_notifier +++ b/scripts/casper-bottom/31disable_update_notifier @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Disabling update-notifier..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/32disable_hibernation b/scripts/casper-bottom/32disable_hibernation index badcef6..47344fa 100755 --- a/scripts/casper-bottom/32disable_hibernation +++ b/scripts/casper-bottom/32disable_hibernation @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring power management..." -. /scripts/functions +. /scripts/casper-functions prereqs() { diff --git a/scripts/casper-bottom/33disable_binary_drivers b/scripts/casper-bottom/33disable_binary_drivers index 6bc2279..971ce8e 100755 --- a/scripts/casper-bottom/33disable_binary_drivers +++ b/scripts/casper-bottom/33disable_binary_drivers @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Configuring some drivers..." -. /scripts/functions +. /scripts/casper-functions prereqs() { @@ -23,3 +23,5 @@ log_begin_msg "$DESCRIPTION" if [ -e /root/etc/default/linux-restricted-modules-common ]; then echo 'DISABLED_MODULES="fglrx nv"' >> /root/etc/default/linux-restricted-modules-common fi + +log_end_msg \ No newline at end of file diff --git a/scripts/casper-bottom/34disable_kwallet b/scripts/casper-bottom/34disable_kwallet new file mode 100755 index 0000000..add7cca --- /dev/null +++ b/scripts/casper-bottom/34disable_kwallet @@ -0,0 +1,25 @@ +#! /bin/sh + +PREREQ="" +DESCRIPTION="Disabling kwallet..." + +. /scripts/casper-functions + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +log_begin_msg "$DESCRIPTION" + +rm -f /root/usr/share/services/kded/kwalletd.desktop + +log_end_msg \ No newline at end of file diff --git a/scripts/casper-bottom/35fix_language_selector b/scripts/casper-bottom/35fix_language_selector new file mode 100755 index 0000000..96a1d6c --- /dev/null +++ b/scripts/casper-bottom/35fix_language_selector @@ -0,0 +1,28 @@ +#! /bin/sh + +PREREQ="" +DESCRIPTION="Fixing language selector..." + +. /scripts/casper-functions + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +log_begin_msg "$DESCRIPTION" + +if [ -e /root/usr/share/applications/language-selector.desktop ]; then + sed -i '/^Exec/ s|/usr/bin/gnome-language-selector|"& -n"|' /root/usr/share/applications/language-selector.desktop + +fi + +log_end_msg diff --git a/scripts/casper-functions b/scripts/casper-functions new file mode 100644 index 0000000..9e36db7 --- /dev/null +++ b/scripts/casper-functions @@ -0,0 +1,12 @@ + +. /scripts/functions + +# Override this so we don't call PROGRESS +log_end_msg() +{ + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "SUCCESS ok" + fi + _log_msg "Done." +} + -- 2.1.4