From b0c0f013bca8a2e8ea61fddf4a6676ebb30b6d2b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 18 Apr 2010 20:41:48 +0200 Subject: [PATCH] Adding upstream version 1.118.2. --- hooks/live | 2 ++ scripts/live | 53 ++++++++++++++++++++++++++++++++++--------- scripts/live-bottom/21xdriver | 51 +++++++++++++++++++++++++++++++++++++++++ scripts/live-bottom/99hook | 39 +++++++++++++++++++++++++++++++ scripts/live-helpers | 20 ++++++++++++++++ 5 files changed, 154 insertions(+), 11 deletions(-) create mode 100755 scripts/live-bottom/21xdriver create mode 100755 scripts/live-bottom/99hook diff --git a/hooks/live b/hooks/live index c18dfc2..ca2a761 100755 --- a/hooks/live +++ b/hooks/live @@ -81,6 +81,8 @@ manual_add_modules jffs2 copy_exec /sbin/losetup /sbin manual_add_modules loop manual_add_modules squashfs +manual_add_modules unlzma +manual_add_modules sqlzma # Filesystem: unionfs/aufs manual_add_modules unionfs diff --git a/scripts/live b/scripts/live index 332de10..0ed7675 100755 --- a/scripts/live +++ b/scripts/live @@ -60,6 +60,11 @@ Arguments () export FETCH ;; + hook=*) + HOOK="${ARGUMENT#hook=}" + export HOOK + ;; + hostname=*) HOSTNAME="${ARGUMENT#hostname=}" LIVECONF="changed" @@ -381,6 +386,16 @@ Arguments () export EXPOSED_ROOT ;; + plainroot) + PLAIN_ROOT="Yes" + export PLAIN_ROOT + ;; + + root=*) + ROOT="${ARGUMENT#root=}" + export ROOT + ;; + union=*) UNIONTYPE="${ARGUMENT#union=}" export UNIONTYPE @@ -396,6 +411,11 @@ Arguments () export XDEBCONF ;; + xdriver=*) + XDRIVER="${ARGUMENT#xdriver=}" + export XDRIVER + ;; + xvideomode=*) XVIDEOMODE="${ARGUMENT#xvideomode=}" export XVIDEOMODE @@ -1166,7 +1186,7 @@ find_livefs () fi # or do the scan of block devices - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram) + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-') do devname=$(sys2dev "${sysblock}") fstype=$(get_fstype "${devname}") @@ -1213,6 +1233,11 @@ set_usplash_timeout () mountroot () { + + if [ -x /scripts/local-top/cryptroot ]; then + /scripts/local-top/cryptroot + fi + exec 6>&1 exec 7>&2 exec > live.log @@ -1239,18 +1264,24 @@ mountroot () 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 "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ] + then + # Do a local boot from hd + livefs_root=${ROOT} + else + # Scan local devices for the image + for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + do + livefs_root=$(find_livefs ${i}) - if [ -n "${livefs_root}" ] - then - break - fi + if [ -n "${livefs_root}" ] + then + break + fi - sleep 1 - done + sleep 1 + done + fi fi if [ -z "${livefs_root}" ] diff --git a/scripts/live-bottom/21xdriver b/scripts/live-bottom/21xdriver new file mode 100755 index 0000000..c96f0ea --- /dev/null +++ b/scripts/live-bottom/21xdriver @@ -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 "${NOXAUTOCONFIG}" ] +then + exit 0 +fi + +. /scripts/live-functions + +log_begin_msg "Configuring X kludges..." + +# live-initramfs script + +if [ -n "$XDRIVER" ] +then + mount -n -o bind /sys /root/sys + mount -n -o bind /proc /root/proc + mount -n -o bind /dev /root/dev + +chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF +set xserver-xorg/autodetect_video_card false +set xserver-xorg/config/device/driver ${XDRIVER} +EOF + + chroot /root dexconf + + umount /root/sys + umount /root/proc + umount /root/dev +fi + diff --git a/scripts/live-bottom/99hook b/scripts/live-bottom/99hook new file mode 100755 index 0000000..0341026 --- /dev/null +++ b/scripts/live-bottom/99hook @@ -0,0 +1,39 @@ +#!/bin/sh + +#set -e + +# initramfs-tools header + +PREREQ="" + +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + prereqs + exit 0 + ;; +esac + +# live-initramfs header + +if [ -z "${HOOK}" ] +then + exit 0 +fi + +. /scripts/live-functions + +log_begin_msg "Executing custom hook script..." + +# live-initramfs script + +cd /root +wget "${HOOK}" + +./$(basename ${HOOK}) + +log_end_msg diff --git a/scripts/live-helpers b/scripts/live-helpers index 504a3f4..807553a 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -34,6 +34,13 @@ get_fstype () local FSTYPE local FSSIZE + # fstype misreports LUKS devices + is_luks "${1}" + if [ $? -eq 0 ]; then + /lib/udev/vol_id -t ${1} 2>/dev/null + return + fi + eval $(fstype < ${1}) if [ "${FSTYPE}" != "unknown" ] @@ -306,3 +313,16 @@ get_mac () echo ${mac} } + +is_luks() +{ + devname="${1}" + if [ -x /sbin/cryptsetup ] + then + /sbin/cryptsetup isLuks "${devname}" 2>/dev/null + return $? + else + return 1 + fi + +} -- 2.1.4