X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=2b8ff0109a37e9022c763df2e1f733eb368d711e;hb=d645cf3735a13845ef25042a1974dd72e96a64a7;hp=16a54c2059206d6750fd69acd2a46048dfa15ca3;hpb=f197369a2f2a0078e58b869f5884254d138e5894;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 16a54c2..2b8ff01 100755 --- a/scripts/live +++ b/scripts/live @@ -18,12 +18,22 @@ home_snapshot_label="home-sn" USERNAME="user" USERFULLNAME="Live user" HOSTNAME="host" -BUILD_SYSTEM="Custom" mkdir -p "${mountpoint}" +# Create /etc/mtab for debug purpose and future syncs +if [ ! -d /etc ] +then + mkdir /etc/ +fi + +if [ ! -f /etc/mtab ] +then + touch /etc/mtab +fi + [ -f /etc/live.conf ] && . /etc/live.conf -export USERNAME USERFULLNAME HOSTNAME BUILD_SYSTEM +export USERNAME USERFULLNAME HOSTNAME . /scripts/live-helpers @@ -46,7 +56,7 @@ Arguments () console=*) DEFCONSOLE="${ARGUMENT#*=}" - export DEFCONFSOLE + export DEFCONSOLE ;; debug) @@ -61,6 +71,21 @@ Arguments () export FETCH ;; + hook=*) + HOOK="${ARGUMENT#hook=}" + export HOOK + ;; + + ftpfs=*) + FTPFS="${ARGUMENT#ftpfs=}" + export FTPFS + ;; + + httpfs=*) + HTTPFS="${ARGUMENT#httpfs=}" + export HTTPFS + ;; + hostname=*) HOSTNAME="${ARGUMENT#hostname=}" LIVECONF="changed" @@ -80,7 +105,14 @@ Arguments () ;; ignore_uuid) - IGNORE_UUID="Yes" ;; + IGNORE_UUID="Yes" + export IGNORE_UUID + ;; + + integrity-check) + INTEGRITY_CHECK="Yes" + export INTEGRITY_CHECK + ;; ip=*) STATICIP="${ARGUMENT#ip=}" @@ -148,6 +180,12 @@ Arguments () export LIVE_MEDIA_TIMEOUT ;; + language=*|debian-installer/language=*) + language=${x#debian-installer/language=} + locale="$(lang2locale "$language")" + set_locale="true" + ;; + locale=*|debian-installer/locale=*) LOCALE="${ARGUMENT#*=}" export LOCALE @@ -168,6 +206,11 @@ Arguments () export NFSOPTS ;; + nfscow=*) + NFS_COW="${ARGUMENT#nfscow=}" + export NFS_COW + ;; + noaccessibility) NOACCESSIBILITY="Yes" export NOACCESSIBILITY @@ -223,11 +266,6 @@ Arguments () export NOKPERSONALIZER ;; - nokwallet) - NOKWALLET="Yes" - export NOKWALLET - ;; - nolanguageselector) NOLANGUAGESELECTOR="Yes" export NOLANGUAGESELECTOR @@ -253,9 +291,9 @@ Arguments () export NOPROGRAMCRASHES ;; - norestrictedmanager) - NORESTRICTEDMANAGER="Yes" - export NORESTRICTEDMANAGER + nojockey) + NOJOCKEY="Yes" + export NOJOCKEY ;; nosudo) @@ -263,9 +301,9 @@ Arguments () export NOSUDO ;; - noswap) - NOSWAP="Yes" - export NOSWAP + swapon) + SWAPON="Yes" + export SWAPON ;; noupdatenotifier) @@ -293,6 +331,15 @@ Arguments () export PERSISTENT ;; + persistent=*) + PERSISTENT="${ARGUMENT#persistent=}" + if [ -z "${PERSISTENT}" ] + then + PERSISTENT="Yes" + fi + export PERSISTENT + ;; + nopersistent) NOPERSISTENT="Yes" export NOPERSISTENT @@ -311,14 +358,14 @@ Arguments () url=*) location="${ARGUMENT#url=}" - mount -n -o bind /sys /root/sys - mount -n -o bind /proc /root/proc - mount -n -o bind /dev /root/dev + mount -o bind /sys /root/sys + mount -o bind /proc /root/proc + mount -o bind /dev /root/dev mkdir -p /root/var/run/network - chroot /root ifup -a + chroot /root dhclient eth0 chroot /root wget -P /tmp "${location}" - chroot /root ifdown -a + chroot /root ifconfig eth0 down umount /root/sys umount /root/proc @@ -370,6 +417,21 @@ Arguments () export TORAM MODULETORAM ;; + exposedroot) + EXPOSED_ROOT="Yes" + export EXPOSED_ROOT + ;; + + plainroot) + PLAIN_ROOT="Yes" + export PLAIN_ROOT + ;; + + root=*) + ROOT="${ARGUMENT#root=}" + export ROOT + ;; + union=*) UNIONTYPE="${ARGUMENT#union=}" export UNIONTYPE @@ -385,6 +447,11 @@ Arguments () export XDEBCONF ;; + xdriver=*) + XDRIVER="${ARGUMENT#xdriver=}" + export XDRIVER + ;; + xvideomode=*) XVIDEOMODE="${ARGUMENT#xvideomode=}" export XVIDEOMODE @@ -414,7 +481,7 @@ Arguments () if [ -z "${UNIONTYPE}" ] then - UNIONTYPE="unionfs" + UNIONTYPE="aufs" export UNIONTYPE fi } @@ -425,7 +492,7 @@ is_live_path () if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ] then - for FILESYSTEM in squashfs ext2 ext3 xfs dir + for FILESYSTEM in squashfs ext2 ext3 xfs dir jffs2 do if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ] then @@ -437,27 +504,36 @@ is_live_path () return 1 } -matches_uuid() { - if [ "$IGNORE_UUID" ] || [ ! -e /conf/uuid.conf ]; then - return 0 - fi - path="$1" - uuid="$(cat /conf/uuid.conf)" - for try_uuid_file in "$mountpoint/.disk/casper-uuid"*; do - [ -e "$try_uuid_file" ] || continue - try_uuid="$(cat "$try_uuid_file")" - if [ "$uuid" = "$try_uuid" ]; then - return 0 - fi - done - return 1 +matches_uuid () +{ + if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ] + then + return 0 + fi + + path="${1}" + uuid="$(cat /conf/uuid.conf)" + + for try_uuid_file in "${path}/.disk/live-uuid"* + do + [ -e "${try_uuid_file}" ] || continue + + try_uuid="$(cat "${try_uuid_file}")" + + if [ "${uuid}" = "${try_uuid}" ] + then + return 0 + fi + done + + return 1 } get_backing_device () { case "${1}" in - *.squashfs|*.ext2|*.ext3) - echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}") + *.squashfs|*.ext2|*.ext3|*.jffs2) + echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}") ;; *.dir) @@ -487,15 +563,19 @@ mount_images_in_directory () { directory="${1}" rootmnt="${2}" + mac="${3}" + 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}/*.jffs2" || match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir" then - setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" + [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}" + setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}" else - : + panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}." fi } @@ -503,7 +583,10 @@ is_nice_device () { sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])" + if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb))" + then + return 0 + elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$' then return 0 fi @@ -511,20 +594,6 @@ is_nice_device () 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}" @@ -549,7 +618,7 @@ copy_live_to () 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}' - ) ) + freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\