From 6c1a2cfab139bb4a61e7bcf5f4cafe3b7498f64e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 14:46:24 +0200 Subject: [PATCH] Adding casper 1.66+debian-1. --- bin/casper-reconfigure | 6 ++- casper.conf | 4 +- debian/{dirs => casper.dirs} | 0 debian/{init.d => casper.init} | 2 +- debian/{install => casper.install} | 0 debian/{postinst => casper.postinst} | 0 debian/changelog | 7 ++++ debian/changelog.upstream | 10 +++++ debian/control | 4 +- debian/control.debian | 17 ++++++++ debian/control.ubuntu | 25 +++++++++++ debian/rules | 65 +++++++++++++++++++++++------ hooks/casper | 40 ++++++++++-------- scripts/casper | 21 ++++++---- scripts/casper-bottom/10adduser | 39 ++++++++++------- scripts/casper-bottom/14locales | 12 +++++- scripts/casper-bottom/15autologin | 7 +++- scripts/casper-bottom/22gnome_panel_data | 2 +- scripts/casper-bottom/22screensaver | 2 +- scripts/casper-bottom/30accessibility | 2 +- scripts/casper-bottom/32disable_hibernation | 2 +- ubiquity-hooks/30accessibility | 9 ++-- 22 files changed, 206 insertions(+), 70 deletions(-) rename debian/{dirs => casper.dirs} (100%) rename debian/{init.d => casper.init} (93%) rename debian/{install => casper.install} (100%) rename debian/{postinst => casper.postinst} (100%) create mode 100644 debian/control.debian create mode 100644 debian/control.ubuntu diff --git a/bin/casper-reconfigure b/bin/casper-reconfigure index 628bff3..7855210 100755 --- a/bin/casper-reconfigure +++ b/bin/casper-reconfigure @@ -47,6 +47,10 @@ if [ -z "$version" ]; then exit 0 fi -runcommandinroot "$root" dpkg-reconfigure -fnoninteractive --no-reload -phigh "$package" +if [ "${BUILD_SYSTEM}" == "Debian" ]; then + runcommandinroot "$root" dpkg-reconfigure -fnoninteractive --no-reload -phigh "$package" +else + runcommandinroot "$root" dpkg-reconfigure -fnoninteractive --no-reload "$package" +fi exit 0 diff --git a/casper.conf b/casper.conf index 1596dff..ba5101c 100644 --- a/casper.conf +++ b/casper.conf @@ -1,8 +1,8 @@ # This file should go in /etc/casper.conf # Supported variables are: -# USERNAME, USERFULLNAME, HOST +# USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM export USERNAME="casper" export USERFULLNAME="Live session user" export HOST="live" - +export BUILD_SYSTEM="Debian" diff --git a/debian/dirs b/debian/casper.dirs similarity index 100% rename from debian/dirs rename to debian/casper.dirs diff --git a/debian/init.d b/debian/casper.init similarity index 93% rename from debian/init.d rename to debian/casper.init index 424c024..e0522e0 100644 --- a/debian/init.d +++ b/debian/casper.init @@ -33,7 +33,7 @@ done eject -p -m /live_media >/dev/null 2>&1 # XXX - i18n -echo -n "Please remove the disc (if any), close the tray (if any) and press ENTER: " +echo -n "Please remove the disc and close the tray (if any) then press ENTER: " if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TIMEOUT 0" /sbin/usplash_write "TEXT Please remove the disc, close the tray (if any)" diff --git a/debian/install b/debian/casper.install similarity index 100% rename from debian/install rename to debian/casper.install diff --git a/debian/postinst b/debian/casper.postinst similarity index 100% rename from debian/postinst rename to debian/casper.postinst diff --git a/debian/changelog b/debian/changelog index 9da2e97..33da0a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +casper (1.66+debian-1) unstable; urgency=low + + * Added "magic" to make it work seamlessy also on ubuntu systems. + * Default user password now "live". + + -- Marco Amadori Fri, 1 Sep 2006 17:18:07 +0200 + casper (1.65+debian-1) unstable; urgency=low * New upstream release. diff --git a/debian/changelog.upstream b/debian/changelog.upstream index 8e20a26..6eb6873 100644 --- a/debian/changelog.upstream +++ b/debian/changelog.upstream @@ -1,3 +1,13 @@ +casper (1.66) edgy; urgency=low + + * Fix use of db_get in ubiquity accessibility hook. + * Use sudo instead of su to get to the live session user from the + initramfs or to the newly-installed user from ubiquity. su's argument + handling has changed so that the previous code no longer worked, and su + was never all that good for arguments containing spaces anyway. + + -- Colin Watson Mon, 4 Sep 2006 15:46:55 +0100 + casper (1.65) edgy; urgency=low * Update to call udevsettle/udevtrigger instead of udevplug diff --git a/debian/control b/debian/control index 4445546..cd9eee6 100644 --- a/debian/control +++ b/debian/control @@ -1,9 +1,9 @@ Source: casper Section: misc -Priority: optional +Priority: extra Maintainer: Debian Live Uploaders: Marco Amadori , Daniel Baumann -Build-Depends: debhelper (>= 4) +Build-Depends: debhelper (>= 4), lsb-release Standards-Version: 3.7.2 Package: casper diff --git a/debian/control.debian b/debian/control.debian new file mode 100644 index 0000000..cd9eee6 --- /dev/null +++ b/debian/control.debian @@ -0,0 +1,17 @@ +Source: casper +Section: misc +Priority: extra +Maintainer: Debian Live +Uploaders: Marco Amadori , Daniel Baumann +Build-Depends: debhelper (>= 4), lsb-release +Standards-Version: 3.7.2 + +Package: casper +Architecture: any +Depends: initramfs-tools (>= 0.40), user-setup +Conflicts: usplash (<< 0.1-30) +Recommends: live-package +Suggests: dmsetup +Description: Debian Live initramfs generator + Casper provides an initramfs generator suited for booting a Debian Live systems + from read only media. Useful to build live CDs. diff --git a/debian/control.ubuntu b/debian/control.ubuntu new file mode 100644 index 0000000..a8ab8de --- /dev/null +++ b/debian/control.ubuntu @@ -0,0 +1,25 @@ +Source: casper +Section: misc +Priority: optional +Maintainer: Tollef Fog Heen +Build-Depends: debhelper (>> 4.2.0), lsb-release +Standards-Version: 3.6.1 + +Package: casper +Architecture: any +Section: misc +Priority: extra +Depends: initramfs-tools (>= 0.40ubuntu11), dmsetup, user-setup, sudo +Conflicts: usplash (<< 0.1-30) +Description: Run a "live" preinstalled system from read-only media + +Package: ubiquity-casper +Architecture: all +Depends: laptop-detect, sudo +Conflicts: espresso-casper +Replaces: espresso-casper +Enhances: ubiquity +Description: Configuration hooks for live installer + This package provides hook scripts for the Ubiquity live installer that + repeat some pieces of configuration done by the live system boot process in + the system installed by Ubiquity. diff --git a/debian/rules b/debian/rules index bd01663..d1d44a5 100755 --- a/debian/rules +++ b/debian/rules @@ -3,25 +3,42 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +# Looking in which build system we are +BUILD_SYSTEM := $(shell lsb_release --short --id) + build: build-stamp build-stamp: dh_testdir - + # Setting BUILD_SYSTEM in the binary package + sed -i -e 's/\(BUILD_SYSTEM="\).*"/\1'$(BUILD_SYSTEM)'"/g' casper.conf +ifeq ($(BUILD_SYSTEM),Debian) + cp debian/control.debian debian/control +else + cp debian/control.ubuntu debian/control +endif + # Building package $(MAKE) -C casper-md5check touch build-stamp clean: + dh_testdir rm -f build-stamp # Cleaning package -$(MAKE) -C casper-md5check clean + # Putting back default files + cp -f debian/control.debian debian/control + sed -i -e 's/\(BUILD_SYSTEM="\).*"/\1'Debian'"/g' casper.conf + dh_clean + install: build + dh_testdir dh_testroot dh_clean -k @@ -37,23 +54,45 @@ install: build # Installing lintian override install -D -m 0644 debian/lintian debian/casper/usr/share/lintian/overrides/casper + # Install casper.conf + install -m 0644 casper.conf debian/casper/etc/casper.conf + binary-indep: build install +ifneq ($(BUILD_SYSTEM),Debian) + # Conditionally build Ubiquity + dh_testdir + dh_testroot + dh_installexamples -i + dh_installdocs -i + dh_installchangelogs -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i +endif binary-arch: build install + dh_testdir dh_testroot - dh_installchangelogs debian/changelog.upstream - dh_installdocs - dh_installexamples - dh_installinit -r --no-start -- start 89 0 6 . - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb +ifeq ($(BUILD_SYSTEM),Debian) + dh_installchangelogs -a debian/changelog.upstream +else + dh_installchangelogs -a +endif + dh_installdocs -a + dh_installexamples -a + dh_installinit -a -r --no-start -- start 89 0 6 . + dh_link -a + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_installdeb -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a binary: binary-arch binary-indep .PHONY: build clean binary-indep binary-arch binary install diff --git a/hooks/casper b/hooks/casper index 191f2f5..f7fee12 100755 --- a/hooks/casper +++ b/hooks/casper @@ -18,15 +18,21 @@ esac . /usr/share/initramfs-tools/hook-functions - manual_add_modules unionfs +# Copy in casper.conf +if [ -e /etc/casper.conf ]; then + . /etc/casper.conf + mkdir -p ${DESTDIR}/etc + cp /etc/casper.conf ${DESTDIR}/etc +fi + # Needed for devmapper if [ -e /sbin/dmsetup ]; then - manual_add_modules cloop - copy_exec /sbin/blockdev /sbin - copy_exec /sbin/dmsetup /sbin - manual_add_modules dm-snapshot + manual_add_modules cloop + copy_exec /sbin/blockdev /sbin + copy_exec /sbin/dmsetup /sbin + manual_add_modules dm-snapshot fi # We need losetup @@ -37,24 +43,24 @@ mkdir -p ${DESTDIR}/lib/casper copy_exec /usr/share/casper/casper-reconfigure /bin copy_exec /usr/share/casper/casper-preseed /bin -# Ubuntu or Debian test -# mkdir -p ${DESTDIR}/lib/udev -# copy_exec /lib/udev/cdrom_id /lib/udev -# copy_exec /lib/udev/vol_id /lib/udev -# copy_exec /lib/udev/path_id /lib/udev -# FIXME: add lsb check for ubuntu +if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then + mkdir -p ${DESTDIR}/lib/udev + copy_exec /lib/udev/cdrom_id /lib/udev + copy_exec /lib/udev/vol_id /lib/udev + copy_exec /lib/udev/path_id /lib/udev +fi + copy_exec /sbin/udevtrigger /sbin copy_exec /sbin/udevsettle /sbin - copy_exec /usr/bin/udevinfo /bin -# cifs boot +# cifs boot if [ -x /sbin/mount.cifs ]; then - copy_exec /sbin/mount.cifs /sbin - for x in cifs; do - manual_add_modules ${x} - done + copy_exec /sbin/mount.cifs /sbin + for x in cifs; do + manual_add_modules ${x} + done fi # squashfs diff --git a/scripts/casper b/scripts/casper index 61e579c..3e4ed06 100644 --- a/scripts/casper +++ b/scripts/casper @@ -23,12 +23,19 @@ home_persistence="home-rw" USERNAME="casper" USERFULLNAME="Live session user" HOST="live" +BUILD_SYSTEM="Debian" mkdir -p $mountpoint [ -f /etc/casper.conf ] && . /etc/casper.conf -export USERNAME USERFULLNAME HOST +export USERNAME USERFULLNAME HOST BUILD_SYSTEM + +if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then + MP_QUIET="-Q" +else + MP_QUIET="-q" +fi # looking for casper specifics options as kernel parameters for x in $(cat /proc/cmdline); do @@ -133,7 +140,7 @@ setup_loop() { local module=$2 local pattern=$3 - modprobe -qb "$module" + modprobe "${MP_QUIET}" -b "$module" udevsettle for loopdev in $pattern; do @@ -164,7 +171,7 @@ setup_devmapper() { backdev="$1" rootmnt="$2" - modprobe -qb dm-mod + modprobe "${MP_QUIET}" -b dm-mod COW_DEVICE=/dev/ram1 COW_NAME="casper-cow" @@ -267,7 +274,7 @@ find_cow_device() { do_netmount() { rc=1 - modprobe -q af_packet # For DHCP + modprobe "${MP_QUIET}" af_packet # For DHCP ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf @@ -291,7 +298,7 @@ do_netmount() { do_nfsmount() { rc=1 - modprobe -q nfs + modprobe "${MP_QUIET}" nfs if [ -z "${NFSOPTS}" ]; then NFSOPTS="" fi @@ -315,7 +322,7 @@ do_cifsmount() { fi [ "$quiet" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}" - modprobe -q cifs + modprobe "${MP_QUIET}" cifs if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}" ; then rc=0 @@ -328,7 +335,7 @@ setup_unionfs() { image_directory="$1" rootmnt="$2" - modprobe -qb unionfs + modprobe "${MP_QUIET}" -b unionfs # run-init can't deal with this, but we're going to move all of these # away before it runs anyway. diff --git a/scripts/casper-bottom/10adduser b/scripts/casper-bottom/10adduser index 700f8c3..e85f947 100755 --- a/scripts/casper-bottom/10adduser +++ b/scripts/casper-bottom/10adduser @@ -20,18 +20,28 @@ esac log_begin_msg "$DESCRIPTION" +if [ "${BUILD_SYSTEM}" == "Debian" ]; then + user_crypted="8Ab05sVQ4LLps" # as in `echo "live" | mkpasswd -s` +else + user_crypted="U6aMy0wojraho" # "ubuntu" +fi + # U6aMy0wojraho is just a blank password chroot /root debconf-communicate -fnoninteractive casper > /dev/null < /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 +fi # Clear out debconf database again to avoid confusing ubiquity later. chroot /root debconf-communicate -fnoninteractive casper > /dev/null <> /root/etc/environment + if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then + # XXX - awful hack to stop xscreensaver locking the screen (#7150) + echo 'RUNNING_UNDER_GDM="yes"' >> /root/etc/environment 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 - 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 + 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 else # We are in debian :-) echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers fi diff --git a/scripts/casper-bottom/14locales b/scripts/casper-bottom/14locales index ebe7616..f69fa0f 100755 --- a/scripts/casper-bottom/14locales +++ b/scripts/casper-bottom/14locales @@ -27,6 +27,10 @@ elif [ -e /root/etc/environment ]; then # Old locales policy grep_file=/root/etc/environment fi +if [ -z "${grep_file}" ]; then + grep_file=/root/etc/default/locale +fi + # commandline for x in $(cat /proc/cmdline); do case $x in @@ -49,8 +53,12 @@ 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}" + printf 'LANG="%s"\n' "${LANG}" >> "${grep_file}" + if [ "${BUILD_SYSTEM}" == "Debian" ]; then + chroot /root /usr/sbin/locale-gen + else + chroot /root /usr/sbin/locale-gen "${LANG}" + fi fi log_end_msg diff --git a/scripts/casper-bottom/15autologin b/scripts/casper-bottom/15autologin index 745e6ce..ff88721 100755 --- a/scripts/casper-bottom/15autologin +++ b/scripts/casper-bottom/15autologin @@ -27,8 +27,11 @@ else fi if chroot /root [ -f ${GDMCONF} ]; then - # true hack ! -- nohar - chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf + 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/" \ diff --git a/scripts/casper-bottom/22gnome_panel_data b/scripts/casper-bottom/22gnome_panel_data index e87c94f..5509ce1 100755 --- a/scripts/casper-bottom/22gnome_panel_data +++ b/scripts/casper-bottom/22gnome_panel_data @@ -28,7 +28,7 @@ fi panel_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-panel-data 2>/dev/null) || panel_version="" if [ -n "$panel_version" ]; then - chroot /root su $USERNAME -- gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true + 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/casper-bottom/22screensaver b/scripts/casper-bottom/22screensaver index 2a98b1a..6719f5f 100755 --- a/scripts/casper-bottom/22screensaver +++ b/scripts/casper-bottom/22screensaver @@ -22,7 +22,7 @@ log_begin_msg "$DESCRIPTION" gnome_screensaver_version=$(chroot /root dpkg-query -W --showformat='${Version}' gnome-screensaver 2>/dev/null) || gnome_screensaver_version="" if [ -n "$gnome_screensaver_version" ]; then - chroot /root su $USERNAME -- gconftool-2 -t bool -s /apps/gnome-screensaver/lock false + chroot /root sudo -u "$USERNAME" gconftool-2 -t bool -s /apps/gnome-screensaver/lock false fi log_end_msg diff --git a/scripts/casper-bottom/30accessibility b/scripts/casper-bottom/30accessibility index c6015e1..8352fb6 100755 --- a/scripts/casper-bottom/30accessibility +++ b/scripts/casper-bottom/30accessibility @@ -21,7 +21,7 @@ esac log_begin_msg "$DESCRIPTION" gct() { - chroot /root su $USERNAME -- gconftool-2 "$@" + chroot /root sudo -u "$USERNAME" gconftool-2 "$@" } for x in $(cat /proc/cmdline); do diff --git a/scripts/casper-bottom/32disable_hibernation b/scripts/casper-bottom/32disable_hibernation index 7b7d976..badcef6 100755 --- a/scripts/casper-bottom/32disable_hibernation +++ b/scripts/casper-bottom/32disable_hibernation @@ -24,7 +24,7 @@ log_begin_msg "$DESCRIPTION" gpm_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-power-manager 2>/dev/null) || panel_version="" if [ -n "$gpm_version" ]; then casper-reconfigure /root gnome-power-manager - chroot /root su $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_hibernate false fi if [ -f /root/usr/share/kubuntu-default-settings/kde-profile/default/share/config/kcmlaptoprc ]; then diff --git a/ubiquity-hooks/30accessibility b/ubiquity-hooks/30accessibility index ab1c2e9..9fcfc26 100755 --- a/ubiquity-hooks/30accessibility +++ b/ubiquity-hooks/30accessibility @@ -4,10 +4,11 @@ PREREQ="" DESCRIPTION="Configuring accessibility options..." -USERNAME=$(db_get passwd/username) +db_get passwd/username +USERNAME="$RET" gct() { - chroot /target su $USERNAME -- gconftool-2 "$@" + chroot /target sudo -u "$USERNAME" gconftool-2 "$@" } for x in $(cat /proc/cmdline); do @@ -21,8 +22,8 @@ for x in $(cat /proc/cmdline); do 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/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 -- 2.1.4