Adding upstream version 1.63+debian. upstream/1.63+debian
authorDaniel Baumann <daniel@debian.org>
Sun, 18 Apr 2010 16:33:50 +0000 (18:33 +0200)
committerDaniel Baumann <daniel@debian.org>
Sun, 18 Apr 2010 16:33:50 +0000 (18:33 +0200)
casper-md5check/Makefile
casper.conf
hooks/casper
scripts/casper
scripts/casper-bottom/10adduser
scripts/casper-bottom/14locales
scripts/casper-bottom/22gnome_panel_data
scripts/casper-bottom/25configure_init
scripts/casper-bottom/33disable_binary_drivers
ubiquity-hooks/30accessibility [deleted file]

index 193ac69..4e5408f 100644 (file)
@@ -6,4 +6,4 @@ CFLAGS=$(getconf LFS_CFLAGS) -Wall -O2
 casper-md5check: casper-md5check.c md5.c
 
 clean:
-       rm *.o casper-md5check
+       rm -f *.o casper-md5check
index 6b16149..d342fdb 100644 (file)
@@ -1,9 +1,8 @@
-# This file should go in 
-#  conf/conf.d/
+# This file should go in /etc/casper.conf
 # Supported variables are:
 # USERNAME, USERFULLNAME, HOST
 
 export USERNAME="ubuntu"
-export USERFULLNAME="Custom LiveCD user"
+export USERFULLNAME="Live session user"
 export HOST="ubuntu"
 
index 8779944..7a1bb8c 100755 (executable)
@@ -18,8 +18,6 @@ esac
 
 . /usr/share/initramfs-tools/hook-functions
 
-# cloop is needed
-manual_add_modules cloop
 manual_add_modules unionfs
 
 # We need losetup
@@ -36,10 +34,15 @@ copy_exec /lib/udev/vol_id /lib/udev
 copy_exec /lib/udev/path_id /lib/udev
 copy_exec /usr/bin/udevinfo /bin
 
-# Needed for devmapper
-copy_exec /sbin/blockdev /sbin
-copy_exec /sbin/dmsetup /sbin
-manual_add_modules dm-snapshot
+# cloop is needed for dmsetup
+if [ -x /sbin/dmsetup ]; then
+    manual_add_modules cloop
+
+    # Needed for devmapper
+    copy_exec /sbin/blockdev /sbin
+    copy_exec /sbin/dmsetup /sbin
+    manual_add_modules dm-snapshot
+fi
 
 # squashfs
 manual_add_modules squashfs
@@ -63,3 +66,8 @@ manual_add_modules ohci1394
 copy_exec /usr/lib/casper/casper-md5check /bin
 
 auto_add_modules net
+
+if [ -e /etc/casper.conf ]; then
+    mkdir -p ${DESTDIR}/etc
+    cp /etc/casper.conf ${DESTDIR}/etc
+fi
index 3d8c453..3e7db03 100644 (file)
@@ -8,27 +8,26 @@ mountpoint=/cdrom
 
 mkdir -p $mountpoint
 
-overlay_method=unionfs
-if [ "${DPKG_ARCH}" = "ia64" ] || [ "${DPKG_ARCH}" = "hppa" ] || [ "${DPKG_ARCH}" = "sparc" ]; then
-    overlay_method=devmapper
-fi
+#overlay_method=unionfs
+#if [ "${DPKG_ARCH}" = "ia64" ] || [ "${DPKG_ARCH}" = "hppa" ] || [ "${DPKG_ARCH}" = "sparc" ]; then
+#    overlay_method=devmapper
+#fi
 
-USERNAME=ubuntu
-USERFULLNAME="Ubuntu LiveCD user"
-HOST=ubuntu
+USERNAME=casper
+USERFULLNAME="Live session user"
+HOST=live
 
 [ -f /etc/casper.conf ] && . /etc/casper.conf
 
 export USERNAME USERFULLNAME HOST
 
-casper_path() {
+is_casper_path() {
     path=$1
-    if [ -e "$path/casper/filesystem.cloop" ]; then
-        echo "$path/casper/filesystem.cloop"
-        return 0
-    elif [ -e "$path/casper/filesystem.squashfs" ]; then
-        echo "$path/casper/filesystem.squashfs"
-        return 0
+    if [ -d "$path/casper" ]; then
+        if [ "$(echo $path/casper/*.cloop)" != "$path/casper/*.cloop" ] || 
+            [ "$(echo $path/casper/*.squashfs)" != "$path/casper/*.squashfs" ]; then
+            return 0
+        fi
     fi
     return 1
 }
@@ -58,14 +57,27 @@ get_backing_device() {
        esac
 }
 
-setup_cow() {
-       case "$1" in
-            unionfs)
-                setup_unionfs "$2" "$rootmnt"
-                ;;
-            devmapper)
-                setup_devmapper "$2" "$rootmnt"
-       esac
+match_files_in_dir() {
+    # Does any files match pattern $1 ?
+
+    local pattern="$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/casper/*.cloop"; then
+        # Let's hope there's just one matching *.cloop... FIXME
+        setup_devmapper $(get_backing_device "$directory/casper/*.cloop") "$rootmnt"
+    elif match_files_in_dir "$directory/casper/*.squashfs"; then
+        setup_unionfs "$directory/casper" "$rootmnt"
+    else 
+        :
+    fi
 }
 
 sys2dev() {
@@ -173,60 +185,82 @@ find_cow_device() {
 }
 
 setup_unionfs() {
-       backdev="$1"
-       rootmnt="$2"
-        modprobe -Qb unionfs
-        mkdir -p /cow
-
-        if grep -q persistent /proc/cmdline; then
-            i=0
-            # We love udev and the kernel!
-            while [ "$i" -lt 300 ]; do
-                cowdevice=$(find_cow_device) 
-                if [ -b "$cowdevice" ]; then
-                    mount -t $(get_fstype "$cowdevice") -o rw "$cowdevice" /cow || panic "Can not mount $cowdevice on /cow"
-                    break
-                fi
-                sleep 5
-#                sleep 0.1
-                i=$(( $i + 1 ))
-            done
-        else
-            mount -t tmpfs tmpfs /cow
+    image_directory="$1"
+    rootmnt="$2"
+    modprobe -Qb unionfs
+
+    croot="" # Should really be /casper, but run-init doesn't handle
+             # mount-points in subdirectories at all
+
+    # Let's just mount the read-only file systems first
+    mkdir -p "${croot}"
+    for image in "${image_directory}"/*.squashfs; do
+        imagename=$(basename "${image}")
+        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}"
+    done
 
-       mkdir -p /rofs
-    if [ "$(get_fstype $backdev)" = "unknown" ]; then
-        panic "Unknown file system type on $backdev"
+    rofsstring=""
+    for dir in $(mount -t squashfs | cut -d\  -f 3); do
+        rofsstring="$dir=ro:$rofsstring"
+    done
+    rofsstring=${rofsstring%:}
+
+    mkdir -p /cow
+    
+    if grep -q persistent /proc/cmdline; then
+        i=0
+        # We love udev and the kernel!
+        while [ "$i" -lt 300 ]; do
+            cowdevice=$(find_cow_device) 
+            if [ -b "$cowdevice" ]; then
+                mount -t $(get_fstype "$cowdevice") -o rw "$cowdevice" /cow || panic "Can not mount $cowdevice on /cow"
+                break
+            fi
+            sleep 0.1
+            i=$(( $i + 1 ))
+        done
+    else
+        mount -t tmpfs tmpfs /cow
+    fi
+    
+    mount -t unionfs -o dirs=/cow=rw:$rofsstring unionfs "$rootmnt"
+
+    for d in $(mount -t squashfs | cut -d\  -f 3); do
+        mkdir -p "${rootmnt}/casper/${d}"
+        mount -o bind "${d}" "${rootmnt}/${d}"
+        umount "${d}"
+    done
+
+    if grep -q show-cow /proc/cmdline; then
+        mkdir -p "$rootmnt/cow"
+        mount -o bind /cow "$rootmnt/cow"
     fi
-       mount -t $(get_fstype "$backdev") -o ro "$backdev" /rofs || panic "Can not mount $backdev on /rofs"
 
-       mount -t unionfs -o dirs=/cow=rw:/rofs=ro unionfs "$rootmnt"
-        if grep -q show-cow /proc/cmdline; then
-            mkdir -p "$rootmnt/cow"
-            mount -o bind /cow "$rootmnt/cow"
-        fi
-        mkdir -p "$rootmnt/rofs"
-        mount -o bind /rofs "$rootmnt/rofs"
 }
 
 is_usb_device() {
     sysfs_path="${1#/sys}"
-    if /lib/udev/path_id "${sysfs_path}" | grep -q "ID_PATH=usb"; then
+    if /lib/udev/path_id "${sysfs_path}" | grep -q "ID_PATH=(usb|pci-[^-]*-usb)"; then
         return 0
     fi
     return 1
 }
 
-find_cd() {
+find_livefs() {
        mounted=
         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
                 mount -t ${fstype} -o ro "$devname" $mountpoint || continue
-                if casper_path $mountpoint; then
-                    echo $(casper_path $mountpoint)
+                if is_casper_path $mountpoint; then
+                    echo $mountpoint
                     return
                 else
                     umount $mountpoint
@@ -238,8 +272,8 @@ find_cd() {
                     case ${fstype} in
                         vfat|iso9660|udf)
                             mount -t ${fstype} -o ro "${devname}" $mountpoint || continue
-                            if casper_path $mountpoint; then
-                                echo $(casper_path $mountpoint)
+                            if is_casper_path $mountpoint; then
+                                echo $mountpoint
                                 return
                             else
                                 umount $mountpoint
@@ -271,7 +305,7 @@ mountroot() {
     exec 7>&2
     exec > casper.log
     exec 2>&1
-
+    
     set_usplash_timeout
     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-premount"
     run_scripts /scripts/casper-premount
@@ -283,18 +317,17 @@ mountroot() {
     set_usplash_timeout
 
     for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13; do
-        live_image=$(find_cd)
-        if [ "${live_image}" ]; then
+        livefs_root=$(find_livefs)
+        if [ "${livefs_root}" ]; then
             break
         fi
         sleep 1
     done
     if [ "$?" -gt 0 ]; then
-        panic "Unable to find a CD-ROM containing a live file system"
+        panic "Unable to find a medium containing a live file system"
     fi
     
-    setup_cow "$overlay_method" "$(get_backing_device $live_image)" "$rootmnt"
-
+    mount_images_in_directory "$livefs_root" "$rootmnt"
     log_end_msg
 
     maybe_break casper-bottom
index a37d831..0c6cd4b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 PREREQ=""
-DESCRIPTION="Adding live CD user..."
+DESCRIPTION="Adding live session user..."
 
 . /scripts/functions
 
@@ -20,6 +20,7 @@ esac
 
 log_begin_msg "$DESCRIPTION"
 
+# U6aMy0wojraho is just a blank password
 chroot /root debconf-communicate -fnoninteractive casper > /dev/null <<EOF
 set passwd/root-password-crypted *
 set passwd/user-password-crypted U6aMy0wojraho
index d9343cd..0d4e171 100755 (executable)
@@ -20,18 +20,33 @@ esac
 
 log_begin_msg "$DESCRIPTION"
 
-locale=en_US.UTF-8
+if [ -e /root/etc/default/locale ]; then
+       grep_file=/root/etc/default/locale
+       locale=$(grep 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' ) 
+elif [ -e /root/etc/environment ]; then # Old locales policy
+       grep_file=/root/etc/environment
+fi
+
+# commandline
 for x in $(cat /proc/cmdline); do
-                case $x in
-                        debian-installer/locale=*)
-                                locale=${x#debian-installer/locale=}
-                                ;;
-                esac
+       case $x in
+               debian-installer/locale=*)
+                       locale=${x#debian-installer/locale=}
+                       set_locale="true"
+                       ;;
+       esac
 done
 
-LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 |sed -e 's, .*,,' -e q)
-
-printf 'LANG="%s"\n' "${LANG}" >> /root/etc/environment
-chroot /root /usr/sbin/locale-gen "${LANG}"
+if [ -z "${locale}" ]; then
+       # Set a default one
+       locale=en_US.UTF-8
+       set_locale="true"
+fi
+
+if [ "${set_locale}" ]; then
+       LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 |sed -e 's, .*,,' -e q)
+       printf 'LANG="%s"\n' "${LANG}" >> "${grep_file}" 
+       chroot /root /usr/sbin/locale-gen "${LANG}"
+fi
 
 log_end_msg
index b232c27..e87c94f 100755 (executable)
@@ -20,8 +20,10 @@ esac
 
 log_begin_msg "$DESCRIPTION"
 
-if chroot /root /bin/sh -c laptop-detect; then
-    casper-reconfigure /root gnome-panel-data
+if [ -x /root/usr/sbin/laptop-detect ]; then
+       if chroot /root laptop-detect; then
+           casper-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=""
index 12e6315..ede660d 100755 (executable)
@@ -28,9 +28,11 @@ fi
 
 # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
 # /etc/crontab remaining disabled, yet also not run by anacron
-for f in /root/etc/rc?.d/S??anacron; do
-    mv ${f} ${f%/*}/K00anacron
-done
+if [ -x /root/etc/init.d/anacron ]; then
+    for f in /root/etc/rc?.d/S??anacron; do
+        mv ${f} ${f%/*}/K00anacron
+    done
+fi
 
 # No point, really
 rm -f /root/etc/rc?.d/[SK]??postfix
@@ -40,15 +42,8 @@ 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.
-chmod -x /root/sbin/readahead-list
-
-# Install shutdown script
-cp -a /lib/casper/shutdown /root/etc/init.d/casper-shutdown
-if [ -f /root/etc/rc0.d/S90halt ]; then
-    ln -s ../init.d/casper-shutdown /root/etc/rc0.d/S89casper
-fi
-if [ -f /root/etc/rc6.d/S90reboot ]; then
-    ln -s ../init.d/casper-shutdown /root/etc/rc6.d/S89casper
+if [ -e /root/sbin/readahead-list ]; then
+    chmod -x /root/sbin/readahead-list
 fi
 
 log_end_msg
index 52bcbf4..6bc2279 100755 (executable)
@@ -20,4 +20,6 @@ esac
 
 log_begin_msg "$DESCRIPTION"
 
-echo 'DISABLED_MODULES="fglrx nv"' >> /root/etc/default/linux-restricted-modules-common
+if [ -e /root/etc/default/linux-restricted-modules-common ]; then
+    echo 'DISABLED_MODULES="fglrx nv"' >> /root/etc/default/linux-restricted-modules-common
+fi
diff --git a/ubiquity-hooks/30accessibility b/ubiquity-hooks/30accessibility
deleted file mode 100755 (executable)
index 4d871fd..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-. /usr/share/debconf/confmodule
-
-PREREQ=""
-DESCRIPTION="Configuring accessibility options..."
-USERNAME=$(db_get passwd/username)
-
-gct() {
-    chroot /root su $USERNAME -- gconftool-2 "$@"
-}
-
-for x in $(cat /proc/cmdline); do
-                case $x 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
-                        ;;
-                        # Moderate Visual Impairment
-                        access=v2)
-                        gct -s -t bool /desktop/gnome/interface/accessibility true
-                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [gnopernicus]
-                        gct -s -t bool /apps/gnopernicus/srcore/mag_active true
-                        gct -s -t bool /apps/gnopernicus/srcore/sp_active false
-                        ;;
-                        # Blindness
-                        access=v3)
-                        gct -s -t bool /desktop/gnome/sound/enable_esd false
-                        gct -s -t bool /desktop/gnome/interface/accessibility true
-                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [gnopernicus]
-                        gct -s -t bool /apps/gnopernicus/srcore/sp_active true
-                        gct -s -t bool /apps/gnopernicus/srcore/mag_active false
-                        ;;
-                        # 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
-                        ;;
-                        # Motor Difficulties - pointing devices
-                        access=m2)
-                        gct -s -t bool /desktop/gnome/accessibility/keyboard/enable 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 bool /desktop/gnome/interface/accessibility true
-                        gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats gok
-                        ;;
-               esac
-done
-log_end_msg