From 58ccd74023808d32b15ebe87d741d79e0be405d0 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 12 Dec 2006 19:59:29 +0100 Subject: [PATCH] add script grml2ram and manpage for grml2ram --- manpages/grml2ram.8 | 21 ++++++++++++++++++++ usr_sbin/grml2ram | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 manpages/grml2ram.8 create mode 100755 usr_sbin/grml2ram diff --git a/manpages/grml2ram.8 b/manpages/grml2ram.8 new file mode 100644 index 0000000..34310d2 --- /dev/null +++ b/manpages/grml2ram.8 @@ -0,0 +1,21 @@ +.TH grml2ram 8 +.SH "NAME" +grml2ram \- copy compressed GRML image to RAM +.SH SYNOPSIS +.B grml2ram +.SH DESCRIPTION +grml2ram is a script which copies the compressed GRML image to RAM and +unmounts /cdrom then. This allows ejecting of the CD (run 'eject /dev/cdrom' for example) +afterwards. Therefore running the grml live-cd without the need for a present grml-ISO is possible. +Please notice that you need enough free RAM to run grml2ram. At least enough space for the compressed +GRML image itself (about 52MB for grml-small and 685MB for grml) and for running userspace software +afterwards (at least 128MB are recommended) should be available. +.SH OPTIONS +grml2ram supports only the following option: +.TP +.B -f, \-\-force +Force copy process for GRML image even though the check for enough free RAM fails. +.SH SEE ALSO +.B bootoption toram +.SH AUTHOR +This manual page was written by Michael Prokop for the grml project. diff --git a/usr_sbin/grml2ram b/usr_sbin/grml2ram new file mode 100755 index 0000000..bbd4bd6 --- /dev/null +++ b/usr_sbin/grml2ram @@ -0,0 +1,56 @@ +#!/bin/sh +# Filename: grml2ram +# Purpose: copy compressed GRML image to RAM +# Authors: grml-team (grml.org), (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] +################################################################################ + +set -e + +. /etc/grml/lsb-functions +. /etc/grml/script-functions + +check4root || exit 1 +check4progs rsync gawk || exit 2 + +if ! isgrmlcd ; then + eerror "Not running grml in live-cd mode. Nothing to be done, exiting." ; eend 1 + 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 +fi + +GRMLSIZE=$(du /cdrom/GRML/GRML | awk '{print $1}') +RAM=$(/usr/bin/gawk '/MemFree/{print $2}' /proc/meminfo) + +case "$*" in -f|--force) + ewarn "Forcing copy process for grml-image (${GRMLSIZE}kB) as requested via force option." ; eend 0 + ;; + *) + if test $RAM -lt $GRMLSIZE ; then + eerror "Sorry, not enough free RAM (${RAM}kB) available for grml-image (${GRMLSIZE}kB)." ; eend 1 + exit 1 + fi + ;; +esac + +einfo "Copying /cdrom/GRML/GRML to RAM, this might take a while." +rsync -a --progress /cdrom/GRML/GRML /tmp/GRML +LANGUAGE=C LANG=C LC_ALL=C perl << EOF +open LOOP, '