* grml2ram: adjust for usage with new live-initramfs layout.
Apply patch by Moritz Augsburger for identifying /dev/cdrom.
+ * Adjust prepare_ramdisk.sh and prepare_tmpfs.sh for live-initramfs.
+ [Closes: issue277]
-- Michael Prokop <mika@grml.org> Sun, 30 Sep 2007 16:04:31 +0200
#!/bin/zsh
# Filename: prepare_ramdisk.sh
-# Purpose: setup a ramdisk
+# Purpose: set up a ramdisk of a selected directory
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Sam Mai 27 15:12:55 CEST 2006 [mika]
+# Latest change: Sam Okt 06 13:23:35 CEST 2007 [mika]
################################################################################
if [ $UID != 0 ]; then
exit 1
fi
-[ -d /UNIONFS ] && UNIONFS="/UNIONFS" # running from live-CD?
-
DIRECTORY="$1"
FILENAME=$(echo $DIRECTORY | sed 's#/#_#g')
CACHE_FILE="/ramdisk_cache/$FILENAME"
fi
if ! mount | grep -q "${DIRECTORY}.*loop" ; then
- if [ -d $DIRECTORY ] ; then
+ if [ -d "$DIRECTORY" ] ; then
if ! mount | grep -q "loop.*${DIRECTORY}" ; then
mv $DIRECTORY/ $DIRECTORY.tmpfile && \
mkdir $DIRECTORY
cp -a $DIRECTORY/.* $DIRECTORY.tmpfile/ &>/dev/null
if umount $DIRECTORY ; then
rmdir $DIRECTORY
-# LOOPDEVICE=$(losetup -a | grep $CACHE_FILE | awk -F: '{print $1}')
-# losetup -d $LOOPDEVICE && echo "done" || echo "failed"
mv $DIRECTORY.tmpfile/ $DIRECTORY
+ echo done
else
- echo "Error when unmounting $DIRECTORY."
+ echo "error [while unmounting ${DIRECTORY}]"
fi
else
echo "Error: $DIRECTORY not mounted."
#!/bin/zsh
# Filename: prepare_tmpfs.sh
-# Purpose: setup a tmpfs
+# Purpose: set up a tmpfs of a selected directory
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Sam Mai 27 15:13:03 CEST 2006 [mika]
+# Latest change: Sam Okt 06 13:23:59 CEST 2007 [mika]
################################################################################
if [ $UID != 0 ]; then
exit 1
fi
-[ -d /UNIONFS ] && UNIONFS="/UNIONFS" # running from live-CD?
-
DIRECTORY="$1"
prepare_start () {
- if ! mount | grep -q "tmpfs on ${UNIONFS}${DIRECTORY}" ; then
+ if ! mount | grep -q "tmpfs on ${DIRECTORY}" ; then
if [ -d $DIRECTORY ] ; then
if ! [ -d $DIRECTORY.tmpfile ] ; then
echo -n "Setting up tmpfs ${DIRECTORY}: "
prepare_stop () {
if mount | grep -q $DIRECTORY ; then
echo -n "Unmounting tmpfs ${DIRECTORY}: "
- umount ${UNIONFS}${DIRECTORY} && \
+ umount ${DIRECTORY} && \
rmdir $DIRECTORY && \
mv $DIRECTORY.tmpfile $DIRECTORY && echo done || echo failed
else