X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=cacd5b99ff05d85b531505fa2854cc6f8c6452b7;hp=19e74590a6f452d4f566c1e6a891162c0afcb318;hb=a1526917cb7ba6e7cf8ae5334310123ba6d8fae6;hpb=02c0126afa706977c2c7941945b24c487a13bd57 diff --git a/autoconfig.functions b/autoconfig.functions index 19e7459..cacd5b9 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -15,8 +15,10 @@ umask 022 # old linuxrc version: [ -d /cdrom ] && export LIVECD_PATH=/cdrom -# new initramfs layout: +# initramfs layout until around December 2012: [ -d /live/image ] && export LIVECD_PATH=/live/image +# initramfs layout since around December 2012: +[ -d /lib/live/mount/medium ] && export LIVECD_PATH=/lib/live/mount/medium # Ignore these signals in non-interactive mode: INT, TERM, SEGV [ -z "$PS1" ] && trap "" 2 3 11 @@ -38,13 +40,12 @@ if [ -z "$CMDLINE" ]; then # if CMDLINE was set from the outside, we're debugging. # otherwise, take CMDLINE from Kernel and config files. CMDLINE="$(cat /proc/cmdline)" - [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/* | tr '\n' ' ')" - [ -d /live/image/bootparams/ ] && CMDLINE="$CMDLINE $(cat /live/image/bootparams/* | tr '\n' ' ')" + [ -d ${LIVECD_PATH}/bootparams/ ] && CMDLINE="$CMDLINE $(cat ${LIVECD_PATH}/bootparams/* | tr '\n' ' ')" modprobe 9p 2>/dev/null || true if grep -q 9p /proc/filesystems ; then - local TAG="grml-parameters" + TAG="grml-parameters" if grep -q "$TAG" /sys/bus/virtio/devices/*/mount_tag 2>/dev/null ; then - local MOUNTDIR="$(mktemp -d)" + MOUNTDIR="$(mktemp -d)" mount -t 9p -o trans=virtio,ro "$TAG" "$MOUNTDIR" CMDLINE="$CMDLINE $(cat "$MOUNTDIR"/* 2>/dev/null | tr '\n' ' ')" umount "$MOUNTDIR" @@ -500,10 +501,10 @@ config_time(){ # {{{ print kernel info config_kernel(){ - if $VIRTUAL ; then - einfo "Running Linux Kernel $KERNEL $VMWARE" ; eend 0 - else + if $VIRTUAL && [ -n "$VIRTUAL_ENV" ] ; then einfo "Running Linux Kernel $KERNEL inside $VIRTUAL_ENV" ; eend 0 + else + einfo "Running Linux Kernel $KERNEL" ; eend 0 fi if [ -r /proc/cpuinfo ] ; then @@ -1126,7 +1127,7 @@ fi # {{{ display hostkeys of SSH server config_display_ssh_fingerprints() { - if ! find /etc/ssh/ -name ssh_host_\*_key >/dev/null 2>&1 ; then + if ! ls /etc/ssh/ssh_host_\*_key >/dev/null 2>&1 ; then return 0 # no SSH host keys present fi @@ -1570,7 +1571,7 @@ DCSMP="/mnt/grml" GRMLCFG="$(getbootparam 'autoconfig' 2>>$DEBUG)" [ -n "$GRMLCFG" ] || GRMLCFG="GRMLCFG" if checkbootparam 'noautoconfig' || checkbootparam 'forensic' ; then - DCSDIR="/live/image" # set default so it works for "scripts" boot option as expected + DCSDIR="${LIVECD_PATH}" # set default so it works for "scripts" boot option as expected ewarn "Skipping running automount of device(s) labeled $GRMLCFG as requested." ; eend 0 else if [ -z "$INSTALLED" ] ; then @@ -1584,9 +1585,9 @@ else eindent # We do need the following fix so floppy disk is available to blkid in any case :-/ if [ -r /dev/fd0 ] ; then - einfo "Floppy device detected. Trying to access floppy disk." + einfo "Floppy device detected. Trying to access floppy disk (this might take a few seconds)." if timeout 4 dd if=/dev/fd0 of=/dev/null bs=512 count=1 >>$DEBUG 2>&1 ; then - blkid /dev/fd0 >>$DEBUG 2>&1 + timeout 4 blkid /dev/fd0 >>$DEBUG 2>&1 fi fi DCSDEVICE=$(blkid -t LABEL=$GRMLCFG | head -1 | awk -F: '{print $1}') @@ -1609,7 +1610,7 @@ else # if not specified/present then assume default: if [ -z "$DCSDEVICE" ]; then - DCSDIR="/live/image" + DCSDIR="${LIVECD_PATH}" else eindent einfo "debs, config, scripts are read from $DCSDEVICE." ; eend 0 @@ -1632,7 +1633,7 @@ else fi fi -if [ -n "$DCSDIR" -a "$DCSDIR" != "/live/image" ] ; then +if [ -n "$DCSDIR" -a "$DCSDIR" != "${LIVECD_PATH}" ] ; then einfo "Debs, config, scripts (if present) will be read from $DCSDIR." ; eend 0 elif checkbootparam 'debs' || checkbootparam 'config' || checkbootparam 'scripts'; then einfo "Debs, config, scripts will be read from the live image directly." ; eend 0 @@ -2082,7 +2083,7 @@ config_tohd() if mount -o rw "$TARGET" "$MOUNTDIR" ; then einfo "Copyring live system to $TARGET - this might take a while" - rsync -a --progress /live/image/live $MOUNTDIR + rsync -a --progress ${LIVECD_PATH}/live $MOUNTDIR sync umount "$MOUNTDIR" eend $?