X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_sbin%2Fgrml2ram;h=c22dee954211865601498db517cb81d308cce454;hb=d3e95c8abcf0d3246212b3496af1e6927698b68c;hp=05b0ceae688da8d47b2499d2b2a991822da1424b;hpb=f168d83bb08bc760577da91a2c3e0f3e5409472c;p=grml-scripts.git diff --git a/usr_sbin/grml2ram b/usr_sbin/grml2ram index 05b0cea..c22dee9 100755 --- a/usr_sbin/grml2ram +++ b/usr_sbin/grml2ram @@ -19,12 +19,18 @@ if ! isgrmlcd ; then exit 1 fi +# old linuxrc version: +[ -d /cdrom ] && export LIVECD_PATH=/cdrom +# 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 + 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' ' ')" fi getbootparam(){ @@ -46,7 +52,7 @@ getbootparam(){ MEDIA_PATH="$(getbootparam live-media-path)" MEDIA_PATH="${MEDIA_PATH:-.}" -IMAGE=$(find /live/image/${MEDIA_PATH}/ -name *.squashfs 2>/dev/null | head -1) +IMAGE=$(find $LIVECD_PATH/${MEDIA_PATH}/ -name *.squashfs 2>/dev/null | head -1) if ! [ -r "$IMAGE" ] ; then if [ -r /cdrom/GRML/GRML ] ; then IMAGE='/cdrom/GRML/GRML' @@ -82,14 +88,17 @@ close DEST; EOF # identify cd-rom: -GRMLDEV=$(awk '{if ($2 ~ /^\/live\/image$/ ) print $1}' /etc/mtab) +GRMLDEV=$(awk '{if ($2 ~ /^\/lib\/live\/mount\/medium$/ ) print $1}' /etc/mtab) +if [ -z "$GRMLDEV" ]; then + GRMLDEV=$(awk '{if ($2 ~ /^\/live\/image$/ ) print $1}' /etc/mtab) +fi if [ -z "$GRMLDEV" ]; then GRMLDEV=$(awk '{if ($2 ~ /^\/cdrom$/ ) print $1}' /etc/mtab) fi [ -n "$GRMLDEV" ] || GRMLDEV='/dev/cdrom' einfo "Unmounting cdrom" -[ -d /live/image ] && umount /live/image || umount /cdrom +[ -d $LIVECD_PATH ] && umount $LIVECD_PATH || umount /cdrom eend $? einfo "Now you can eject your grml-cd (e.g. run 'eject $GRMLDEV')." ; eend 0