From fdd8036ba32ad88e83a61191cc4597ae060355d2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 14:46:42 +0200 Subject: [PATCH] Adding live-initramfs 1.99.2-1. --- Makefile | 7 +- bin/live-preseed | 12 +- bin/live-reconfigure | 80 +- bin/live-snapshot | 127 ++- debian/changelog | 8 + debian/control | 5 +- debian/rules | 5 +- docs/AUTHORS | 1 - docs/ChangeLog | 35 + docs/parameters.txt | 5 +- manpages/live-initramfs.en.7 | 8 +- manpages/live-snapshot.en.1 | 4 +- manpages/live-snapshot.it.1 | 2 +- scripts/live | 1264 +++++++++++++--------- scripts/live-bottom/02etc_live_conf | 24 +- scripts/live-bottom/02timezone | 24 +- scripts/live-bottom/05mountpoints | 7 +- scripts/live-bottom/10adduser | 103 +- scripts/live-bottom/12fstab | 5 + scripts/live-bottom/13swap | 32 +- scripts/live-bottom/14locales | 107 +- scripts/live-bottom/15autologin | 70 +- scripts/live-bottom/18hostname | 9 +- scripts/live-bottom/19keyboard | 82 +- scripts/live-bottom/20xconfig | 58 +- scripts/live-bottom/21xvidemode | 5 + scripts/live-bottom/22gnome_panel_data | 20 +- scripts/live-bottom/22screensaver | 5 + scripts/live-bottom/23etc_modules | 8 +- scripts/live-bottom/23networking | 118 +- scripts/live-bottom/24preseed | 30 +- scripts/live-bottom/25configure_init | 157 +-- scripts/live-bottom/30accessibility | 197 ++-- scripts/live-bottom/31disable_update_notifier | 6 + scripts/live-bottom/32disable_hibernation | 22 +- scripts/live-bottom/33enable_apport_crashes | 11 +- scripts/live-bottom/34disable_kpersonalizer | 51 + scripts/live-bottom/34disable_kwallet | 5 + scripts/live-bottom/35fix_language_selector | 16 +- scripts/live-bottom/38disable_restricted_manager | 11 +- scripts/live-bottom/40install_driver_updates | 17 +- scripts/live-bottom/41apt_cdrom | 5 + scripts/live-functions | 37 +- scripts/live-helpers | 455 ++++---- scripts/live-premount/10driver_updates | 203 ++-- 45 files changed, 2141 insertions(+), 1322 deletions(-) create mode 100755 scripts/live-bottom/34disable_kpersonalizer diff --git a/Makefile b/Makefile index 70f8b3a..880b463 100644 --- a/Makefile +++ b/Makefile @@ -108,9 +108,10 @@ uninstall: update: set -e; for FILE in docs/parameters.txt manpages/*.en.*; \ do \ - sed -i -e 's/2007\\-09\\-03/2007\\-09\\-10/' \ - -e 's/03.09.2007/10.09.2007/' \ - -e 's/1.99.1/1.99.2/' \ + sed -i -e 's/2007\\-09\\-10/2007\\-09\\-17/' \ + -e 's/2007-09-10/2007-09-17/' \ + -e 's/10.09.2007/17.09.2007/' \ + -e 's/1.99.2/1.99.3/' \ $$FILE; \ done diff --git a/bin/live-preseed b/bin/live-preseed index c10315e..3bdd8ce 100755 --- a/bin/live-preseed +++ b/bin/live-preseed @@ -1,19 +1,25 @@ -#! /bin/sh +#!/bin/sh + set -e + PATH=/usr/sbin:/usr/bin:/sbin:/bin root="$1" question="$2" value="$3" seen="$4" + [ "$seen" ] || seen=true -if ! (echo "SET $question $value"; echo "FSET $question seen $seen") | chroot "$1" debconf-communicate -fnoninteractive live-initramfs >/dev/null; then - chroot "$1" debconf-communicate -fnoninteractive live-initramfs >/dev/null </dev/null +then + +chroot "$1" debconf-communicate -fnoninteractive live-initramfs >/dev/null << EOF REGISTER debian-installer/dummy $question SET $question $value FSET $question seen $seen EOF + fi exit 0 diff --git a/bin/live-reconfigure b/bin/live-reconfigure index 4e29768..565bdea 100755 --- a/bin/live-reconfigure +++ b/bin/live-reconfigure @@ -1,40 +1,57 @@ #! /bin/sh set -e + export PATH=/usr/bin:/usr/sbin:/sbin:/bin frontend=noninteractive -findcommandinroot() { - ROOT="$1/" - shift - while [ "$#" -ge 1 ]; do - P="$PATH" - while [ "$P" ]; do - D=${P%%:*} - P=${P#*:} - if [ "$D" = "$P" ]; then - P= - fi - if [ -z "$D" ]; then - D=. - fi - if [ -x "$ROOT$D/$1" ]; then - echo "$D/$1" - return 0 - fi - done - shift - done - return 1 +findcommandinroot () +{ + ROOT="$1/" + shift + + while [ "$#" -ge 1 ] + do + P="$PATH" + + while [ "$P" ] + do + D=${P%%:*} + P=${P#*:} + + if [ "$D" = "$P" ] + then + P= + fi + + if [ -z "$D" ] + then + D=. + fi + + if [ -x "$ROOT$D/$1" ] + then + echo "$D/$1" + return 0 + fi + done + + shift + done + + return 1 } -runcommandinroot() { - C=$(findcommandinroot "$1" "$2") - ROOT="$1" - shift - shift - [ -n "$C" ] && chroot "$ROOT" "$C" "$@" +runcommandinroot () +{ + C=$(findcommandinroot "$1" "$2") + ROOT="$1" + + shift + shift + + [ -n "$C" ] && chroot "$ROOT" "$C" "$@" } root="$1" @@ -42,9 +59,10 @@ package="$2" version=$(runcommandinroot "$root" dpkg-query -W --showformat='${Version}' "$package" 2>/dev/null) || version="" -if [ -z "$version" ]; then - echo >&2 "$0: package '$package' is not installed" - exit 0 +if [ -z "$version" ] +then + echo >&2 "$0: package '$package' is not installed" + exit 0 fi runcommandinroot "$root" dpkg-reconfigure -fnoninteractive --no-reload "$package" diff --git a/bin/live-snapshot b/bin/live-snapshot index a7214bd..17349fc 100755 --- a/bin/live-snapshot +++ b/bin/live-snapshot @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/sh # live-snapshot - utility to manage Debian Live systems snapshots # @@ -28,9 +28,9 @@ PROGRAM="`basename $0`" VERSION=0.0.1 - # Source live conf -if [ -e /etc/live.conf ]; then +if [ -e /etc/live.conf ] +then . /etc/live.conf else USERNAME=$(cat /etc/passwd | grep "999" | cut -f1 -d ':') @@ -42,7 +42,9 @@ export USERNAME USERFULLNAME HOSTNAME BUILD_SYSTEM # Source helper functions helpers="/usr/share/initramfs-tools/scripts/live-helpers" -if [ -e "${helpers}" ]; then + +if [ -e "${helpers}" ] +then . "${helpers}" else echo "Error: I cannot found helper functions \"${helpers}\"." @@ -74,10 +76,14 @@ Header () Usage () { MESSAGE=${1} + Header + echo echo "Try \"${PROGRAM} --help\" for more information." - if [ ! -z "${MESSAGE}" ]; then + + if [ ! -z "${MESSAGE}" ] + then echo -e "${MESSAGE}" exit 1 else @@ -88,6 +94,7 @@ Usage () Help () { Header + echo echo "Options:" echo " -c, --cow: specifies the copy on write directory (default: /live/cow)." @@ -96,6 +103,7 @@ Help () echo " -r, --resync-string: internally used to resync previous made snapshots." echo " -t, --type: specifies the snapshot type between \"squashfs\", \"ext2\", \"ext3\" or \"cpio\".gz archive (default: cpio)" echo -e "\nLook at live-snapshot(1) man page for more information." + exit 0 } @@ -123,6 +131,7 @@ Version () echo "can be found in /usr/share/common-licenses/GPL-2 file." echo echo "Homepage: " + exit 0 } @@ -135,14 +144,17 @@ Do_snapshot () mksquashfs "${COW}" "${DEST}" -ef /tmp/exclude_list || exit 1 rm /tmp/exclude_list ;; + cpio) ( cd "${COW}" && find . -path '*.wh.*' -prune -o -print0 | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" ) || exit 1 ;; + ext2|ext3) 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 @@ -154,7 +166,9 @@ Is_same_mount () { dir1="`Base_path $1`" dir2="`Base_path $2`" - if [ "${dir1}" = "${dir2}" ]; then + + if [ "${dir1}" = "${dir2}" ] + then return 0 else return 1 @@ -167,35 +181,62 @@ Parse_args () ARGS="$1" ARGUMENTS="`getopt --longoptions cow:,device:,output,resync-string:,type:,help,usage,version --name=${PROGRAM} --options c:d:o:t:r:,h,u,v --shell sh -- ${ARGS}`" - if [ "$?" != "0" ]; then + if [ "$?" != "0" ] + then echo "Terminating." >&2 exit 1 fi eval set -- "${ARGUMENTS}" - while true; do + while true + do case "$1" in -c|--cow) - SNAP_COW="$2"; shift 2 ;; + SNAP_COW="$2" + shift 2 + ;; + -d|--device) - SNAP_DEV="$2"; shift 2 ;; + SNAP_DEV="$2" + shift 2 + ;; + -o|--output) - SNAP_OUTPUT="$2"; shift 2 ;; + SNAP_OUTPUT="$2" + shift 2 + ;; + -t|--type) - SNAP_TYPE="$2"; shift 2 ;; + SNAP_TYPE="$2" + shift 2 + ;; + -r|--resync-string) - SNAP_RSTRING="$2"; break ;; + SNAP_RSTRING="$2" + break + ;; + -h|--help) - Help; shift ;; + Help + ;; + -u|--usage) - Usage ; shift ;; + Usage + ;; + -v|--version) - Version; shift ;; + Version + ;; + --) - shift; break ;; + shift + break + ;; + *) echo "Internal error."; exit 1 ;; + esac done } @@ -204,18 +245,23 @@ Mount_device () { dev="$1" - if [ ! -d "${MOUNTP}" ]; then + if [ ! -d "${MOUNTP}" ] + then mkdir -p "${MOUNTP}" fi - if [ -z "${dev}" ]; then + if [ -z "${dev}" ] + then # create a temp mount -t tmpfs -o rw tmpfs "${MOUNTP}" - if [ ! -L /home/$USERNAME/Desktop/live-snapshot ]; then + + if [ ! -L /home/$USERNAME/Desktop/live-snapshot ] + then ln -s "${MOUNTP}" /home/$USERNAME/Desktop/live-snapshot fi else - if [ -b "${dev}" ] ; then + if [ -b "${dev}" ] + then try_mount "${dev}" "${MOUNTP}" rw fi fi @@ -230,27 +276,35 @@ Defaults () TYPE="cpio" DESKTOP_LINK=/home/$USERNAME/Desktop/live-snapshot - if [ -n "${SNAP_RSTRING}" ]; then + if [ -n "${SNAP_RSTRING}" ] + then COW=$(echo "${SNAP_RSTRING}" | cut -f1 -d ':') DEV=$(echo "${SNAP_RSTRING}" | cut -f2 -d ':') DEST=$(echo "${SNAP_RSTRING}" | cut -f3 -d ':') case "${DEST}" in *.cpio.gz) - TYPE="cpio" ;; + TYPE="cpio" + ;; + *.squashfs) - TYPE="squashfs" ;; - "") - TYPE="ext2" ;; - *.ext2|*.ext3) - TYPE="ext2" ;; + TYPE="squashfs" + ;; + + ""|*.ext2|*.ext3) + TYPE="ext2" + ;; + *) - Usage "Unregognized String" ;; + Usage "Unregognized String" + ;; esac else DEF_COW="/live/cow" + # Bad options handling - if [ -z "${SNAP_COW}" ]; then + if [ -z "${SNAP_COW}" ] + then COW="${DEF_COW}" else COW="${SNAP_COW}" @@ -260,28 +314,33 @@ Defaults () "cpio"|"squashfs"|"ext2"|"ext3") TYPE="${SNAP_TYPE}" ;; + "") - TYPE="cpio" ;; + TYPE="cpio" + ;; + *) Usage "Error: unrecognized snapshot type" ;; esac + #if [ -d #if Is_same_mount fi # check vars - if [ ! -d "${COW}" ]; then + if [ ! -d "${COW}" ] + then Usage "Error: ${COW} is not a directory" fi Mount_device $DEV - } Clean () { - if [ -n "$DEV" ]; then + if [ -n "$DEV" ] + then umount "${MOUNTP}" rmdir "${MOUNTP}" #rm diff --git a/debian/changelog b/debian/changelog index ce74be6..146c560 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +live-initramfs (1.99.2-1) unstable; urgency=medium + + * New upstream release: + - Contains patch from Jim Paris to fix wrong ipconfig usage + (Closes: #440235). + + -- Daniel Baumann Mon, 10 Sep 2007 00:00:00 +0200 + live-initramfs (1.99.1-1) unstable; urgency=medium * New upstream release. diff --git a/debian/control b/debian/control index adc35c9..52cb94e 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,9 @@ Maintainer: Debian Live Uploaders: Daniel Baumann Build-Depends: debhelper (>= 5), lsb-release Standards-Version: 3.7.2 -XS-Vcs-Svn: svn://svn.debian.org/debian-live/dists/trunk/live-initramfs/ -XS-VCS-Browse: http://svn.debian.org/wsvn/debian-live/dists/trunk/live-initramfs/ +XS-Upstream-Depends: git-core +XS-VCS-Git: git://git.debian.org/git/users/daniel/live-initramfs.git +XS-VCS-Browse: http://git.debian.org/?p=users/daniel/live-initramfs.git Package: live-initramfs Architecture: all diff --git a/debian/rules b/debian/rules index b1801be..b90bb07 100755 --- a/debian/rules +++ b/debian/rules @@ -4,9 +4,8 @@ #export DH_VERBOSE=1 upstream: - # Needs: subversion - cd .. && svn co svn://svn.debian.org/debian-live/dists/trunk/live-initramfs || true - find . -type d -name .svn | xargs rm -rf + cd .. && git clone git://git.debian.org/git/users/daniel/live-initramfs.git || true + rm -rf ../live-initramfs/.git build: build-stamp build-stamp: diff --git a/docs/AUTHORS b/docs/AUTHORS index dc44347..e10c045 100644 --- a/docs/AUTHORS +++ b/docs/AUTHORS @@ -1,7 +1,6 @@ Main Authors: * Daniel Baumann - * Marco Amadori Original Authors: diff --git a/docs/ChangeLog b/docs/ChangeLog index ce612a1..ecd8a0a 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,3 +1,38 @@ +2007-09-09 Daniel Baumann + + * Using common indenting. + * scripts/live: + - Applied patch from Jim Paris to fix wrong usage of + ipconfig (Closes: #440235). + * Uploaded 1.99.2-1. + +2007-09-09 Michael Prokop + + * scripts/live: + - Extending toram parameter to specify module. + - Adding forgotten nofstab boot parameter. + * scripts/live-bottom/40install_driver_updates: + - Adding check driver updates. + * scripts/live-bottom/25configure_init: + - Adding check for file-rc. + * scripts/live-bottom/21xvidemode: + - Sorting variable checks always before logging. + * scripts/live, live-bottom/*: + - Adding boot parameters to disable each service. + * scripts/live, live-bottom/22gnome_panel_date: + - Adding nognomefstab boot parameter. + * scripts/live-bottom/38disable_restricted_manager: + - Removing leftover reference to casper-functions. + +2007-09-05 Daniel Baumann + + * scripts/live, scripts/live-bottom: + - Added nouser parameter to disable user creation. + - Added noxautoconfig parameter to disable xorg re-configuration. + - Added nohosts parameter to disable /etc/hosts creation. + * scripts/live-bottom/15autologin: + - Moved disabling of kpersonalizer to 34disable_kpersonalizer. + 2007-09-01 Daniel Baumann * Merging changes from casper 1.97, 1.98 and 1.99. diff --git a/docs/parameters.txt b/docs/parameters.txt index dc66669..0c691e4 100644 --- a/docs/parameters.txt +++ b/docs/parameters.txt @@ -1,13 +1,14 @@ Boot Parameters for Debian Live ------------------------------- -Updated for live-initramfs 1.96.3-1 on 2007-07-30. +Updated for live-initramfs 1.99.2-1 on 2007-09-10. These options (can be combined) work from the bootloader prompt: live access=ACCESS live console=TTY,SPEED live debug +live fetch=URL live hostname=HOSTNAME live username=USER live userfullname=USERFULLNAME @@ -35,6 +36,8 @@ live nofastboot live nopersistent live nosudo live noswap +live nouser +live noxautoconfig live persistent live {preseed/file|file}=FILE live package/question=VALUE diff --git a/manpages/live-initramfs.en.7 b/manpages/live-initramfs.en.7 index 4bb6ab3..7751852 100644 --- a/manpages/live-initramfs.en.7 +++ b/manpages/live-initramfs.en.7 @@ -1,4 +1,4 @@ -.TH LIVE\-INITRAMFS 7 "2007\-09\-03" "1.96.3" "live\-initramfs" +.TH LIVE\-INITRAMFS 7 "2007\-09\-10" "1.99.2" "live\-initramfs" .SH NAME live\-initramfs \- Debian Live initramfs hook @@ -68,6 +68,10 @@ disables the "persistent" feature, useful if the bootloader (like syslinux) has This parameter disables the automatic configuration of sudo. .IP "\fBnoswap\fR" 4 This parameter disables usage of local swap partitions. +.IP "\fBnouser\fR" 4 +This parameter disables the creation of the default user completely. +.IP "\fBnoxautoconfig\fR" 4 +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. .IP "\fBpersistent\fR" 4 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 \fIlive\-snapshot\fR(1) for more informations. .IP "\fB{preseed/file|file}=\fR\fIFILE\fR" 4 @@ -118,6 +122,6 @@ Report bugs against live\-initramfs <\fIhttp://packages.qa.debian.org/live\-init More information about the Debian Live project can be found at <\fIhttp://debian\-live.alioth.debian.org/\fR> and <\fIhttp://wiki.debian.org/DebianLive/\fR>. .SH AUTHORS -live\-initramfs is maintained by Daniel Baumann <\fIdaniel@debian.org\fR> and Marco Amadori <\fImarco.amadori@gmail.com\fR> for the Debian project. +live\-initramfs is maintained by Daniel Baumann <\fIdaniel@debian.org\fR> for the Debian project. .PP live\-initramfs is a fork of casper <\fIhttp://packages.ubuntu.com/casper/\fR>. casper was originally written by Tollef Fog Heen <\fItfheen@canonical.com\fR> and Matt Zimmerman <\fImdz@canonical.com\fR>. diff --git a/manpages/live-snapshot.en.1 b/manpages/live-snapshot.en.1 index c9eec1c..287eccb 100644 --- a/manpages/live-snapshot.en.1 +++ b/manpages/live-snapshot.en.1 @@ -1,4 +1,4 @@ -.TH LIVE\-SNAPSHOT 1 "2007\-09\-03" "1.96.3" "live\-initramfs" +.TH LIVE\-SNAPSHOT 1 "2007\-09\-10" "1.99.2" "live\-initramfs" .SH NAME live\-snapshot \- a simple script to ease persistence usage @@ -66,6 +66,6 @@ Report bugs against live\-initramfs <\fIhttp://packages.qa.debian.org/live\-init More information about the Debian Live project can be found at <\fIhttp://debian\-live.alioth.debian.org/\fR> and <\fIhttp://wiki.debian.org/DebianLive/\fR>. .SH AUTHORS -live\-initramfs is maintained by Daniel Baumann <\fIdaniel@debian.org\fR> and Marco Amadori <\fImarco.amadori@gmail.com\fR> for the Debian project. +live\-initramfs is maintained by Daniel Baumann <\fIdaniel@debian.org\fR> for the Debian project. .PP live\-initramfs is a fork of casper <\fIhttp://packages.ubuntu.com/casper/\fR>. casper was originally written by Tollef Fog Heen <\fItfheen@canonical.com\fR> and Matt Zimmerman <\fImdz@canonical.com\fR>. diff --git a/manpages/live-snapshot.it.1 b/manpages/live-snapshot.it.1 index 8866a40..d5a7163 100644 --- a/manpages/live-snapshot.it.1 +++ b/manpages/live-snapshot.it.1 @@ -65,6 +65,6 @@ Riportate i bug sul pacchetto live\-initramfs <\fIhttp://packages.qa.debian.org/ Ulteriori informazioni su progetto Debian Live possono essere trovate su <\fIhttp://debian\-live.alioth.debian.org/\fR> e <\fIhttp://wiki.debian.org/DebianLive/\fR>. .SH AUTHORS -live\-initramfs \[`e] mantenuto da Daniel Baumann <\fIdaniel@debian.org\fR> e Marco Amadori <\fImarco.amadori@gmail.com\fR> per il progetto Debian. +live\-initramfs \[`e] mantenuto da Daniel Baumann <\fIdaniel@debian.org\fR> per il progetto Debian. .PP live\-initramfs \[`e] un fork di casper <\fIhttp://packages.ubuntu.com/casper\fR>. casper \[`e] stato scritto originariamente da Tollef Fog Heen <\fItfheen@canonical.com\fR> e Matt Zimmerman <\fImdz@canonical.com\fR>. diff --git a/scripts/live b/scripts/live index a73da84..7a0a78e 100755 --- a/scripts/live +++ b/scripts/live @@ -27,8 +27,9 @@ export USERNAME USERFULLNAME HOSTNAME BUILD_SYSTEM . /scripts/live-helpers -if [ ! -f /live.vars ]; then - touch /live.vars +if [ ! -f /live.vars ] +then + touch /live.vars fi Arguments () @@ -164,6 +165,16 @@ Arguments () export NFSOPTS ;; + noaccessibility) + NOACCESSIBILITY="Yes" + export NOACCESSIBILITY + ;; + + noaptcdrom) + NOAPTCDROM="Yes" + export NOAPTCDROM + ;; + noautologin) NOAUTOLOGIN="Yes" export NOAUTOLOGIN @@ -174,14 +185,69 @@ Arguments () export NOXAUTOLOGIN ;; + noconsolekeyboard) + NOCONSOLEKEYBOARD="Yes" + export NOCONSOLEKEYBOARD + ;; + nofastboot) NOFASTBOOT="Yes" export NOFASTBOOT ;; - nopersistent) - PERSISTENT="" - export PERSISTENT + nofstab) + NOFSTAB="Yes" + export NOFSTAB + ;; + + nognomepanel) + NOGNOMEPANEL="Yes" + export NOGNOMEPANEL + ;; + + nohosts) + NOHOSTS="Yes" + export NOHOSTS + ;; + + nokpersonalizer) + NOKPERSONALIZER="Yes" + export NOKPERSONALIZER + ;; + + nokwallet) + NOKWALLET="Yes" + export NOKWALLET + ;; + + nolanguageselector) + NOLANGUAGESELECTOR="Yes" + export NOLANGUAGESELECTOR + ;; + + nolocales) + NOLOCALES="Yes" + export NOLOCALES + ;; + + nonetworking) + NONETWORKING="Yes" + export NONETWORKING + ;; + + nopowermanagement) + NOPOWERMANAGEMENT="Yes" + export NOPOWERMANAGEMENT + ;; + + noprogramcrashes) + NOPROGRAMCRASHES="Yes" + export NOPROGRAMCRASHES + ;; + + norestrictedmanager) + NORESTRICTEDMANAGER="Yes" + export NORESTRICTEDMANAGER ;; nosudo) @@ -194,16 +260,46 @@ Arguments () export NOSWAP ;; + noupdatenotifier) + NOUPDATENOTIFIER="Yes" + export NOUPDATENOTIFIER + ;; + + nouser) + NOUSER="Yes" + export NOUSER + ;; + + noxautoconfig) + NOXAUTOCONFIG="Yes" + export NOXAUTOCONFIG + ;; + + noxscreensaver) + NOXSCREENSAVER="Yes" + export NOXSCREENSAVER + ;; + persistent) PERSISTENT="Yes" export PERSISTENT ;; + nopersistent) + NOPERSISTENT="Yes" + export NOPERSISTENT + ;; + preseed/file=*|file=*) LOCATION="${ARGUMENT#*=}" export LOCATION ;; + nopreseed) + NOPRESEED="Yes" + export NOPRESEED + ;; + url=*) location="${ARGUMENT#url=}" @@ -240,6 +336,11 @@ Arguments () export TIMEZONE ;; + notimezone) + NOTIMEZONE="Yes" + export NOTIMEZONE + ;; + todisk=*) TODISK="${ARGUMENT#todisk=}" export TODISK @@ -250,6 +351,12 @@ Arguments () export TORAM ;; + toram=*) + TORAM="Yes" + MODULETORAM="${ARGUMENT#toram=}" + export TORAM MODULETORAM + ;; + union=*) UNIONTYPE="${ARGUMENT#union=}" export UNIONTYPE @@ -299,7 +406,7 @@ Arguments () fi } -is_live_path() +is_live_path () { DIRECTORY="${1}" @@ -317,331 +424,424 @@ is_live_path() return 1 } -get_backing_device() { - case "$1" in - *.squashfs|*.ext2|*.ext3) - echo $(setup_loop "$1" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}") - ;; - *.dir) - echo "directory" - ;; - *) - panic "Unrecognized live filesystem: $1" - ;; - esac +get_backing_device () +{ + case "$1" in + *.squashfs|*.ext2|*.ext3) + echo $(setup_loop "$1" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}") + ;; + + *.dir) + echo "directory" + ;; + + *) + panic "Unrecognized live filesystem: $1" + ;; + esac } -match_files_in_dir() { - # Does any files match pattern $1 ? +match_files_in_dir () +{ + # Does any files match pattern $1 ? + local pattern="$1" - local pattern="$1" - if [ "$(echo $pattern)" != "$pattern" ]; then - return 0 - fi - return 1 + if [ "$(echo $pattern)" != "$pattern" ] + then + return 0 + fi + + return 1 } -mount_images_in_directory() { - directory="$1" - rootmnt="$2" - - if match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.squashfs" || - match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext2" || - match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext3" || - match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.dir"; then - setup_unionfs "$directory/${LIVE_MEDIA_PATH}" "$rootmnt" - else - : - fi +mount_images_in_directory () +{ + directory="$1" + rootmnt="$2" + + if match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.squashfs" || + match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext2" || + match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.ext3" || + match_files_in_dir "$directory/${LIVE_MEDIA_PATH}/*.dir" + then + setup_unionfs "$directory/${LIVE_MEDIA_PATH}" "$rootmnt" + else + : + fi } -is_nice_device() { - sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])"; then - return 0 - fi - return 1 +is_nice_device () +{ + sysfs_path="${1#/sys}" + + if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])" + then + return 0 + fi + + return 1 } -is_supported_fs () { - # FIXME: do something better like the scan of supported filesystems - fstype="${1}" - case ${fstype} in - vfat|iso9660|udf|ext2|ext3|ntfs) - return 0 - ;; - esac - return 1 +is_supported_fs () +{ + # FIXME: do something better like the scan of supported filesystems + fstype="${1}" + + case ${fstype} in + vfat|iso9660|udf|ext2|ext3|ntfs) + return 0 + ;; + esac + + return 1 } -copy_live_to() { - copyfrom="${1}" - copytodev="${2}" - copyto="${copyfrom}_swap" - - size=$(fs_size "" ${copyfrom} "used") - - 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}' - ) ) - mount_options="-o size=${size}k" - free_string="memory" - fstype="tmpfs" - dev="/dev/shm" - else - # it should be a writable block device - if [ -b "${copytodev}" ]; then - dev="${copytodev}" - free_string="space" - fstype=$(get_fstype "${dev}") - freespace=$(fs_size "${dev}") - else - [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device." - return 1 - fi - fi - if [ "${freespace}" -lt "${size}" ] ; then - [ "$quiet" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k > ${size}k) to copy live media in ${copytodev}." - return 1 - fi - - # begin copying (or uncompressing) - mkdir "${copyto}" - echo "mount -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 -r --move "${copyto}" "${rootmnt}" - cd "${OLDPWD}" - else - cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files - umount ${copyfrom} - mount -r --move ${copyto} ${copyfrom} - fi - rmdir ${copyto} - return 0 +copy_live_to () +{ + copyfrom="${1}" + copytodev="${2}" + copyto="${copyfrom}_swap" + + if [ -z "${MODULETORAM}" ] + then + size=$(fs_size "" ${copyfrom} "used") + else + MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}" + + if [ -f "${MODULETORAMFILE}" ] + then + size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 ) + else + log_warning_msg "Error: toram-module $MODULETORAM ($MODULETORAMFILE) could not be read." + return 1 + fi + fi + + 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}' - ) ) + mount_options="-o size=${size}k" + free_string="memory" + fstype="tmpfs" + dev="/dev/shm" + else + # it should be a writable block device + if [ -b "${copytodev}" ] + then + dev="${copytodev}" + free_string="space" + fstype=$(get_fstype "${dev}") + freespace=$(fs_size "${dev}") + else + [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device." + return 1 + fi + fi + + if [ "${freespace}" -lt "${size}" ] + then + [ "$quiet" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}." + return 1 + fi + + # begin copying (or uncompressing) + mkdir "${copyto}" + echo "mount -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 -r --move "${copyto}" "${rootmnt}" + cd "${OLDPWD}" + else + if [ -n "${MODULETORAMFILE}" ] + then + cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module + else + cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files + fi + + livefs_root + umount ${copyfrom} + mount -r --move ${copyto} ${copyfrom} + fi + + rmdir ${copyto} + return 0 } -do_netmount() { - rc=1 +do_netmount () +{ + rc=1 - modprobe "${MP_QUIET}" af_packet # For DHCP + modprobe "${MP_QUIET}" af_packet # For DHCP - udevtrigger - udevsettle + udevtrigger + udevsettle - ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config + ipconfig ${DEVICE} | tee /netboot.config - if [ "${NFSROOT}" = "auto" ]; then - NFSROOT=${ROOTSERVER}:${ROOTPATH} - fi + if [ "${NFSROOT}" = "auto" ] + then + NFSROOT=${ROOTSERVER}:${ROOTPATH} + fi - # source relevant ipconfig output - . /tmp/net-${DEVICE}.conf - export HOSTNAME + # source relevant ipconfig output + OLDHOSTNAME=$HOSTNAME + . /tmp/net-${DEVICE}.conf + [ -z $HOSTNAME ] && HOSTNAME=$OLDHOSTNAME + export HOSTNAME - if [ -n "${FETCH}" ] && do_httpmount; then - rc=0 - return ${rc} - fi + if [ -n "${FETCH}" ] && do_httpmount + then + rc=0 + return ${rc} + fi - if [ "${NFSROOT#*:}" = "$NFSROOT" ] && [ "$NETBOOT" != "cifs" ]; then - NFSROOT=${ROOTSERVER}:${NFSROOT} - fi + if [ "${NFSROOT#*:}" = "$NFSROOT" ] && [ "$NETBOOT" != "cifs" ] + then + NFSROOT=${ROOTSERVER}:${NFSROOT} + fi - [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" + [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}" - if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then - rc=0 - elif do_nfsmount ; then - NETBOOT="nfs" - export NETBOOT - rc=0 - fi + if [ "${NETBOOT}" != "nfs" ] && do_cifsmount + then + rc=0 + elif do_nfsmount + then + NETBOOT="nfs" + export NETBOOT + rc=0 + fi - [ "$quiet" != "y" ] && log_end_msg - return ${rc} + [ "$quiet" != "y" ] && log_end_msg + return ${rc} } -do_httpmount() { - rc=1 - extension=`echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/'` - case "${extension}" in - squashfs|tgz|tar) - [ "$quiet" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})" - mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}" - wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})" - [ $? -eq 0 ] && rc=0 - [ "${extension}" == "tgz" ] && live_dest="ram" - ;; - *) - [ "$quiet" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}" - esac - return ${rc} +do_httpmount () +{ + rc=1 + extension=`echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/'` + + case "${extension}" in + squashfs|tgz|tar) + [ "$quiet" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})" + mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}" + wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})" + [ $? -eq 0 ] && rc=0 + [ "${extension}" == "tgz" ] && live_dest="ram" + ;; + + *) + [ "$quiet" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}" + esac + + return ${rc} } -do_nfsmount() { - rc=1 - modprobe "${MP_QUIET}" nfs - if [ -z "${NFSOPTS}" ]; then - NFSOPTS="" - fi - - [ "$quiet" != "y" ] && 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; do - nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break - sleep 1 - done - return ${rc} +do_nfsmount () +{ + rc=1 + + modprobe "${MP_QUIET}" nfs + + if [ -z "${NFSOPTS}" ] + then + NFSOPTS="" + fi + + [ "$quiet" != "y" ] && 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 + do + nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break + sleep 1 + done + + return ${rc} } -do_cifsmount() { - rc=1 - if [ -x "/sbin/mount.cifs" ]; then - if [ -z "${NFSOPTS}" ]; then - CIFSOPTS="-ouser=root,password=" - else - CIFSOPTS="${NFSOPTS}" - fi - - [ "$quiet" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}" - modprobe "${MP_QUIET}" cifs - - if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}" ; then - rc=0 - fi - fi - return ${rc} +do_cifsmount () +{ + rc=1 + + if [ -x "/sbin/mount.cifs" ] + then + if [ -z "${NFSOPTS}" ] + then + CIFSOPTS="-ouser=root,password=" + else + CIFSOPTS="${NFSOPTS}" + fi + + [ "$quiet" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}" + modprobe "${MP_QUIET}" cifs + + if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}" + then + rc=0 + fi + fi + + return ${rc} } do_snap_copy () { - fromdev="${1}" - todir="${2}" - snap_type="${3}" - - size=$(fs_size "${fromdev}" "" "used") - - if [ -b "${fromdev}" ]; then - # 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}') - else - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - )) - fi - - tomount="/mnt/tmpsnap" - if [ ! -d "${tomount}" ] ; then - mkdir -p "${tomount}" - fi - - fstype=$(get_fstype "${fromdev}") - if [ -n "${fstype}" ]; then - # Copying stuff... - mount -t "${fstype}" -o ro "${fromdev}" "${tomount}" - cp -a "${tomount}"/* ${todir} - umount "${tomount}" - else - log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}" - fi - - rmdir "${tomount}" - if echo ${fromdev} | grep -qs loop; then - losetup -d "${fromdev}" - fi - return 0 - else - return 1 - [ "$quiet" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium" - fi + fromdev="${1}" + todir="${2}" + snap_type="${3}" + size=$(fs_size "${fromdev}" "" "used") + + if [ -b "${fromdev}" ] + then + # 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}') + else + freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - )) + fi + + tomount="/mnt/tmpsnap" + + if [ ! -d "${tomount}" ] + then + mkdir -p "${tomount}" + fi + + fstype=$(get_fstype "${fromdev}") + + if [ -n "${fstype}" ] + then + # Copying stuff... + mount -t "${fstype}" -o ro "${fromdev}" "${tomount}" + cp -a "${tomount}"/* ${todir} + umount "${tomount}" + else + log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}" + fi + + rmdir "${tomount}" + + if echo ${fromdev} | grep -qs loop + then + losetup -d "${fromdev}" + fi + + return 0 + else + return 1 + + [ "$quiet" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium" + fi } try_snap () { - # Look for $snap_label.* in block devices and copy the contents to $snap_mount - # and remember the device and filename for resync on exit in live-initramfs.init - - snap_label="${1}" - snap_mount="${2}" - snap_type="${3}" - - snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3") - if [ ! -z "${snapdata}" ]; then - snapdev="$(echo ${snapdata} | cut -f1 -d ' ')" - snapback="$(echo ${snapdata} | cut -f2 -d ' ')" - snapfile="$(echo ${snapdata} | cut -f3 -d ' ')" - if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\)'; then - # squashfs 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 - else - # cpio.gz snapshot - if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null) ; then - log_warning_msg "Impossible to include the ${snapfile} Snapshot" - return 1 - fi - fi - umount "${snapback}" - else - dev=$(find_cow_device "${snap_label}") - if [ -b ${dev} ]; 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 - 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 - else - log_warning_msg "Impossible to include the ${snap_label} Snapshot" - return 1 - fi - fi - echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt - return 0 + # Look for $snap_label.* in block devices and copy the contents to $snap_mount + # and remember the device and filename for resync on exit in live-initramfs.init + + snap_label="${1}" + snap_mount="${2}" + snap_type="${3}" + snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3") + + if [ ! -z "${snapdata}" ] + then + snapdev="$(echo ${snapdata} | cut -f1 -d ' ')" + snapback="$(echo ${snapdata} | cut -f2 -d ' ')" + snapfile="$(echo ${snapdata} | cut -f3 -d ' ')" + + if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\)' + then + # squashfs 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 + else + # cpio.gz snapshot + if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null) + then + log_warning_msg "Impossible to include the ${snapfile} Snapshot" + return 1 + fi + fi + + umount "${snapback}" + else + dev=$(find_cow_device "${snap_label}") + + if [ -b ${dev} ] + 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 + + 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 + else + log_warning_msg "Impossible to include the ${snap_label} Snapshot" + return 1 + fi + fi + + echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt + return 0 } -setup_unionfs() { - image_directory="$1" - rootmnt="$2" +setup_unionfs () +{ + image_directory="$1" + rootmnt="$2" + + modprobe "${MP_QUIET}" -b ${UNIONTYPE} - modprobe "${MP_QUIET}" -b ${UNIONTYPE} + # 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. - # 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="/" - croot="/" + # Let's just mount the read-only file systems first + rofsstring="" + rofslist="" + minor_kernel_version=`uname -r|cut -c 5-|sed 's/[^0-9].*//'` - # Let's just mount the read-only file systems first - rofsstring="" - rofslist="" - minor_kernel_version=`uname -r|cut -c 5-|sed 's/[^0-9].*//'` - if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]; then - # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4 - roopt="nfsro" - else - roopt="ro" - fi + if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ] + then + # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4 + roopt="nfsro" + else + roopt="ro" + fi # Read image names from ${MODULE}.module if it exists if [ -e "${image_directory}/filesystem.${MODULE}.module" ] @@ -673,224 +873,296 @@ setup_unionfs() { image_string="`echo ${image_string} | sed -e 's/ /\n/g' | sort `" fi - mkdir -p "${croot}" - for image in ${image_string}; do - imagename=$(basename "${image}") - if [ -d "${image}" ]; then - # it is a plain directory: do nothing - rofsstring="${image}=${roopt}:${rofsstring}" - rofslist="${image} ${rofslist}" - elif [ -f "${image}" ]; then - backdev=$(get_backing_device "$image") - fstype=$(get_fstype "${backdev}") - if [ "${fstype}" = "unknown" ]; then - panic "Unknown file system type on ${backdev} (${image})" - fi - mkdir -p "${croot}/${imagename}" - mount -t "${fstype}" -o ro "${backdev}" "${croot}/${imagename}" || panic "Can not mount $backdev ($image) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}" - fi - done - rofsstring=${rofsstring%:} - - mkdir -p /cow - cowdevice="tmpfs" - cow_fstype="tmpfs" - - # Looking for "${root_persistence}" device or file - if [ -n "${PERSISTENT}" ]; then - cowprobe=$(find_cow_device "${root_persistence}") - if [ -b "${cowprobe}" ]; then - cowdevice=${cowprobe} - cow_fstype=$(get_fstype "${cowprobe}") - else - [ "$quiet" != "y" ] && log_warning_msg "Unable to find the persistent medium" - fi - fi - - mount ${cowdevice} -t ${cow_fstype} -o rw /cow || panic "Can not mount $cowdevice on /cow" - - mount -t ${UNIONTYPE} -o dirs=/cow=rw:$rofsstring ${UNIONTYPE} "$rootmnt" || panic "${UNIONTYPE} mount failed" - - # Adding other custom mounts - if [ -n "${PERSISTENT}" ]; then - # directly mount /home - # FIXME: add a custom mounts configurable system - homecow=$(find_cow_device "${home_persistence}" ) - if [ -b "${homecow}" ]; then - mount -t $(get_fstype "${homecow}") -o rw "${homecow}" "${rootmnt}/home" - export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy() - else - [ "$quiet" != "y" ] && 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" - fi - - if [ -n "${SHOWMOUNTS}" ]; then - for d in ${rofslist}; do - mkdir -p "${rootmnt}/live/${d##*/}" - case d in - *.dir) # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}" - ;; - *) mount --move "${d}" "${rootmnt}/live/${d##*/}" - ;; - esac - done - fi - - # shows cow fs on /cow for use by live-snapshot - mkdir -p "${rootmnt}/live/cow" - mount -o bind /cow "${rootmnt}/live/cow" + [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})" + + mkdir -p "${croot}" + + for image in ${image_string} + do + imagename=$(basename "${image}") + + if [ -d "${image}" ] + then + # it is a plain directory: do nothing + rofsstring="${image}=${roopt}:${rofsstring}" + rofslist="${image} ${rofslist}" + elif [ -f "${image}" ] + then + backdev=$(get_backing_device "$image") + fstype=$(get_fstype "${backdev}") + + if [ "${fstype}" = "unknown" ] + then + panic "Unknown file system type on ${backdev} (${image})" + fi + + mkdir -p "${croot}/${imagename}" + echo "debug: Can not mount backdev $backdev (image = $image) on croot/imagename ${croot}/${imagename}" + mount -t "${fstype}" -o ro "${backdev}" "${croot}/${imagename}" || panic "Can not mount $backdev ($image) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}" + fi + done + + rofsstring=${rofsstring%:} + + mkdir -p /cow + cowdevice="tmpfs" + cow_fstype="tmpfs" + + # Looking for "${root_persistence}" device or file + if [ -n "${PERSISTENT}" ] + then + cowprobe=$(find_cow_device "${root_persistence}") + + if [ -b "${cowprobe}" ] + then + cowdevice=${cowprobe} + cow_fstype=$(get_fstype "${cowprobe}") + else + [ "$quiet" != "y" ] && log_warning_msg "Unable to find the persistent medium" + fi + fi + + mount ${cowdevice} -t ${cow_fstype} -o rw /cow || panic "Can not mount $cowdevice on /cow" + + mount -t ${UNIONTYPE} -o dirs=/cow=rw:$rofsstring ${UNIONTYPE} "$rootmnt" || panic "${UNIONTYPE} mount failed" + + # Adding other custom mounts + if [ -n "${PERSISTENT}" ] + then + # directly mount /home + # FIXME: add a custom mounts configurable system + homecow=$(find_cow_device "${home_persistence}" ) + + if [ -b "${homecow}" ] + then + mount -t $(get_fstype "${homecow}") -o rw "${homecow}" "${rootmnt}/home" + export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy() + else + [ "$quiet" != "y" ] && 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" + fi + + if [ -n "${SHOWMOUNTS}" ] + then + for d in ${rofslist} + do + mkdir -p "${rootmnt}/live/${d##*/}" + + case d in + *.dir) + # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}" + ;; + + *) + mount --move "${d}" "${rootmnt}/live/${d##*/}" + ;; + esac + done + fi + + # shows cow fs on /cow for use by live-snapshot + mkdir -p "${rootmnt}/live/cow" + mount -o bind /cow "${rootmnt}/live/cow" } check_dev () { - sysdev="${1}" - devname="${2}" - if [ -z "${devname}" ]; then - devname=$(sys2dev "${sysdev}") - fi - - if [ -n "${LIVE_MEDIA_OFFSET}" ]; then - loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '') - devname="${loopdevname}" - fi - - fstype=$(get_fstype "${devname}") - if is_supported_fs ${fstype}; then - mount -t ${fstype} -o ro "${devname}" $mountpoint || continue - if is_live_path $mountpoint; then - echo $mountpoint - return 0 - else - umount $mountpoint - fi - fi - - if [ -n "${LIVE_MEDIA_OFFSET}" ]; then - losetup -d "${loopdevname}" - fi - return 1 + sysdev="${1}" + devname="${2}" + + if [ -z "${devname}" ] + then + devname=$(sys2dev "${sysdev}") + fi + + if [ -n "${LIVE_MEDIA_OFFSET}" ] + then + loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '') + devname="${loopdevname}" + fi + + fstype=$(get_fstype "${devname}") + + if is_supported_fs ${fstype} + then + mount -t ${fstype} -o ro "${devname}" $mountpoint || continue + + if is_live_path $mountpoint + then + echo $mountpoint + return 0 + else + umount $mountpoint + fi + fi + + if [ -n "${LIVE_MEDIA_OFFSET}" ] + then + losetup -d "${loopdevname}" + fi + + return 1 } -find_livefs() { - timeout="${1}" - # first look at the one specified in the command line - if [ ! -z "${LIVE_MEDIA}" ]; then - if check_dev "null" "${LIVE_MEDIA}"; then - return 0 - fi - fi - # don't start autodetection before timeout has expired - if [ -n "${LIVE_MEDIA_TIMEOUT}" ]; then - if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]; then - return 1 - fi - fi - # or do the scan of block devices - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram); do - devname=$(sys2dev "${sysblock}") - fstype=$(get_fstype "${devname}") - if /lib/udev/cdrom_id ${devname} > /dev/null; then - if check_dev "null" "${devname}" ; then - return 0 - fi - elif is_nice_device "${sysblock}" ; then - for dev in $(subdevices "${sysblock}"); do - if check_dev "${dev}" ; then - return 0 - fi - done - elif [ "${fstype}" = "squashfs" -o \ - "${fstype}" = "ext2" -o \ - "${fstype}" = "ext3" ]; then - # This is an ugly hack situation, the block device has - # an image directly on it. It's hopefully - # live-initramfs, so take it and run with it. - ln -s "${devname}" "${devname}.${fstype}" - echo "${devname}.${fstype}" - return 0 - fi - done - return 1 +find_livefs () +{ + timeout="${1}" + + # first look at the one specified in the command line + if [ ! -z "${LIVE_MEDIA}" ] + then + if check_dev "null" "${LIVE_MEDIA}" + then + return 0 + fi + fi + + # don't start autodetection before timeout has expired + if [ -n "${LIVE_MEDIA_TIMEOUT}" ] + then + if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ] + then + return 1 + fi + fi + + # or do the scan of block devices + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram) + do + devname=$(sys2dev "${sysblock}") + fstype=$(get_fstype "${devname}") + + if /lib/udev/cdrom_id ${devname} > /dev/null + then + if check_dev "null" "${devname}" + then + return 0 + fi + elif is_nice_device "${sysblock}" + then + for dev in $(subdevices "${sysblock}") + do + if check_dev "${dev}" + then + return 0 + fi + done + elif [ "${fstype}" = "squashfs" -o \ + "${fstype}" = "ext2" -o \ + "${fstype}" = "ext3" ] + then + # This is an ugly hack situation, the block device has + # an image directly on it. It's hopefully + # live-initramfs, so take it and run with it. + ln -s "${devname}" "${devname}.${fstype}" + echo "${devname}.${fstype}" + return 0 + fi + done + + return 1 } -pulsate() { - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "PULSATE" - fi +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" - fi +set_usplash_timeout () +{ + if [ -x /sbin/usplash_write ] + then + /sbin/usplash_write "TIMEOUT 120" + fi } -mountroot() { - exec 6>&1 - exec 7>&2 - exec > live.log - exec 2>&1 - - Arguments - - set_usplash_timeout - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-premount" - pulsate - run_scripts /scripts/live-premount - [ "$quiet" != "y" ] && log_end_msg - - # Needed here too because some things (*cough* udev *cough*) - # changes the timeout - - set_usplash_timeout - - if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]; then - if do_netmount ; then - livefs_root="${mountpoint}" - else - panic "Unable to find a live file system on the network" - fi - 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; do - livefs_root=$(find_livefs $i) - if [ -n "${livefs_root}" ]; then - break - fi - sleep 1 - done - fi - - if [ -z "${livefs_root}" ]; then - panic "Unable to find a medium containing a live file system" - fi - - if [ "${TORAM}" ]; then - live_dest="ram" - elif [ "${TODISK}" ]; then - live_dest="${TODISK}" - fi - if [ "${live_dest}" ]; then - log_begin_msg "Copying live media to ${live_dest}" - copy_live_to "${livefs_root}" "${live_dest}" - log_end_msg - fi - - mount_images_in_directory "${livefs_root}" "${rootmnt}" - - log_end_msg - - maybe_break live-bottom - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-bottom" - - pulsate - run_scripts /scripts/live-bottom - [ "$quiet" != "y" ] && log_end_msg - - exec 1>&6 6>&- - exec 2>&7 7>&- - cp live.log "${rootmnt}/var/log/" +mountroot () +{ + exec 6>&1 + exec 7>&2 + exec > live.log + exec 2>&1 + + Arguments + + set_usplash_timeout + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-premount" + pulsate + run_scripts /scripts/live-premount + [ "$quiet" != "y" ] && log_end_msg + + # Needed here too because some things (*cough* udev *cough*) + # changes the timeout + + set_usplash_timeout + + if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] + then + if do_netmount + then + livefs_root="${mountpoint}" + else + panic "Unable to find a live file system on the network" + fi + 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 + do + livefs_root=$(find_livefs $i) + + if [ -n "${livefs_root}" ] + then + break + fi + + sleep 1 + done + fi + + if [ -z "${livefs_root}" ] + then + panic "Unable to find a medium containing a live file system" + fi + + if [ "${TORAM}" ] + then + live_dest="ram" + elif [ "${TODISK}" ] + then + live_dest="${TODISK}" + fi + + if [ "${live_dest}" ] + then + log_begin_msg "Copying live media to ${live_dest}" + copy_live_to "${livefs_root}" "${live_dest}" + log_end_msg + fi + + if [ -n "${MODULETORAMFILE}" ] + then + setup_unionfs "${livefs_root}" "$rootmnt" + else + mount_images_in_directory "${livefs_root}" "${rootmnt}" + fi + + log_end_msg + + maybe_break live-bottom + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-bottom" + + pulsate + run_scripts /scripts/live-bottom + [ "$quiet" != "y" ] && log_end_msg + + exec 1>&6 6>&- + exec 2>&7 7>&- + cp live.log "${rootmnt}/var/log/" } diff --git a/scripts/live-bottom/02etc_live_conf b/scripts/live-bottom/02etc_live_conf index e52d913..48b12d1 100755 --- a/scripts/live-bottom/02etc_live_conf +++ b/scripts/live-bottom/02etc_live_conf @@ -26,17 +26,21 @@ log_begin_msg "Copying config on real root fs..." # live-initramfs script -if [ -f /etc/live.conf ] ; then - if [ ! -z "${LIVECONF}" ]; then - # Updating live.conf - sed -i -e 's/\(USERNAME="\).*"/\1'"${USERNAME}"'"/g' \ - -e 's/\(USERFULLNAME="\).*"/\1'"${USERFULLNAME}"'"/g' \ - -e 's/\(HOSTNAME="\).*"/\1'"${HOSTNAME}"'"/g' /etc/live.conf - fi - cp -p /etc/live.conf /root/etc/live.conf - +if [ -f /etc/live.conf ] +then + if [ ! -z "${LIVECONF}" ] + then + # Updating live.conf + sed -i -e 's/\(USERNAME="\).*"/\1'"${USERNAME}"'"/g' \ + -e 's/\(USERFULLNAME="\).*"/\1'"${USERFULLNAME}"'"/g' \ + -e 's/\(HOSTNAME="\).*"/\1'"${HOSTNAME}"'"/g' \ + /etc/live.conf + fi + + cp -p /etc/live.conf /root/etc/live.conf else - cat </root/etc/live.conf + +cat > /root/etc/live.conf << EOF export USERNAME="$USERNAME" export USERFULLNAME="$USERFULLNAME" export HOSTNAME="$HOSTNAME" diff --git a/scripts/live-bottom/02timezone b/scripts/live-bottom/02timezone index dad3cad..e272da9 100755 --- a/scripts/live-bottom/02timezone +++ b/scripts/live-bottom/02timezone @@ -20,26 +20,36 @@ esac # live-initramfs header +if [ -n "${NOTIMEZONE}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Setting timezone..." # live-initramfs script -if [ -n "${TIMEZONE}" ]; then - area="$(echo ${TIMEZONE} | cut -f1 -d '/')" - zone="$(echo ${TIMEZONE} | cut -f2 -d '/')" - chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set tzdata/Areas $area set tzdata/Zones/$area $zone EOF - cp -f /root/usr/share/zoneinfo/${area}/${zone} /root/etc/localtime + + cp -f /root/usr/share/zoneinfo/${area}/${zone} /root/etc/localtime else - chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set tzdata/Areas Etc set tzdata/Zones/Etc UTC EOF - cp -f /root/usr/share/zoneinfo/UTC /root/etc/localtime + + cp -f /root/usr/share/zoneinfo/UTC /root/etc/localtime fi if [ -n "${UTC}" ] diff --git a/scripts/live-bottom/05mountpoints b/scripts/live-bottom/05mountpoints index 028c74b..a334af8 100755 --- a/scripts/live-bottom/05mountpoints +++ b/scripts/live-bottom/05mountpoints @@ -27,9 +27,10 @@ log_begin_msg "Moving mount points..." # live-initramfs script # Move to the new root filesystem so that programs there can get at it. -if [ ! -d /root/live/image ]; then - mkdir -p /root/live/image - mount -n --move /live/image /root/live/image +if [ ! -d /root/live/image ] +then + mkdir -p /root/live/image + mount -n --move /live/image /root/live/image fi log_end_msg diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser index 0f28def..4c83fa3 100755 --- a/scripts/live-bottom/10adduser +++ b/scripts/live-bottom/10adduser @@ -20,20 +20,26 @@ esac # live-initramfs header +if [ -n "${NOUSER}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Adding live session user..." # live-initramfs script -if [ "${BUILD_SYSTEM}" = "Debian" ]; then - user_crypted="8Ab05sVQ4LLps" # as in `echo "live" | mkpasswd -s` +if [ "${BUILD_SYSTEM}" = "Debian" ] +then + user_crypted="8Ab05sVQ4LLps" # as in `echo "live" | mkpasswd -s` else - user_crypted="U6aMy0wojraho" # "ubuntu" + user_crypted="U6aMy0wojraho" # "ubuntu" fi # U6aMy0wojraho is just a blank password -chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set passwd/make-user true set passwd/root-password-crypted * set passwd/user-password-crypted ${user_crypted} @@ -42,16 +48,17 @@ set passwd/username $USERNAME set passwd/user-uid 999 EOF -if [ "${BUILD_SYSTEM}" = "Debian" ]; then - chroot /root /usr/bin/env -i HOME="/root" \ - TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \ - /usr/lib/user-setup/user-setup-apply > /dev/null +if [ "${BUILD_SYSTEM}" = "Debian" ] +then + chroot /root /usr/bin/env -i HOME="/root" \ + TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \ + /usr/lib/user-setup/user-setup-apply > /dev/null else - chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null + chroot /root /usr/lib/user-setup/user-setup-apply > /dev/null fi # Clear out debconf database again to avoid confusing ubiquity later. -chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set passwd/make-user set passwd/root-password-crypted set passwd/user-password-crypted @@ -62,54 +69,58 @@ EOF if [ -z "${NOSUDO}" ] then - -if [ -f /root/etc/sudoers ]; then - if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then - grep -q '^%admin' /root/etc/sudoers && sed -i -e '/^%admin/s/ALL$/NOPASSWD: ALL/' /root/etc/sudoers || echo '%admin ALL=(ALL) NOPASSWD: ALL' >> /root/etc/sudoers - - # XXX - awful hack to stop xscreensaver locking the screen (#7150) - echo 'RUNNING_UNDER_GDM="yes"' >> /root/etc/environment - - for file in /usr/share/applications/ubiquity-gtkui.desktop /usr/share/applications/kde/ubiquity-kdeui.desktop; do - if [ -f "/root/$file" ]; then - chroot /root install -D -o $USERNAME -g $USERNAME $file /home/$USERNAME/Desktop/$(basename "$file") - break - fi - done - elif [ "${BUILD_SYSTEM}" = "Debian" ]; then - echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers - - chroot /root sudo -u "${USERNAME}" sh -c "echo 'SU_TO_ROOT_SU=sudo' >> /home/${USERNAME}/.su-to-rootrc" - - chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true - chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false + if [ -f /root/etc/sudoers ] + then + if [ "${BUILD_SYSTEM}" = "Ubuntu" ] + then + grep -q '^%admin' /root/etc/sudoers && sed -i -e '/^%admin/s/ALL$/NOPASSWD: ALL/' /root/etc/sudoers || echo '%admin ALL=(ALL) NOPASSWD: ALL' >> /root/etc/sudoers + + # XXX - awful hack to stop xscreensaver locking the screen (#7150) + echo 'RUNNING_UNDER_GDM="yes"' >> /root/etc/environment + + for file in /usr/share/applications/ubiquity-gtkui.desktop /usr/share/applications/kde/ubiquity-kdeui.desktop + do + if [ -f "/root/$file" ] + then + chroot /root install -D -o $USERNAME -g $USERNAME $file /home/$USERNAME/Desktop/$(basename "$file") + break + fi + done + elif [ "${BUILD_SYSTEM}" = "Debian" ] + then + echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers + + chroot /root sudo -u "${USERNAME}" sh -c "echo 'SU_TO_ROOT_SU=sudo' >> /home/${USERNAME}/.su-to-rootrc" + chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true + chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/config && cat > /home/${USERNAME}/.kde/share/config/kdesurc" << EOF [super-user-command] super-user-command=sudo EOF - if [ -f /root/usr/share/apps/konsole/sumc.desktop ] - then - chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo mc -c/' /usr/share/apps/konsole/sumc.desktop > /home/${USERNAME}/.kde/share/apps/konsole/sumc.desktop" - fi + if [ -f /root/usr/share/apps/konsole/sumc.desktop ] + then + chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo mc -c/' /usr/share/apps/konsole/sumc.desktop > /home/${USERNAME}/.kde/share/apps/konsole/sumc.desktop" + fi - if [ -f /root/usr/share/apps/konsole/su.desktop ] - then - chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo -i/' /usr/share/apps/konsole/su.desktop > /home/${USERNAME}/.kde/share/apps/konsole/su.desktop" + if [ -f /root/usr/share/apps/konsole/su.desktop ] + then + chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo -i/' /usr/share/apps/konsole/su.desktop > /home/${USERNAME}/.kde/share/apps/konsole/su.desktop" + fi + fi fi - fi fi +if [ -L /root/home/$USERNAME/Examples ] +then + chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/ + mv /root/home/$USERNAME/Examples /root/home/$USERNAME/Desktop/ fi -if [ -L /root/home/$USERNAME/Examples ]; then - chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/ - mv /root/home/$USERNAME/Examples /root/home/$USERNAME/Desktop/ -fi - -if [ -f "/root/usr/share/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop.tobemoved" ]; then - chroot /root install -D -o $USERNAME -g $USERNAME /usr/share/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop.tobemoved /home/$USERNAME/Desktop/about-kubuntu.desktop +if [ -f "/root/usr/share/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop.tobemoved" ] +then + chroot /root install -D -o $USERNAME -g $USERNAME /usr/share/apps/khelpcenter/plugins/kubuntu/about-kubuntu.desktop.tobemoved /home/$USERNAME/Desktop/about-kubuntu.desktop fi log_end_msg diff --git a/scripts/live-bottom/12fstab b/scripts/live-bottom/12fstab index b5b5602..73e18d4 100755 --- a/scripts/live-bottom/12fstab +++ b/scripts/live-bottom/12fstab @@ -22,6 +22,11 @@ esac . /scripts/live-functions +if [ -n "${NOFSTAB}" ] +then + exit 0 +fi + log_begin_msg "Configuring fstab..." # live-initramfs script diff --git a/scripts/live-bottom/13swap b/scripts/live-bottom/13swap index 8b47a00..4980433 100755 --- a/scripts/live-bottom/13swap +++ b/scripts/live-bottom/13swap @@ -20,7 +20,7 @@ esac # live-initramfs header -if [ -n "${NOSWAP}" ] +if [ -n "${NOSWAP}" ] || [ -n "${NOFSTAB}" ] then exit 0 fi @@ -32,25 +32,31 @@ log_begin_msg "Setting up swap..." # live-initramfs script FSTAB=/root/etc/fstab - devices="" -for device in /dev/[hs]d[a-z][0-9]*; do - if ! [ -b "$device" ]; then - continue - fi - magic=$(/bin/dd if="$device" bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null) || continue +for device in /dev/[hs]d[a-z][0-9]* +do + if ! [ -b "$device" ] + then + continue + fi + + magic=$(/bin/dd if="$device" bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null) || continue - if [ "$magic" = "SWAPSPACE2" -o "$magic" = "SWAP-SPACE" ]; then -# log "Found $device" - devices="$devices $device" - fi + if [ "$magic" = "SWAPSPACE2" -o "$magic" = "SWAP-SPACE" ] + then + #log "Found $device" + devices="$devices $device" + fi done -for device in $devices; do - cat >> $FSTAB <> $FSTAB << EOF $device swap swap defaults 0 0 EOF + done log_end_msg diff --git a/scripts/live-bottom/14locales b/scripts/live-bottom/14locales index bdb1d8b..2de535e 100755 --- a/scripts/live-bottom/14locales +++ b/scripts/live-bottom/14locales @@ -20,65 +20,84 @@ esac # live-initramfs header +if [ -n "${NOLOCALES}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Setting up locales..." # live-initramfs script -if [ -e /root/etc/default/locale ]; then - grep_file=/root/etc/default/locale -elif [ -e /root/etc/environment ]; then # Old locales policy - grep_file=/root/etc/environment +if [ -e /root/etc/default/locale ] +then + grep_file=/root/etc/default/locale +elif [ -e /root/etc/environment ] +then + # Old locales policy + grep_file=/root/etc/environment fi -if [ -n "${grep_file}" ]; then - # use rootfs configured locale - locale=$(grep -s 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' ) +if [ -n "${grep_file}" ] +then + # use rootfs configured locale + locale=$(grep -s 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' ) else - grep_file=/root/etc/default/locale + grep_file=/root/etc/default/locale fi -if [ -n "${LOCALE}" ]; then - locale="${LOCALE}" - set_locale="true" +if [ -n "${LOCALE}" ] +then + locale="${LOCALE}" + set_locale="true" fi -if [ -z "${locale}" ]; then - # Set a default one - locale=en_US.UTF-8 - set_locale="true" +if [ -z "${locale}" ] +then + # Set a default one + locale=en_US.UTF-8 + set_locale="true" fi -if [ "${set_locale}" ]; then - if echo "${locale}" | grep -sqE '^[[:lower:]]{2}$' ; then - # input is like "locale=it", so we will convert and setup also the keyboard if not already set - if [ -z "${KBD}" ]; then - # FIXME: look if this keyb is supported - KBD="${locale}" - really_export KBD - fi - uploc=$(echo "${locale}" | tr '[a-z]' '[A-Z]') - locale="${locale}_${uploc}.UTF-8" - fi - LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 |sed -e 's, .*,,' -e q) - if [ -z "${LANG}" ]; then - log_warning_message "Locale ${locale} is unsupported." - locale="en_US.UTF-8" - LANG="${locale}" - fi - - really_export LANG - - if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then - printf 'LANG="%s"\n' "${LANG}" > "${grep_file}" - chroot /root /usr/sbin/locale-gen "${LANG}" - live-preseed /root debian-installer/locale "${locale}" - else - printf 'LANG=%s\n' "${LANG}" > "${grep_file}" - printf '%s UTF-8\n' "${LANG}" > /root/etc/locale.gen - chroot /root /usr/sbin/locale-gen - fi +if [ "${set_locale}" ] +then + if echo "${locale}" | grep -sqE '^[[:lower:]]{2}$' + then + # input is like "locale=it", so we will convert and setup also the keyboard if not already set + if [ -z "${KBD}" ] + then + # FIXME: look if this keyb is supported + KBD="${locale}" + really_export KBD + fi + + uploc=$(echo "${locale}" | tr '[a-z]' '[A-Z]') + locale="${locale}_${uploc}.UTF-8" + fi + + LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 | sed -e 's, .*,,' -e q) + + if [ -z "${LANG}" ] + then + log_warning_message "Locale ${locale} is unsupported." + locale="en_US.UTF-8" + LANG="${locale}" + fi + + really_export LANG + + if [ "${BUILD_SYSTEM}" = "Ubuntu" ] + then + printf 'LANG="%s"\n' "${LANG}" > "${grep_file}" + chroot /root /usr/sbin/locale-gen "${LANG}" + live-preseed /root debian-installer/locale "${locale}" + else + printf 'LANG=%s\n' "${LANG}" > "${grep_file}" + printf '%s UTF-8\n' "${LANG}" > /root/etc/locale.gen + chroot /root /usr/sbin/locale-gen + fi fi log_end_msg diff --git a/scripts/live-bottom/15autologin b/scripts/live-bottom/15autologin index 4de38f9..40383cb 100755 --- a/scripts/live-bottom/15autologin +++ b/scripts/live-bottom/15autologin @@ -26,55 +26,45 @@ log_begin_msg "Setting up automatic login..." # live-initramfs script -if [ -z "${NOXAUTOLOGIN}" ] +if [ -n "${NOXAUTOLOGIN}" ] then + exit 0 +fi # chroot needed to handle symlinks correctly -if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]; then - GDMCONF=/etc/gdm/gdm-cdd.conf +if chroot /root [ -f /etc/gdm/gdm-cdd.conf ] +then + GDMCONF=/etc/gdm/gdm-cdd.conf else - GDMCONF=/etc/gdm/gdm.conf + GDMCONF=/etc/gdm/gdm.conf fi # chroot needed to handle symlinks correctly -if chroot /root [ -f ${GDMCONF} ]; then - if [ "${BUILD_SYSTEM}" = "Debian" ]; then - # true hack ! -- nohar - chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf - fi - - # Configure GDM autologin - chroot /root sed -i \ - -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \ - -e "s/^AutomaticLogin=.*\$/AutomaticLogin=$USERNAME/" \ - -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \ - -e "s/^TimedLogin=.*\$/TimedLogin=$USERNAME/" \ - -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \ - ${GDMCONF} -fi - -if [ -f /root/etc/kde3/kdm/kdmrc ]; then - # Configure KDM autologin - sed -i -r \ - -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \ - -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USERNAME/" \ - -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \ - /root/etc/kde3/kdm/kdmrc -fi - +if chroot /root [ -f ${GDMCONF} ] +then + if [ "${BUILD_SYSTEM}" = "Debian" ] + then + # true hack ! -- nohar + chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf + fi + + # Configure GDM autologin + chroot /root \ + sed -i -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \ + -e "s/^AutomaticLogin=.*\$/AutomaticLogin=$USERNAME/" \ + -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \ + -e "s/^TimedLogin=.*\$/TimedLogin=$USERNAME/" \ + -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \ + ${GDMCONF} fi -if chroot /root /usr/bin/which kpersonalizer >/dev/null; then - # Disable first-login wizard for KDE - if [ ! -f /root/etc/kde3/kpersonalizerrc ]; then - cat > /root/etc/kde3/kpersonalizerrc <&2 - echo "Because kpersonalizerrc already exists" >&2 - fi +if [ -f /root/etc/kde3/kdm/kdmrc ] +then + # Configure KDM autologin + sed -i -r -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \ + -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USERNAME/" \ + -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \ + /root/etc/kde3/kdm/kdmrc fi log_end_msg diff --git a/scripts/live-bottom/18hostname b/scripts/live-bottom/18hostname index 430d0a0..ac35389 100755 --- a/scripts/live-bottom/18hostname +++ b/scripts/live-bottom/18hostname @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOHOSTS}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Setting hostname..." @@ -27,7 +32,8 @@ log_begin_msg "Setting hostname..." # live-initramfs script echo "$HOSTNAME" > /root/etc/hostname -cat >> /root/etc/hosts <> /root/etc/hosts << EOF 127.0.0.1 localhost 127.0.1.1 $HOSTNAME @@ -38,7 +44,6 @@ ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts - EOF log_end_msg diff --git a/scripts/live-bottom/19keyboard b/scripts/live-bottom/19keyboard index 974b847..ef91c90 100755 --- a/scripts/live-bottom/19keyboard +++ b/scripts/live-bottom/19keyboard @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOCONSOLEKEYBOARD}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Setting up console keyboard..." @@ -32,50 +37,63 @@ csvariant= csmodel= # commandline -if [ -n "${KBD}" ]; then - kbd="${KBD}" +if [ -n "${KBD}" ] +then + kbd="${KBD}" else - kbd=us + kbd=us fi really_export kbd -if [ -n "${KLAYOUT}" ]; then - cslayout="${KLAYOUT}" +if [ -n "${KLAYOUT}" ] +then + cslayout="${KLAYOUT}" fi -if [ -n "${KVARIANT}" ]; then - csvariant="${KVARIANT}" + +if [ -n "${KVARIANT}" ] +then + csvariant="${KVARIANT}" fi -if [ -n "${KMODEL}" ]; then - csmodel="${KMODEL}" + +if [ -n "${KMODEL}" ] +then + csmodel="${KMODEL}" fi -if [ -x /root/bin/setupcon ] && [ -f /root/etc/default/console-setup ]; then - if [ "$cslayout" ]; then - chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"$cslayout\"/" \ - /etc/default/console-setup - if [ "$csvariant" ]; then - chroot /root sed -i "s/^XKBVARIANT=.*/XKBVARIANT=\"$csvariant\"/" \ - /etc/default/console-setup - else - live-preseed /root console-setup/variantcode '' false - fi - if [ "$csmodel" ]; then - chroot /root sed -i "s/^XKBMODEL=.*/XKBMODEL=\"$csmodel\"/" \ - /etc/default/console-setup - else - live-preseed /root console-setup/modelcode '' false - fi - else - live-preseed /root console-setup/layoutcode '' false - live-preseed /root console-setup/variantcode '' false - live-preseed /root console-setup/modelcode '' false - fi +if [ -x /root/bin/setupcon ] && [ -f /root/etc/default/console-setup ] +then + if [ "$cslayout" ] + then + chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"$cslayout\"/" \ + /etc/default/console-setup + + if [ "$csvariant" ] + then + chroot /root sed -i "s/^XKBVARIANT=.*/XKBVARIANT=\"$csvariant\"/" \ + /etc/default/console-setup + else + live-preseed /root console-setup/variantcode '' false + fi + + if [ "$csmodel" ] + then + chroot /root sed -i "s/^XKBMODEL=.*/XKBMODEL=\"$csmodel\"/" \ + /etc/default/console-setup + else + live-preseed /root console-setup/modelcode '' false + fi + else + live-preseed /root console-setup/layoutcode '' false + live-preseed /root console-setup/variantcode '' false + live-preseed /root console-setup/modelcode '' false + fi 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 - live-preseed /root debian-installer/keymap "$kbd" + chroot /root /usr/sbin/install-keymap $kbd + live-preseed /root debian-installer/keymap "$kbd" live-preseed /root kbd-chooser/method "$kbd" fi + log_end_msg diff --git a/scripts/live-bottom/20xconfig b/scripts/live-bottom/20xconfig index 1105e4a..902335e 100755 --- a/scripts/live-bottom/20xconfig +++ b/scripts/live-bottom/20xconfig @@ -20,16 +20,22 @@ esac # live-initramfs header +if [ -n "${NOXAUTOCONFIG}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Configuring X..." # live-initramfs script -if [ "$TERM_TYPE" = "serial" ]; then - # Don't bother trying to configure or start X on a serial console - rm -f /etc/rc?.d/S??[gxk]dm - exit 0 +if [ "$TERM_TYPE" = "serial" ] +then + # Don't bother trying to configure or start X on a serial console + rm -f /etc/rc?.d/S??[gxk]dm + exit 0 fi locale=en_US.UTF-8 @@ -38,34 +44,44 @@ mount -n -o bind /sys /root/sys mount -n -o bind /proc /root/proc mount -n -o bind /dev /root/dev -if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]; then - # xdebconfigurator - chroot /root /usr/sbin/xdebconfigurator +if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ] +then + # xdebconfigurator + chroot /root /usr/sbin/xdebconfigurator fi -if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then - chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set xserver-xorg/autodetect_keyboard true fset xserver-xorg/autodetect_keyboard seen true EOF + else - # d-i code not present, so: - if [ -n "${KOPTIONS}" ]; then - setoptions="set xserver-xorg/config/inputdevice/keyboard/options ${KOPTIONS}" - fi - if [ -n "${KVARIANT}" ]; then - setvariant="set xserver-xorg/config/inputdevice/keyboard/variant ${KVARIANT}" - fi - if [ -n "${KMODEL}" ]; then - setmodel="set xserver-xorg/config/inputdevice/keyboard/model ${KMODEL}" - fi - - chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null < /dev/null << EOF set xserver-xorg/config/inputdevice/keyboard/layout ${kbd} ${setvariant} ${setmodel} ${setoptions} EOF + fi DEBUG_XORG_PACKAGE=1 DEBUG_XORG_DEBCONF=1 live-reconfigure /root xserver-xorg diff --git a/scripts/live-bottom/21xvidemode b/scripts/live-bottom/21xvidemode index 944bd33..a11dc77 100755 --- a/scripts/live-bottom/21xvidemode +++ b/scripts/live-bottom/21xvidemode @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOXAUTOCONFIG}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Configuring X kludges..." diff --git a/scripts/live-bottom/22gnome_panel_data b/scripts/live-bottom/22gnome_panel_data index 34f0be1..8e071d3 100755 --- a/scripts/live-bottom/22gnome_panel_data +++ b/scripts/live-bottom/22gnome_panel_data @@ -20,22 +20,30 @@ esac # live-initramfs header -. /scripts/live-functions +if [ -n "${NOGNOMEPANEL}" ] +then + exit 0 +fi +. /scripts/live-functions log_begin_msg "Configuring gnome-panel-data..." # live-initramfs script -if [ -x /root/usr/sbin/laptop-detect ]; then - if chroot /root laptop-detect; then - live-reconfigure /root gnome-panel-data +if [ -x /root/usr/sbin/laptop-detect ] +then + if chroot /root laptop-detect + then + live-reconfigure /root gnome-panel-data fi fi panel_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-panel-data 2>/dev/null) || panel_version="" -if [ -n "$panel_version" ]; then - chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true + +if [ -n "$panel_version" ] +then + chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true fi log_end_msg diff --git a/scripts/live-bottom/22screensaver b/scripts/live-bottom/22screensaver index c800bfb..e161da6 100755 --- a/scripts/live-bottom/22screensaver +++ b/scripts/live-bottom/22screensaver @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOXSCREENSAVER}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Configuring screensaver..." diff --git a/scripts/live-bottom/23etc_modules b/scripts/live-bottom/23etc_modules index 82be075..b73a107 100755 --- a/scripts/live-bottom/23etc_modules +++ b/scripts/live-bottom/23etc_modules @@ -26,11 +26,11 @@ log_begin_msg "Preconfiguring /etc/modules..." # live-initramfs script -case "$DPKG_ARCH" in # load the right modules -powerpc|ppc64) - echo snd_powermac >> /root/etc/modules - ;; +case "$DPKG_ARCH" in + powerpc|ppc64) + echo snd_powermac >> /root/etc/modules + ;; esac log_end_msg diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking index 353cda5..c6ec9cc 100755 --- a/scripts/live-bottom/23networking +++ b/scripts/live-bottom/23networking @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NONETWORKING}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Preconfiguring networking..." @@ -28,13 +33,14 @@ log_begin_msg "Preconfiguring networking..." IFFILE="/root/etc/network/interfaces" -if [ "${STATICIP}" = "frommedia" -a -e "$IFFILE" ] ; then - # will use existent /etc/network/interfaces - log_end_msg - exit 0 +if [ "${STATICIP}" = "frommedia" -a -e "$IFFILE" ] +then + # will use existent /etc/network/interfaces + log_end_msg + exit 0 fi -cat > "$IFFILE" < "$IFFILE" << EOF auto lo iface lo inet loopback @@ -43,14 +49,18 @@ EOF udevtrigger udevsettle -if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]; then - parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g') - for ifline in ${parsed}; do - ifname="$(echo ${ifline} | cut -f1 -d ',')" - ifaddress="$(echo ${ifline} | cut -f2 -d ',')" - ifnetmask="$(echo ${ifline} | cut -f3 -d ',')" - ifgateway="$(echo ${ifline} | cut -f4 -d ',')" - cat >> "$IFFILE" <> "$IFFILE" << EOF auto ${ifname} iface ${ifname} inet static address ${ifaddress} @@ -58,39 +68,51 @@ iface ${ifname} inet static gateway ${ifgateway} EOF - done + + done else - if [ -z "${NETBOOT}" ]; then - # default, dhcp assigned - method="dhcp" - else - # make sure that the preconfigured interface would not get reassigned by dhcp - # on startup by ifup script - otherwise our root fs might be disconnected! - method="manual" - fi - # iterate the physical interfaces and add them to the interfaces list - for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*; do - [ -e $interface ] || continue - i="$(basename $interface)" - cat >> "$IFFILE" <> "$IFFILE" << EOF auto $i iface $i inet $method EOF - done - if [ ! -f /root/etc/resolv.conf -a -f /netboot.config ] ; then - # create a resolv.conf if it is not present - cp /netboot.config /root/var/log/netboot.config - rc_search=$(cat netboot.config | awk '/domain/{print $3}') - rc_server0=$(cat netboot.config | awk '/dns0/{print $5}') - rc_server1=$(cat netboot.config | awk '/dns0/{print $8}') - rc_server0="nameserver ${rc_server0}" - if [ "${rc_server1}" = "0.0.0.0" ]; then - rc_server1="" - else - rc_server1="nameserver ${rc_server1}" - fi - cat > /root/etc/resolv.conf < /root/etc/resolv.conf << EOF # /etc/resolv.conf # Autogenerated by live-initramfs search ${rc_search} @@ -98,17 +120,21 @@ domain ${rc_search} ${rc_server0} ${rc_server1} EOF - cat /root/etc/resolv.conf >> /root/var/log/netboot.config - fi + + cat /root/etc/resolv.conf >> /root/var/log/netboot.config + fi fi -#for i in eth0 eth1 eth2 ath0 wlan0; do -# grep -q "iface $i" $IFFILE && continue -# cat >> "$IFFILE" <> "$IFFILE" << EOF #auto $i #iface $i inet dhcp # #EOF +# #done log_end_msg diff --git a/scripts/live-bottom/24preseed b/scripts/live-bottom/24preseed index 55fbfc3..f4b2db0 100755 --- a/scripts/live-bottom/24preseed +++ b/scripts/live-bottom/24preseed @@ -20,26 +20,36 @@ esac # live-initramfs header +if [ -n "${NOPRESEED}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Loading preseed file..." # live-initramfs script -if [ -e /preseed.cfg ]; then - chroot /root debconf-set-selections < /preseed.cfg +if [ -e /preseed.cfg ] +then + chroot /root debconf-set-selections < /preseed.cfg fi -if [ -f "/root/${LOCATION}" ]; then - chroot /root debconf-set-selections < "/root/${LOCATION}" +if [ -f "/root/${LOCATION}" ] +then + chroot /root debconf-set-selections < "/root/${LOCATION}" fi -if [ -n "${PRESEEDS}" ]; then - for preseed in ${PRESEEDS}; do - question="${preseed%%=*}" - value="${preseed#*=}" - live-preseed /root "${question}" "${value}" - done +if [ -n "${PRESEEDS}" ] +then + for preseed in ${PRESEEDS} + do + question="${preseed%%=*}" + value="${preseed#*=}" + + live-preseed /root "${question}" "${value}" + done fi log_end_msg diff --git a/scripts/live-bottom/25configure_init b/scripts/live-bottom/25configure_init index d007556..1ed4445 100755 --- a/scripts/live-bottom/25configure_init +++ b/scripts/live-bottom/25configure_init @@ -30,81 +30,104 @@ log_begin_msg "Setting up init..." if [ -z "${NOAUTOLOGIN}" ] then + if [ -n "$USERNAME" ] + then + if [ ! -z "${LIVE_GETTY}" ] + then + if echo "${DEFCONSOLE}" | grep -qs ttyS + then + # AUTOMATIC SERIAL CONSOLE # + PORT=$(echo "${DEFCONSOLE}" | \ + sed -e 's%,.*%%') + SPEED=$(echo "${DEFCONSOLE}" | \ + sed -e 's%ttyS[0-9]\+,%%' \ + -e's%\([0-9]\+\).*%\1%') + + if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" ) + then + IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9" + + for ID1 in $IDs + do + for ID2 in $IDs + do + ID="${ID1}${ID2}" + + if ! grep "^${ID}:" /etc/inittab + then + #make sure it is not already in use + break 2 + fi + done + done + + echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" >> /root/etc/inittab + fi + fi + + if [ -f /root/etc/inittab ] + then + sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab + fi + else + if [ -f /root/etc/inittab ] + then + sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f $USERNAME /dev/\2 2>\&1|" /root/etc/inittab + fi + + if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ] + then + for f in /root/etc/event.d/tty* + do + sed -i -e "s|^respawn.*|respawn /bin/login -f $USERNAME /dev/$(basename $f) 2>\&1|" $f + done + + if [ "${BUILD_SYSTEM}" = "Ubuntu" ] + then + for x in $(cat /proc/cmdline) + do + case $x in + noninteractive) + sed -i -e "s|^exec.*|exec /usr/bin/ubiquity noninteractive /dev/tty1 2>\&1|" /root/etc/event.d/tty1 + rm -f /root/etc/rc?.d/[SK]??gdm + rm -f /root/etc/rc?.d/[SK]??kdm + ;; + esac + done + fi + fi + fi + + # Since we use autologin, lastlog doesn't make sense on the console. + sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login + fi +fi -if [ -n "$USERNAME" ]; then - if [ ! -z "${LIVE_GETTY}" ]; then - if echo "${DEFCONSOLE}" | grep -qs ttyS; then - # AUTOMATIC SERIAL CONSOLE # - PORT=$(echo "${DEFCONSOLE}" | \ - sed -e 's%,.*%%') - SPEED=$(echo "${DEFCONSOLE}" | \ - sed -e 's%ttyS[0-9]\+,%%' \ - -e's%\([0-9]\+\).*%\1%') - if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" ) ; then - IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9" - for ID1 in $IDs; do - for ID2 in $IDs; do - ID="${ID1}${ID2}" - if ! grep "^${ID}:" /etc/inittab ; then - #make sure it is not already in use - break 2 - fi - done - done - echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" \ - >>/root/etc/inittab - fi - fi - if [ -f /root/etc/inittab ]; then - sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab - fi - else - if [ -f /root/etc/inittab ]; then - sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f $USERNAME /dev/\2 2>\&1|" /root/etc/inittab - fi - if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]; then - for f in /root/etc/event.d/tty*; do - sed -i -e "s|^respawn.*|respawn /bin/login -f $USERNAME /dev/$(basename $f) 2>\&1|" $f - done - - if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then - for x in $(cat /proc/cmdline); do - case $x in - noninteractive) - sed -i -e "s|^exec.*|exec /usr/bin/ubiquity noninteractive /dev/tty1 2>\&1|" /root/etc/event.d/tty1 - rm -f /root/etc/rc?.d/[SK]??gdm - rm -f /root/etc/rc?.d/[SK]??kdm - ;; - esac +# do not try to remove files if using file-rc +if [ -d /etc/rc0.d ] +then + # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in + # /etc/crontab remaining disabled, yet also not run by anacron + if [ -x /root/etc/init.d/anacron ] + then + for f in /root/etc/rc?.d/S??anacron + do + mv ${f} ${f%/*}/K00anacron done - fi - fi - fi - - # Since we use autologin, lastlog doesn't make sense on the console. - sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login -fi + fi -fi + # No point, really + rm -f /root/etc/rc?.d/[SK]??postfix -# This has the nice side effect of the cron.{daily,weekly,monthly} jobs in -# /etc/crontab remaining disabled, yet also not run by anacron -if [ -x /root/etc/init.d/anacron ]; then - for f in /root/etc/rc?.d/S??anacron; do - mv ${f} ${f%/*}/K00anacron - done + # Avoid clobbering the user's clock + rm -f /root/etc/rc?.d/K??hwclock.sh fi -# No point, really -rm -f /root/etc/rc?.d/[SK]??postfix - -# Avoid clobbering the user's clock -rm -f /root/etc/rc?.d/K??hwclock.sh - # Disable readahead since it doesn't play well with squashfs + unionfs # use chmod instead of mv to not trigger unionfs bugs. -if [ -e /root/sbin/readahead-list ]; then - chmod -x /root/sbin/readahead-list +if [ -e /root/sbin/readahead-list ] +then + chmod -x /root/sbin/readahead-list fi log_end_msg diff --git a/scripts/live-bottom/30accessibility b/scripts/live-bottom/30accessibility index ac8d12e..17defbf 100755 --- a/scripts/live-bottom/30accessibility +++ b/scripts/live-bottom/30accessibility @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOACCESSIBILITY}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Configuring accessibility options..." @@ -28,95 +33,117 @@ log_begin_msg "Configuring accessibility options..." gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version="" -gct() { - if [ "$gconf_version" ]; then - chroot /root sudo -u "$USERNAME" gconftool-2 "$@" - fi +gct () +{ + if [ "$gconf_version" ] + then + chroot /root sudo -u "$USERNAME" gconftool-2 "$@" + fi } -kderc_addtoprefixes() { - if [ -e "/root/etc/kderc" ]; then - sed -i "s|\\(prefixes=/usr/share/kubuntu-default-settings/kde-profile/default/\\)|\\1,$1|" /root/etc/kderc - fi +kderc_addtoprefixes () +{ + if [ -e "/root/etc/kderc" ] + then + sed -i "s|\\(prefixes=/usr/share/kubuntu-default-settings/kde-profile/default/\\)|\\1,$1|" /root/etc/kderc + fi } case ${ACCESS} in - # Lesser Visual Impairment - access=v1) - gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint - gct -s -t string /desktop/gnome/interface/icon_theme HighContrast - gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18" - gct -s -t string /desktop/gnome/interface/font_name "sans 18" - gct -s -t string /apps/metacity/general/theme Atlanta - gct -s -t string /desktop/gnome/background/picture_filename "" - gct -s -t string /desktop/gnome/background/picture_options none - gct -s -t string /desktop/gnome/background/primary_color \#666666 - gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F - gct -s -t string /desktop/gnome/background/color_shading_type solid - gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48 - gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass - - kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/ - if [ -d /root/usr/share/xubuntu-default-settings/accessibility ]; then - cp -a /root/usr/share/xubuntu-default-settings/accessibility/* /root/etc/xdg/ - fi - ;; - # Moderate Visual Impairment - access=v2) - gct -s -t bool /desktop/gnome/interface/accessibility true - gct -s -t bool /desktop/gnome/applications/at/visual/startup true - if [ -e /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py ]; then - sed -i '/^enableSpeech\W/ s/True/False/;/^enableMagnifier/ s/False/True/' /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py - fi - gct -s -t bool /apps/gksu/disable-grab true - kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/,/usr/share/kubuntu-default-settings/kde-profile/moderate-visual-impairment/ - ;; - # Blindness - access=v3) - # Disabled for now, until we know eSpeak works. - #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 bool /apps/gksu/disable-grab true - ;; - # Braille - braille=ask) - gct -s -t bool /desktop/gnome/interface/accessibility true - gct -s -t bool /desktop/gnome/applications/at/visual/startup true - if [ -e /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py ]; then - sed -i '/^enableSpeech\W/ s/True/False/;/^enableBraille/ s/False/True/' /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py - fi - gct -s -t bool /apps/gksu/disable-grab true - ;; - # Minor Motor Difficulties - access=m1) - gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true - gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true - gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true - gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true - gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false - gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true - gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700 - gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10 - gct -s -t bool /apps/gksu/disable-grab true - kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/ - if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then - sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml - fi - ;; - # Motor Difficulties - pointing devices - access=m2) - gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true - gct -s -t bool /desktop/gnome/interface/accessibility true - gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true - gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false - gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false - gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard] - - kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/,/usr/share/kubuntu-default-settings/kde-profile/motor-difficulties-pointing-devices/ - if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]; then - sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml - fi - ;; + access=v1) + # Lesser Visual Impairment + gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint + gct -s -t string /desktop/gnome/interface/icon_theme HighContrast + gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18" + gct -s -t string /desktop/gnome/interface/font_name "sans 18" + gct -s -t string /apps/metacity/general/theme Atlanta + gct -s -t string /desktop/gnome/background/picture_filename "" + gct -s -t string /desktop/gnome/background/picture_options none + gct -s -t string /desktop/gnome/background/primary_color \#666666 + gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F + gct -s -t string /desktop/gnome/background/color_shading_type solid + gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48 + gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass + + kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/ + + if [ -d /root/usr/share/xubuntu-default-settings/accessibility ] + then + cp -a /root/usr/share/xubuntu-default-settings/accessibility/* /root/etc/xdg/ + fi + ;; + + access=v2) + # 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 bool /apps/gksu/disable-grab true + + if [ -e /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py ] + then + sed -i '/^enableSpeech\W/ s/True/False/;/^enableMagnifier/ s/False/True/' /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py + fi + + kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/lesser-visual-impairment/,/usr/share/kubuntu-default-settings/kde-profile/moderate-visual-impairment/ + ;; + + access=v3) + # Blindness + # Disabled for now, until we know eSpeak works. + #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 bool /apps/gksu/disable-grab true + ;; + + 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 bool /apps/gksu/disable-grab true + + if [ -e /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py ] + then + sed -i '/^enableSpeech\W/ s/True/False/;/^enableBraille/ s/False/True/' /root/usr/share/pycentral/gnome-orca/site-packages/orca/settings.py + fi + ;; + + access=m1) + # Minor Motor Difficulties + gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true + gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true + gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true + gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true + gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false + gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true + gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700 + gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10 + gct -s -t bool /apps/gksu/disable-grab true + + kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/ + + if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ] + then + sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml + fi + ;; + + access=m2) + # Motor Difficulties - pointing devices + gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true + gct -s -t bool /desktop/gnome/interface/accessibility true + gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true + gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false + gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false + gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard] + + kderc_addtoprefixes /usr/share/kubuntu-default-settings/kde-profile/minor-motor-difficulties/,/usr/share/kubuntu-default-settings/kde-profile/motor-difficulties-pointing-devices/ + + if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ] + then + sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml + fi + ;; esac + log_end_msg diff --git a/scripts/live-bottom/31disable_update_notifier b/scripts/live-bottom/31disable_update_notifier index 976a3d3..7a6fef8 100755 --- a/scripts/live-bottom/31disable_update_notifier +++ b/scripts/live-bottom/31disable_update_notifier @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOUPDATENOTIFIER}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Disabling update-notifier..." @@ -31,6 +36,7 @@ log_begin_msg "Disabling update-notifier..." # report handling. chroot /root dpkg-divert --add --rename --quiet \ /usr/lib/update-notifier/apt-check + ln -s /bin/true /root/usr/lib/update-notifier/apt-check # For KDE, adept_notifier's only useful function at the moment is an diff --git a/scripts/live-bottom/32disable_hibernation b/scripts/live-bottom/32disable_hibernation index b75dbd9..0965c73 100755 --- a/scripts/live-bottom/32disable_hibernation +++ b/scripts/live-bottom/32disable_hibernation @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOPOWERMANAGEMENT}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Configuring power management..." @@ -27,15 +32,18 @@ log_begin_msg "Configuring power management..." # live-initramfs script gpm_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-power-manager 2>/dev/null) || panel_version="" -if [ -n "$gpm_version" ]; then -# live-reconfigure /root gnome-power-manager - chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/gnome-power-manager/can_hibernate false - chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/gnome-power-manager/can_suspend false + +if [ -n "$gpm_version" ] +then + #live-reconfigure /root gnome-power-manager + chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/gnome-power-manager/can_hibernate false + chroot /root sudo -u "$USERNAME" gconftool-2 -s -t bool /apps/gnome-power-manager/can_suspend false fi -if [ -d /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config ]; then - echo "disableSuspend=1" >> /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config/power-managerrc - echo "disableHibernate=1" >> /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config/power-managerrc +if [ -d /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config ] +then + echo "disableSuspend=1" >> /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config/power-managerrc + echo "disableHibernate=1" >> /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config/power-managerrc fi log_end_msg diff --git a/scripts/live-bottom/33enable_apport_crashes b/scripts/live-bottom/33enable_apport_crashes index 0f177ab..747ba26 100755 --- a/scripts/live-bottom/33enable_apport_crashes +++ b/scripts/live-bottom/33enable_apport_crashes @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOPROGRAMCRASHES}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Enabling notifications about program crashes..." @@ -27,8 +32,10 @@ log_begin_msg "Enabling notifications about program crashes..." # live-initramfs script update_notifier_version=$(chroot /root dpkg-query -W --showformat='${Version}' update-notifier 2>/dev/null) || update_notifier_version="" -if [ -n "$update_notifier_version" ]; then - chroot /root sudo -u "$USERNAME" gconftool-2 -t bool -s /apps/update-notifier/show_apport_crashes true + +if [ -n "$update_notifier_version" ] +then + chroot /root sudo -u "$USERNAME" gconftool-2 -t bool -s /apps/update-notifier/show_apport_crashes true fi log_end_msg diff --git a/scripts/live-bottom/34disable_kpersonalizer b/scripts/live-bottom/34disable_kpersonalizer new file mode 100755 index 0000000..e19cf2a --- /dev/null +++ b/scripts/live-bottom/34disable_kpersonalizer @@ -0,0 +1,51 @@ +#!/bin/sh + +#set -e + +# initramfs-tools header + +PREREQ="" + +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + prereqs + exit 0 + ;; +esac + +# live-initramfs header + +if [ -n "${NOKPERSONALIZER}" ] +then + exit 0 +fi + +. /scripts/live-functions + +log_begin_msg "Disabling kpersonalizer..." + +# live-initramfs script + +if chroot /root /usr/bin/which kpersonalizer >/dev/null +then + # Disable first-login wizard for KDE + if [ ! -f /root/etc/kde3/kpersonalizerrc ] + then + +cat > /root/etc/kde3/kpersonalizerrc << EOF +[General] +FirstLogin=false +EOF + + else + echo "I'm not smart enough to disable kpersonalizer startup" >&2 + echo "Because kpersonalizerrc already exists" >&2 + fi +fi + +log_end_msg diff --git a/scripts/live-bottom/34disable_kwallet b/scripts/live-bottom/34disable_kwallet index 767f9f8..79c895a 100755 --- a/scripts/live-bottom/34disable_kwallet +++ b/scripts/live-bottom/34disable_kwallet @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOKWALLET}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Disabling kwallet..." diff --git a/scripts/live-bottom/35fix_language_selector b/scripts/live-bottom/35fix_language_selector index 1c9af0a..126a5b2 100755 --- a/scripts/live-bottom/35fix_language_selector +++ b/scripts/live-bottom/35fix_language_selector @@ -20,19 +20,25 @@ esac # live-initramfs header +if [ -n "${NOLANGUAGESELECTOR}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Fixing language selector..." # live-initramfs script -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 - +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 -if [ -x /root/usr/bin/fontconfig-voodoo ]; then - chroot /root fontconfig-voodoo --auto --quiet || true +if [ -x /root/usr/bin/fontconfig-voodoo ] +then + chroot /root fontconfig-voodoo --auto --quiet || true fi log_end_msg diff --git a/scripts/live-bottom/38disable_restricted_manager b/scripts/live-bottom/38disable_restricted_manager index 2f2db35..2a6f1ca 100755 --- a/scripts/live-bottom/38disable_restricted_manager +++ b/scripts/live-bottom/38disable_restricted_manager @@ -1,9 +1,8 @@ #!/bin/sh PREREQ="" -DESCRIPTION="Disabling restricted-manager..." -. /scripts/casper-functions +. /scripts/live-functions prereqs() { @@ -18,10 +17,14 @@ prereqs) ;; esac -log_begin_msg "$DESCRIPTION" +if [ -n "${NORESTRICTEDMANAGER}" ] +then + exit 0 +fi -rm -f /root/etc/xdg/autostart/restricted-manager.desktop +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 log_end_msg diff --git a/scripts/live-bottom/40install_driver_updates b/scripts/live-bottom/40install_driver_updates index d6f149a..762a084 100755 --- a/scripts/live-bottom/40install_driver_updates +++ b/scripts/live-bottom/40install_driver_updates @@ -22,14 +22,15 @@ esac . /scripts/live-functions -log_begin_msg "Installing driver updates..." - # live-initramfs script -if [ ! -d /tmp/driver-updates ]; then +if [ ! -d /tmp/driver-updates ] +then exit 0 fi +log_begin_msg "Installing driver updates..." + install_dir=/var/cache/driver-updates mkdir "/root$install_dir" @@ -37,11 +38,15 @@ cp -a /tmp/driver-updates/*.deb "/root$install_dir/" # We cannot leave packages in a bad state. So if the install fails, remove # it. This will get caught in live.log. -for deb in "/root$install_dir"/*; do +for deb in "/root$install_dir"/* +do [ -f "$deb" ] || continue + debbase="${deb##*/}" - if ! chroot /root dpkg -i "$install_dir/$debbase"; then - chroot /root dpkg -P "${debbase%%_*}" + + if ! chroot /root dpkg -i "$install_dir/$debbase" + then + chroot /root dpkg -P "${debbase%%_*}" fi done diff --git a/scripts/live-bottom/41apt_cdrom b/scripts/live-bottom/41apt_cdrom index bbfa845..fdde34d 100755 --- a/scripts/live-bottom/41apt_cdrom +++ b/scripts/live-bottom/41apt_cdrom @@ -20,6 +20,11 @@ esac # live-initramfs header +if [ -n "${NOAPTCDROM}" ] +then + exit 0 +fi + . /scripts/live-functions log_begin_msg "Adding APT-CDROM source..." diff --git a/scripts/live-functions b/scripts/live-functions index 7100603..baa920c 100644 --- a/scripts/live-functions +++ b/scripts/live-functions @@ -1,35 +1,42 @@ +#!/bin/sh . /scripts/functions . /live.vars -# Override this so we don't call PROGRESS -log_end_msg() +log_end_msg () { - if [ -x /sbin/usplash_write ]; then + # Override this so we don't call PROGRESS + if [ -x /sbin/usplash_write ] + then /sbin/usplash_write "SUCCESS ok" fi + _log_msg "Done." } -# Print a message and wait for enter -log_wait_msg() +log_wait_msg () { - if [ -x /sbin/usplash_write ]; then + # Print a message and wait for enter + if [ -x /sbin/usplash_write ] + then /sbin/usplash_write "INPUTENTER $@" read nunya < /dev/.initramfs/usplash_outfifo fi + _log_msg "Waiting: $@ ..." } really_export () { - STRING="${1}" - VALUE="$(eval echo -n \${$STRING})" - - if [ -f /live.vars ] && cat /live.vars | grep -sq "export ${STRING}" ; then - sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars - else - echo "export ${STRING}=\"${VALUE}\"" >> /live.vars - fi - eval export "${STRING}"="${VALUE}" + STRING="${1}" + VALUE="$(eval echo -n \${$STRING})" + + if [ -f /live.vars ] && cat /live.vars | grep -sq "export ${STRING}" + then + sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars + else + echo "export ${STRING}=\"${VALUE}\"" >> /live.vars + fi + + eval export "${STRING}"="${VALUE}" } diff --git a/scripts/live-helpers b/scripts/live-helpers index 8f28f3b..9cf3b99 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -1,231 +1,300 @@ -## live-initramfs helper functions, used by live-initramfs on boot and by live-snapshot +#!/bin/sh +# live-initramfs helper functions, used by live-initramfs on boot and by live-snapshot -if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then - MP_QUIET="-Q" -elif [ "${BUILD_SYSTEM}" = "Debian" ]; then - MP_QUIET="-q" +if [ "${BUILD_SYSTEM}" = "Ubuntu" ] +then + MP_QUIET="-Q" +elif [ "${BUILD_SYSTEM}" = "Debian" ] +then + MP_QUIET="-q" else - MP_QUIET="" + MP_QUIET="" fi -if [ ! -x "/bin/fstype" ]; then - # klibc not in path -> not in initramfs - export PATH="${PATH}:/usr/lib/klibc/bin" +if [ ! -x "/bin/fstype" ] +then + # klibc not in path -> not in initramfs + export PATH="${PATH}:/usr/lib/klibc/bin" fi -sys2dev() { - sysdev=${1#/sys} - echo "/dev/$(udevinfo -q name -p ${sysdev} 2>/dev/null|| echo ${sysdev##*/})" +sys2dev () +{ + sysdev=${1#/sys} + echo "/dev/$(udevinfo -q name -p ${sysdev} 2>/dev/null|| echo ${sysdev##*/})" } -subdevices() { - sysblock=$1 - r="" - for dev in "${sysblock}" "${sysblock}"/*; do - if [ -e "${dev}/dev" ]; then - r="${r} ${dev}" - fi - done - echo ${r} +subdevices () +{ + sysblock=$1 + r="" + + for dev in "${sysblock}" "${sysblock}"/* + do + if [ -e "${dev}/dev" ] + then + r="${r} ${dev}" + fi + done + + echo ${r} } -get_fstype() { - local FSTYPE - local FSSIZE - eval $(fstype < $1) - if [ "$FSTYPE" != "unknown" ]; then - echo $FSTYPE - return 0 - fi - /lib/udev/vol_id -t $1 2>/dev/null +get_fstype () +{ + local FSTYPE + local FSSIZE + + eval $(fstype < $1) + + if [ "$FSTYPE" != "unknown" ] + then + echo $FSTYPE + return 0 + fi + + /lib/udev/vol_id -t $1 2>/dev/null } -where_is_mounted() { - device=$1 - if grep -q "^$device " /proc/mounts; then - grep "^$device " /proc/mounts | read d mountpoint rest - echo $mountpoint - return 0 - fi - return 1 +where_is_mounted () +{ + device=$1 + + if grep -q "^$device " /proc/mounts + then + grep "^$device " /proc/mounts | read d mountpoint rest + echo $mountpoint + return 0 + fi + + return 1 } -lastline() { - while read lines ; do - line=${lines} - done - echo "${line}" +lastline () +{ + while read lines + do + line=${lines} + done + + echo "${line}" } base_path () { - testpath="${1}" - mounts="$(awk '{print $2}' /proc/mounts)" - testpath="$(busybox 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 + testpath="${1}" + mounts="$(awk '{print $2}' /proc/mounts)" + testpath="$(busybox 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 } fs_size () { - # Returns used/free fs kbytes + 5% more - # You could pass a block device as $1 or the mount point as $2 - - dev="${1}" - mountp="${2}" - used="${3}" - - if [ -z "${mountp}" ]; then - mountp=$(where_is_mounted "${dev}") - if [ "$?" -gt 0 ]; then - mountp="/mnt/tmp_fs_size" - mkdir -p "${mountp}" - mount -t $(get_fstype "${dev}") -o ro "${dev}" "${mountp}" - doumount=1 - fi - fi - - if [ "${used}" = "used" ]; then - size=$(du -ks ${mountp} | cut -f1) - size=$(expr ${size} + ${size} / 20 ) # FIXME: 5% more to be sure - else - # free space - size="$(df -k | grep -s ${mountp} | awk '{print $4}')" - fi - - if [ -n "${doumount}" ]; then - umount "${mountp}" - rmdir "${mountp}" - fi - echo "${size}" + # Returns used/free fs kbytes + 5% more + # You could pass a block device as $1 or the mount point as $2 + + dev="${1}" + mountp="${2}" + used="${3}" + + if [ -z "${mountp}" ] + then + mountp=$(where_is_mounted "${dev}") + + if [ "$?" -gt 0 ] + then + mountp="/mnt/tmp_fs_size" + + mkdir -p "${mountp}" + mount -t $(get_fstype "${dev}") -o ro "${dev}" "${mountp}" + + doumount=1 + fi + fi + + if [ "${used}" = "used" ] + then + size=$(du -ks ${mountp} | cut -f1) + size=$(expr ${size} + ${size} / 20 ) # FIXME: 5% more to be sure + else + # free space + size="$(df -k | grep -s ${mountp} | awk '{print $4}')" + fi + + if [ -n "${doumount}" ] + then + umount "${mountp}" + rmdir "${mountp}" + fi + + echo "${size}" } -load_keymap() +load_keymap () { - # Load custom keymap - if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then - loadkeys /etc/boottime.kmap.gz - fi + # Load custom keymap + if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ] + then + loadkeys /etc/boottime.kmap.gz + fi } -setup_loop() { - local fspath=$1 - local module=$2 - local pattern=$3 - local offset=$4 - local encryption=$5 - - modprobe ${MP_QUIET} -b "$module" - udevsettle - - for loopdev in $pattern; do - if [ "$(cat $loopdev/size)" -eq 0 ]; then - dev=$(sys2dev "${loopdev}") - options='' - if [ 0 -lt "${offset}" ]; then - options="${options} -o ${offset}" - fi - if [ -z "${encryption}" ]; then - losetup ${options} "${dev}" "${fspath}" - else - # Loop AES encryption - while true; do - load_keymap - echo -n "Enter passphrase for ${fspath}: " >&6 - read -s passphrase - echo "${passphrase}" > /tmp/passphrase - exec 9&6 - read answer - if [ 'no' = "${answer}" ]; then - unset answer - break - fi - done - fi - echo "$dev" - return 0 - fi - done - panic "No loop devices available" +setup_loop () +{ + local fspath=$1 + local module=$2 + local pattern=$3 + local offset=$4 + local encryption=$5 + + modprobe ${MP_QUIET} -b "$module" + udevsettle + + for loopdev in $pattern + do + if [ "$(cat $loopdev/size)" -eq 0 ] + then + dev=$(sys2dev "${loopdev}") + options='' + + if [ 0 -lt "${offset}" ] + then + options="${options} -o ${offset}" + fi + + if [ -z "${encryption}" ] + then + losetup ${options} "${dev}" "${fspath}" + else + # Loop AES encryption + while true + do + load_keymap + + echo -n "Enter passphrase for ${fspath}: " >&6 + read -s passphrase + echo "${passphrase}" > /tmp/passphrase + exec 9&6 + read answer + + if [ 'no' = "${answer}" ] + then + unset answer + break + fi + done + fi + + echo "$dev" + return 0 + fi + done + + panic "No loop devices available" } try_mount () { - dev="${1}" - mountp="${2}" - opts="${3}" - - if where_is_mounted ${dev} > /dev/null; then - mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed" - mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount" - else - mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}" - fi -} + dev="${1}" + mountp="${2}" + opts="${3}" -find_cow_device() { - pers_label="${1}" - cow_backing="/${pers_label}-backing" - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop); do - for dev in $(subdevices "${sysblock}"); do - devname=$(sys2dev "${dev}") - if [ "$(/lib/udev/vol_id -l $devname 2>/dev/null)" = "${pers_label}" ]; then - echo "$devname" - return - elif [ "$(get_fstype ${devname})" = "vfat" ]; then # FIXME: all supported block devices should be scanned - mkdir -p "${cow_backing}" - try_mount "${devname}" "${cow_backing}" "rw" - if [ -e "${cow_backing}/${pers_label}" ]; then - echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*") - return 0 - else - umount ${cow_backing} - fi - fi - done - done + if where_is_mounted ${dev} > /dev/null + then + mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed" + mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount" + else + mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}" + fi } -find_files() -# return the first of $filenames found on vfat and ext2/ext3 devices -# FIXME: merge with above function +find_cow_device () { - filenames="${1}" - snap_backing="/snap-backing" - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop); do - for dev in $(subdevices "${sysblock}"); do - devname=$(sys2dev "${dev}") - devfstype="$(get_fstype ${devname})" - if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] || [ "${devfstype}" = "ext3" ]; then # FIXME: all supported block devices should be scanned - mkdir -p "${snap_backing}" - try_mount "${devname}" "${snap_backing}" "ro" - for filename in ${filenames}; do - if [ -e "${snap_backing}/${filename}" ]; then - echo "${devname} ${snap_backing} ${filename}" - return 0 - fi - done - umount ${snap_backing} - fi - done - done + pers_label="${1}" + cow_backing="/${pers_label}-backing" + + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop) + do + for dev in $(subdevices "${sysblock}") + do + devname=$(sys2dev "${dev}") + + if [ "$(/lib/udev/vol_id -l $devname 2>/dev/null)" = "${pers_label}" ] + then + echo "$devname" + return + elif [ "$(get_fstype ${devname})" = "vfat" ] + then + # FIXME: all supported block devices should be scanned + mkdir -p "${cow_backing}" + try_mount "${devname}" "${cow_backing}" "rw" + + if [ -e "${cow_backing}/${pers_label}" ] + then + echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*") + return 0 + else + umount ${cow_backing} + fi + fi + done + done } +find_files () +{ + # return the first of $filenames found on vfat and ext2/ext3 devices + # FIXME: merge with above function + + filenames="${1}" + snap_backing="/snap-backing" + + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop) + do + for dev in $(subdevices "${sysblock}") + do + devname=$(sys2dev "${dev}") + devfstype="$(get_fstype ${devname})" + + if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] || [ "${devfstype}" = "ext3" ] + then + # FIXME: all supported block devices should be scanned + mkdir -p "${snap_backing}" + try_mount "${devname}" "${snap_backing}" "ro" + for filename in ${filenames} + do + if [ -e "${snap_backing}/${filename}" ] + then + echo "${devname} ${snap_backing} ${filename}" + return 0 + fi + done + + umount ${snap_backing} + fi + done + done +} diff --git a/scripts/live-premount/10driver_updates b/scripts/live-premount/10driver_updates index 546d3ca..0a88724 100755 --- a/scripts/live-premount/10driver_updates +++ b/scripts/live-premount/10driver_updates @@ -1,110 +1,155 @@ #!/bin/sh +#set -e + +# initramfs-tools header + PREREQ="" -. /scripts/live-functions -. /scripts/live-helpers prereqs() { - echo "$PREREQ" + echo "${PREREQ}" } -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; +case "${1}" in + prereqs) + prereqs + exit 0 + ;; esac +# live-initramfs header + +if [ -n "${NOUSER}" ] +then + exit 0 +fi + +. /scripts/live-functions +. /scripts/live-helpers + +log_begin_msg "Adding live session user..." + +# live-initramfs script + mountpoint=/cdrom -is_updates_path() { +is_updates_path () +{ # Driver packages are stored in ubuntu-drivers// # subdirectory. Each package contains a module for a specific # kernel flavour. + path=$1 kbase=$(uname -r | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\)-.*/\1/') update_dir="$path/ubuntu-drivers/$kbase" - if [ -d "$update_dir" ]; then + + if [ -d "$update_dir" ] + then if [ "$(echo $update_dir/*_$DPKG_ARCH.deb)" != \ - "$update_dir/*_$DPKG_ARCH.deb" ]; then + "$update_dir/*_$DPKG_ARCH.deb" ] + then echo "$update_dir" return 0; fi fi + return 1; } -is_nice_device() { - sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb))"; then - return 0 - fi - return 1 +is_nice_device () +{ + sysfs_path="${1#/sys}" + + if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb))" + then + return 0 + fi + + return 1 } -is_supported_fs () { - # FIXME: do something better like the scan of supported filesystems - fstype="${1}" - case ${fstype} in - vfat|iso9660|udf|ext2|ext3|ntfs) - return 0 - ;; - esac - return 1 +is_supported_fs () +{ + # FIXME: do something better like the scan of supported filesystems + fstype="${1}" + + case ${fstype} in + vfat|iso9660|udf|ext2|ext3|ntfs) + return 0 + ;; + esac + + return 1 } check_dev_updates () { - sysdev="${1}" - devname="${2}" - if [ -z "${devname}" ]; then - devname=$(sys2dev "${sysdev}") - fi - - fstype=$(get_fstype "${devname}") - if is_supported_fs ${fstype}; then - mount -t ${fstype} -o ro "${devname}" $mountpoint || continue - if is_updates_path $mountpoint; then - return 0 - else - umount $mountpoint - fi - fi - - return 1 -} + sysdev="${1}" + devname="${2}" + + if [ -z "${devname}" ] + then + devname=$(sys2dev "${sysdev}") + fi + + fstype=$(get_fstype "${devname}") + + if is_supported_fs ${fstype} + then + mount -t ${fstype} -o ro "${devname}" $mountpoint || continue + + if is_updates_path $mountpoint + then + return 0 + else + umount $mountpoint + fi + fi -find_driver_updates() { - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram); do - devname=$(sys2dev "${sysblock}") - fstype=$(get_fstype "${devname}") - if /lib/udev/cdrom_id ${devname} > /dev/null; then - if check_dev_updates "null" "${devname}" ; then - return 0 - fi - elif is_nice_device "${sysblock}" ; then - for dev in $(subdevices "${sysblock}"); do - if check_dev_updates "${dev}" ; then - return 0 - fi - done - fi - done - return 1 + return 1 } -pulsate() { - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "PULSATE" - fi +find_driver_updates () +{ + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram) + do + devname=$(sys2dev "${sysblock}") + fstype=$(get_fstype "${devname}") + + if /lib/udev/cdrom_id ${devname} > /dev/null + then + if check_dev_updates "null" "${devname}" + then + return 0 + fi + elif is_nice_device "${sysblock}" + then + for dev in $(subdevices "${sysblock}") + do + if check_dev_updates "${dev}" + then + return 0 + fi + done + fi + done + + return 1 } +pulsate () +{ + if [ -x /sbin/usplash_write ] + then + /sbin/usplash_write "PULSATE" + fi +} updates="false" -for x in $(cat /proc/cmdline); do +for x in $(cat /proc/cmdline) +do case $x in debian-installer/driver-update=*) updates=${x#debian-installer/driver-update=} @@ -112,22 +157,25 @@ for x in $(cat /proc/cmdline); do esac done -if [ "$updates" != "true" ]; then +if [ "$updates" != "true" ] +then log_end_msg exit 0 fi # Not sure what to do for network installs. I assume there isn't even a CD # for this anyway, so fail. -if [ -n "${NETBOOT}" ]; then +if [ -n "${NETBOOT}" ] +then log_end_msg exit 0; fi -#if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]; then -# GDMCONF=/etc/gdm/gdm-cdd.conf +#if chroot /root [ -f /etc/gdm/gdm-cdd.conf ] +#then +# GDMCONF=/etc/gdm/gdm-cdd.conf #else -# GDMCONF=/etc/gdm/gdm.conf +# GDMCONF=/etc/gdm/gdm.conf #fi if [ -x /usr/bin/eject ] @@ -139,17 +187,22 @@ log_wait_msg "Insert a driver CD and press ENTER ($DPKG_ARCH)" log_begin_msg "Looking for driver update CD" -for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13; do +for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 +do updates_root=$(find_driver_updates) - if [ "${updates_root}" ]; then + + if [ "${updates_root}" ] + then break; fi + sleep 1 done log_end_msg -if [ -z "${updates_root}" ]; then +if [ -z "${updates_root}" ] +then log_begin_msg "Could not find driver updates" log_wait_msg "Re-insert install CD and press ENTER" exit 0 -- 2.1.4