X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=4169c9044b1c520917dc0ea8a14ec8e48535bb77;hb=e66f79476042794195978ee641aa7ea0d9ca6e0a;hp=631864399431c5c3e2daada6a9534ff6bb74da44;hpb=f1172ac042a963191d6a0f9eb57226a84e1ef720;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 6318643..4169c90 100755 --- a/scripts/live +++ b/scripts/live @@ -20,6 +20,7 @@ USERFULLNAME="Live user" HOSTNAME="host" mkdir -p "${mountpoint}" +tried="/tmp/tried" # Create /etc/mtab for debug purpose and future syncs if [ ! -d /etc ] @@ -45,37 +46,26 @@ fi Arguments () { PRESEEDS="" + LOCATIONS="" for ARGUMENT in $(cat /proc/cmdline) do case "${ARGUMENT}" in skipconfig) NOACCESSIBILITY="Yes" - NOAPPARMOR="Yes" NOAPTCDROM="Yes" NOAUTOLOGIN="Yes" NOCONSOLEKEYBOARD="Yes" NOFASTBOOT="Yes" NOFSTAB="Yes" - NOGNOMEPANEL="Yes" NOHOSTS="Yes" - NOJOCKEY="Yes" - NOKPERSONALIZER="Yes" - NOLANGUAGESELECTOR="Yes" NOLOCALES="Yes" NONETWORKING="Yes" - NOPOLKITCONF="Yes" - NOPOWERMANAGEMENT="Yes" - NOPROGRAMCRASHES="Yes" - NOSUDO="Yes" NOTIMEZONE="Yes" - NOUPDATENOTIFIER="Yes" - NOUSER="Yes" NOXAUTOCONFIG="Yes" NOXAUTOLOGIN="Yes" - NOXSCREENSAVER="Yes" - export NOACCESSIBILITY NOAPPARMOR NOAPTCDROM NOAUTOLOGIN NOCONSOLEKEYBOARD NOFASTBOOT NOFSTAB NOGNOMEPANEL NOHOSTS NOJOCKEY NOKPERSONALIZER NOLANGUAGESELECTOR NOLOCALES NONETWORKING NOPOLKITCONF NOPOWERMANAGEMENT NOPROGRAMCRASHES NOSUDO NOTIMEZONE NOUPDATENOTIFIER NOUSER NOXAUTOCONFIG NOXAUTOLOGIN NOXSCREENSAVER + export NOACCESSIBILITY NOAPTCDROM NOAUTOLOGIN NOCONSOLEKEYBOARD NOFASTBOOT NOFSTAB NOHOSTS NOLOCALES NONETWORKING NOTIMEZONE NOXAUTOCONFIG NOXAUTOLOGIN ;; access=*) @@ -120,11 +110,6 @@ Arguments () export FORCEPERSISTENTFSCK ;; - hook=*) - HOOK="${ARGUMENT#hook=}" - export HOOK - ;; - ftpfs=*) FTPFS="${ARGUMENT#ftpfs=}" export FTPFS @@ -135,12 +120,6 @@ Arguments () export HTTPFS ;; - hostname=*) - HOSTNAME="${ARGUMENT#hostname=}" - LIVECONF="changed" - export HOSTNAME LIVECONF - ;; - isofrom=*|fromiso=*) FROMISO="${ARGUMENT#*=}" export FROMISO @@ -270,11 +249,6 @@ Arguments () export NOACCESSIBILITY ;; - noapparmor) - NOAPPARMOR="Yes" - export NOAPPARMOR - ;; - noaptcdrom) NOAPTCDROM="Yes" export NOAPTCDROM @@ -305,26 +279,11 @@ Arguments () export NOFSTAB ;; - nognomepanel) - NOGNOMEPANEL="Yes" - export NOGNOMEPANEL - ;; - nohosts) NOHOSTS="Yes" export NOHOSTS ;; - nokpersonalizer) - NOKPERSONALIZER="Yes" - export NOKPERSONALIZER - ;; - - nolanguageselector) - NOLANGUAGESELECTOR="Yes" - export NOLANGUAGESELECTOR - ;; - nolocales) NOLOCALES="Yes" export NOLOCALES @@ -335,41 +294,11 @@ Arguments () export NONETWORKING ;; - nopowermanagement) - NOPOWERMANAGEMENT="Yes" - export NOPOWERMANAGEMENT - ;; - - noprogramcrashes) - NOPROGRAMCRASHES="Yes" - export NOPROGRAMCRASHES - ;; - - nojockey) - NOJOCKEY="Yes" - export NOJOCKEY - ;; - - nosudo) - NOSUDO="Yes" - export NOSUDO - ;; - swapon) SWAPON="Yes" export SWAPON ;; - noupdatenotifier) - NOUPDATENOTIFIER="Yes" - export NOUPDATENOTIFIER - ;; - - nouser) - NOUSER="Yes" - export NOUSER - ;; - noxautoconfig) NOXAUTOCONFIG="Yes" export NOXAUTOCONFIG @@ -417,8 +346,8 @@ Arguments () ;; preseed/file=*|file=*) - LOCATION="${ARGUMENT#*=}" - export LOCATION + LOCATIONS="${ARGUMENT#*=} ${LOCATIONS}" + export LOCATIONS ;; nopreseed) @@ -427,7 +356,7 @@ Arguments () ;; url=*) - location="${ARGUMENT#url=}" + URL_LOCATION="${ARGUMENT#url=}" mount -o bind /sys /root/sys mount -o bind /proc /root/proc @@ -435,14 +364,14 @@ Arguments () mkdir -p /root/var/run/network [ "${NETBOOT}" ] || chroot /root dhclient eth0 - chroot /root wget -P /tmp "${location}" + chroot /root wget -P /tmp "${URL_LOCATION}" [ "${NETBOOT}" ] || chroot /root ifconfig eth0 down umount /root/sys umount /root/proc umount /root/dev - LOCATION="/tmp/$(basename "${location}")" + LOCATIONS="/tmp/$(basename ${URL_LOCATION}) ${LOCATIONS}" ;; */*=*) @@ -518,11 +447,6 @@ Arguments () export UNIONTYPE ;; - utc=*) - UTC="${ARGUMENT#utc=}" - export UTC - ;; - xdebconf) XDEBCONF="Yes" export XDEBCONF @@ -665,12 +589,15 @@ is_nice_device () { sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-|platform-mmc|platform-mxsdhci)" + if /lib/udev/path_id "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-|platform-orion-ehci|platform-mmc|platform-mxsdhci|)" then return 0 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$' then return 0 + elif echo ${sysfs_path} | grep -q "^/block/dm-" + then + return 0 fi return 1 @@ -700,7 +627,7 @@ copy_live_to () if [ "${copytodev}" = "ram" ] then # copying to ram: - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\/dev/console # "cp -a" from busybox also copies hidden files else mkdir -p ${copyto}/${LIVE_MEDIA_PATH} - cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} # "cp -a" from busybox also copies hidden files + cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} + if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ] + then + cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto} + fi fi fi @@ -775,6 +706,10 @@ do_netmount () udevadm trigger udevadm settle + if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \ + [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ] + then + # if ethdevice was not specified on the kernel command line # make sure we try to get a working network configuration # for *every* present network device (except for loopback of course) @@ -818,6 +753,10 @@ do_netmount () fi done + else + ipconfig ${DEVICE} | tee /netboot.config + fi + # source relevant ipconfig output OLDHOSTNAME=${HOSTNAME} . /tmp/net-${DEVICE}.conf @@ -995,7 +934,7 @@ do_snap_copy () todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts) freespace=$(df -k | awk '/'${todev}'/{print $4}') else - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\" $tried && continue mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue + [ -n "$devuid" ] && echo "$devuid" >> $tried if is_live_path ${mountpoint} && \ ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint}) @@ -1660,7 +1603,7 @@ find_livefs () # or do the scan of block devices # prefer removable devices over non-removable devices, so scan them first - for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)") + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | egrep -v "/(loop|ram|dm-|fd)") do if [ "$(cat ${sysblock}/removable)" = "1" ] then @@ -1674,6 +1617,7 @@ find_livefs () for sysblock in $devices_to_scan do devname=$(sys2dev "${sysblock}") + [ -e "$devname" ] || continue fstype=$(get_fstype "${devname}") if /lib/udev/cdrom_id ${devname} > /dev/null @@ -1699,7 +1643,7 @@ find_livefs () 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. + # live-boot, so take it and run with it. ln -s "${devname}" "${devname}.${fstype}" echo "${devname}.${fstype}" return 0 @@ -1745,6 +1689,14 @@ integrity_check () fi } +start_usplash_pulse () +{ + if [ -x /sbin/usplash_write ] + then + /sbin/usplash_write "PULSELOGO" + fi +} + mountroot () { if [ -x /scripts/local-top/cryptroot ]; then @@ -1764,6 +1716,7 @@ mountroot () Arguments set_usplash_timeout + start_usplash_pulse maybe_break live-premount log_begin_msg "Running /scripts/live-premount" @@ -1858,6 +1811,13 @@ mountroot () mount -n -o bind /dev "${rootmnt}/dev" fi + # 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 --move /live/image /root/live/image + fi + maybe_break live-bottom log_begin_msg "Running /scripts/live-bottom\n"