X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=components%2F9990-main.sh;h=7fb7ed367513e392fae554e6568322785920725c;hb=HEAD;hp=7e385f5ef47f6d07c46f7261a3cd09b9dadef2cd;hpb=179707ba4f8a5d64b567ae05bc287d368af33577;p=live-boot-grml.git diff --git a/components/9990-main.sh b/components/9990-main.sh index 7e385f5..063445b 100755 --- a/components/9990-main.sh +++ b/components/9990-main.sh @@ -33,7 +33,7 @@ Live () # Needed here too because some things (*cough* udev *cough*) # changes the timeout - if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ] + if [ -n "${NETBOOT}" ] || [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] then if do_netmount then @@ -52,28 +52,58 @@ Live () else if [ -x /usr/bin/memdiskfind ] then - if ! MEMDISK=$(/usr/bin/memdiskfind) + if ! dd if=/dev/mem of=/dev/zero bs=1 count=1 >/dev/null 2>&1 then - # We found a memdisk, set up phram - # Sometimes "modprobe phram" can not successfully create /dev/mtd0. - # Have to try several times. - max_try=20 - while [ ! -c /dev/mtd0 ] && [ "$max_try" -gt 0 ]; do - modprobe phram "phram=memdisk,${MEMDISK}" - sleep 0.2 - if [ -c /dev/mtd0 ]; then - break - else - rmmod phram - fi - max_try=$((max_try - 1)) - done - - # Load mtdblock, the memdisk will be /dev/mtdblock0 - modprobe mtdblock + log_begin_msg "access to /dev/mem is restriced, skipping memdiskfind" + log_end_msg + else + if MEMDISK=$(/usr/bin/memdiskfind) + then + # We found a memdisk, set up phram + # Sometimes "modprobe phram" can not successfully create /dev/mtd0. + # Have to try several times. + max_try=20 + while [ ! -c /dev/mtd0 ] && [ "$max_try" -gt 0 ]; do + modprobe phram "phram=memdisk,${MEMDISK}" + sleep 0.2 + if [ -c /dev/mtd0 ]; then + break + else + rmmod phram + fi + max_try=$((max_try - 1)) + done + + # Load mtdblock, the memdisk will be /dev/mtdblock0 + modprobe mtdblock + fi fi fi + # If the live media location is given via command line and access to it + # involves LVM volumes, the corresponding volumes need to be activated. + IFS=',' + for dev in $(echo "$LIVE_MEDIA") + do + case "$dev" in + /dev/mapper/*) + eval $(dmsetup splitname --nameprefixes --noheadings --rows "${dev#/dev/mapper/}") + if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ] + then + lvm lvchange -aay -y --sysinit --ignoreskippedcluster "$DM_VG_NAME/$DM_LV_NAME" + fi + ;; + /dev/*/*) + # Could be /dev/VG/LV; use lvs to check + if lvm lvs -- "$dev" >/dev/null 2>&1 + then + lvm lvchange -aay -y --sysinit --ignoreskippedcluster "$dev" + fi + ;; + esac + done + unset IFS + # Scan local devices for the image i=0 while [ "$i" -lt 60 ] @@ -165,6 +195,20 @@ Live () fi fi + if [ -f /etc/hostname ] && ! grep -E -q -v '^[[:space:]]*(#|$)' "${rootmnt}/etc/hostname" + then + log_begin_msg "Copying /etc/hostname to ${rootmnt}/etc/hostname" + cp -v /etc/hostname "${rootmnt}/etc/hostname" + log_end_msg + fi + + if [ -f /etc/hosts ] && ! grep -E -q -v '^[[:space:]]*(#|$|(127.0.0.1|::1|ff02::[12])[[:space:]])' "${rootmnt}/etc/hosts" + then + log_begin_msg "Copying /etc/hosts to ${rootmnt}/etc/hosts" + cp -v /etc/hosts "${rootmnt}/etc/hosts" + log_end_msg + fi + if [ -L /root/etc/resolv.conf ] ; then # assume we have resolvconf DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base" @@ -191,10 +235,15 @@ Live () mount --rbind /run/live "${rootmnt}/lib/live/mount" Fstab - Netbase Swap + if grep -q debian_networking /proc/cmdline ; then + Netbase + else + Grml_Networking + fi + exec 1>&6 6>&- exec 2>&7 7>&- kill ${tailpid}