X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=a17eb423fca132f0aaf03c8ca6f956766eaef797;hb=52dcef518bdb95605670b8dc12257057bf7a2dc0;hp=412094aee2b4990b231e064e71da8d423ed4abee;hpb=4b1c986014cfed5a6e4380fe73b609bd7d2d8869;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 412094a..a17eb42 100755 --- a/scripts/live +++ b/scripts/live @@ -88,12 +88,8 @@ Arguments () ethdevice=*) DEVICE="${ARGUMENT#ethdevice=}" - export DEVICE - ;; - - ethdevice=*) - ETHDEVICE="${ARGUMENT#ethdevice=}" - export ETHDEVICE + ETHDEVICE="${DEVICE}" + export DEVICE ETHDEVICE ;; ethdevice-timeout=*) @@ -643,6 +639,22 @@ do_netsetup () HWADDR="$(cat /sys/class/net/${DEVICE}/address)" fi + if [ ! -e "/etc/resolv.conf" ] + then + echo "Creating /etc/resolv.conf" + + if [ -n "${DNSDOMAIN}" ] + then + echo "domain ${DNSDOMAIN}" > /etc/resolv.conf + echo "search ${DNSDOMAIN}" > /etc/resolv.conf + fi + + for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1} + do + echo "nameserver $i" >> /etc/resolv.conf + done + fi + # Check if we have a network device at all if ! ls /sys/class/net/"$DEVICE" > /dev/null 2>&1 && \ ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \ @@ -789,7 +801,7 @@ do_httpmount () fi modprobe fuse $FUSE_MOUNT "${url}" "${dest}" - FUSE_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )" + ROOT_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )" fi [ ${?} -eq 0 ] && rc=0 [ "${extension}" = "tgz" ] && live_dest="ram" @@ -820,9 +832,6 @@ do_httpmount () elif [ "${webfile}" != "FETCH" ] ; then NETBOOT="${webfile}" export NETBOOT - if [ -n "${FUSE_PID}" ] ; then - echo "${FUSE_PID}" > ${mountpoint}/root.pid - fi fi return ${rc} @@ -964,19 +973,20 @@ try_snap () snapback="$(echo ${snapdata} | cut -f2 -d ' ')" snapfile="$(echo ${snapdata} | cut -f3 -d ' ')" - RES="" if ! try_mount "${snapdev}" "${snapback}" "ro" then break fi + RES="0" + if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)' then # squashfs, jffs2 or ext2/ext3/ext4 snapshot dev=$(get_backing_device "${snapback}/${snapfile}") do_snap_copy "${dev}" "${snap_mount}" "${snap_type}" - RES=$? + RES="$?" else # cpio.gz snapshot @@ -992,9 +1002,12 @@ try_snap () cpioargs='--unconditional --make-directories' fi - if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null) + cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null + RES="$?" + + if [ "${RES}" != "0" ] then - log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\"" + log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\"" fi fi @@ -1595,6 +1608,7 @@ find_livefs () fi done elif [ "${fstype}" = "squashfs" -o \ + "${fstype}" = "btrfs" -o \ "${fstype}" = "ext2" -o \ "${fstype}" = "ext3" -o \ "${fstype}" = "ext4" -o \ @@ -1704,6 +1718,20 @@ mountroot () # Do a local boot from hd livefs_root=${ROOT} else + if [ -x /usr/bin/memdiskfind ] + then + MEMDISK=$(/usr/bin/memdiskfind) + + if [ $? -eq 0 ] + then + # We found a memdisk, set up phram + modprobe phram phram=memdisk,${MEMDISK} + + # Load mtdblock, the memdisk will be /dev/mtdblock0 + modprobe mtdblock + fi + fi + # Scan local devices for the image i=0 while [ "$i" -lt 60 ] @@ -1764,6 +1792,11 @@ mountroot () mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}" fi + + if [ -n "${ROOT_PID}" ] ; then + echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid + fi + log_end_msg # unionfs-fuse needs /dev to be bind-mounted for the duration of