From c919caade70432b18719ca1637c91db10e2744f9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 30 Sep 2007 16:04:49 +0200 Subject: [PATCH] grml2ram: adjust for usage with new live-initramfs layout --- debian/changelog | 6 ++++++ usr_sbin/grml2ram | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 965581b..b3dd887 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +grml-scripts (1.0.19) unstable; urgency=low + + * grml2ram: adjust for usage with new live-initramfs layout + + -- Michael Prokop Sun, 30 Sep 2007 16:04:31 +0200 + grml-scripts (1.0.18) unstable; urgency=low * qma: pipe output through 'col -b' to fix issues with UTF-8. diff --git a/usr_sbin/grml2ram b/usr_sbin/grml2ram index bbd4bd6..b0ba4e6 100755 --- a/usr_sbin/grml2ram +++ b/usr_sbin/grml2ram @@ -1,10 +1,10 @@ #!/bin/sh # Filename: grml2ram # Purpose: copy compressed GRML image to RAM -# Authors: grml-team (grml.org), (c) Michael Schierl , (c) Michael Prokop +# Authors: (c) Michael Schierl , (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Die Dez 12 19:55:05 CET 2006 [mika] +# Latest change: Son Sep 30 16:04:17 CEST 2007 [mika] ################################################################################ set -e @@ -20,12 +20,18 @@ if ! isgrmlcd ; then exit 1 fi -if ! [ -r /cdrom/GRML/GRML ] ; then - eerror "Can not access /cdrom/GRML/GRML. Looks like you did run grml2ram already?" ; eend 1 - exit 1 +IMAGE=$(ls /live/image/live/*.squashfs 2>/dev/null | head -1) +if ! [ -r "$IMAGE" ] ; then + if [ -r /cdrom/GRML/GRML ] ; then + IMAGE='/cdrom/GRML/GRML' + else + eerror "Can not access grml squashfs file." + eerror "Looks like you did run grml2ram already?" ; eend 1 + exit 1 + fi fi -GRMLSIZE=$(du /cdrom/GRML/GRML | awk '{print $1}') +GRMLSIZE="$(du $IMAGE | awk '{print $1}')" RAM=$(/usr/bin/gawk '/MemFree/{print $2}' /proc/meminfo) case "$*" in -f|--force) @@ -39,8 +45,8 @@ case "$*" in -f|--force) ;; esac -einfo "Copying /cdrom/GRML/GRML to RAM, this might take a while." -rsync -a --progress /cdrom/GRML/GRML /tmp/GRML +einfo "Copying $IMAGE to RAM, this might take a while." +rsync -a --progress $IMAGE /tmp/GRML LANGUAGE=C LANG=C LC_ALL=C perl << EOF open LOOP, '