Page 1 of 1

rootcopy vss from_iso

Posted: 16 Mar 2011, 12:36
by lo-n-behold
when using the from_iso cheatcode, i.e. booting from a ISO file on usb,
it's impossible to put files inside the ISO for copying onto the root filesystem.

I would like to use the following layout on my removable media:

Code: Select all

\boot\grub\grub.cfg
\porteus\initrd.xz
\porteus\vmlinuz
\porteus\porteus-1.0-XXX.iso
\porteus\rootcopy\root\.bashrc
would it be possible to support this in the default linuxrc ?

I think this small patch implements this, in a compatible way with the existing code.

Code: Select all

--- linuxrc-orig	2011-03-16 11:24:30.000000000 +0100
+++ linuxrc	2011-03-16 11:25:40.000000000 +0100
@@ -309,8 +309,18 @@
     done
 fi
 
-echo $i"copying content of rootcopy directory"
-cp -af $PTH/rootcopy/* /union 2>/dev/null
+ROOT_PTH=$PTH/rootcopy
+if [ -n "$ISO" -a -n "$ISODEV" -a -n "$ISOPTH" ]; then
+    ISODIR=`echo $ISOPTH | sed 's:/[^/]*$::'`
+    if [ -d /opt/$ISODEV/$ISODIR/rootcopy ]; then
+	ROOT_PTH=/opt/$ISODEV/$ISODIR/rootcopy
+    fi
+fi
+if [ -d $ROOT_PTH ]; then
+    echo $i"copying content of rootcopy directory"
+    cp -af $ROOT_PTH/* /union 2>/dev/null
+fi
+
 mount -n -o rbind /mnt/$DATA/boot /union/boot 2>/dev/null
 
 debug

Re: rootcopy vss from_iso

Posted: 16 Mar 2011, 17:49
by fanthom
thanks for sharing your code (i see that you have read linuxrc carefully - well done!), but i find it too static as /rootcopy must be placed in same folder as the porteus.iso

what about more flexible solution: 'rootcopy=' cheatcode?
it could be placed on another device, folder, etc like:
with full path: 'rootcopy=/dev/sda3/porteus/rootcopy'
with relative path: 'rootcopy=/porteus/rootcopy'
or even
with completely different name: 'rootcopy=/mylinux_stuff/porteus-v.1.0-rootcopy'

if no 'rootcopy' cheatcode is specified then standard $PTH/rootcopy/ would be used.
i dont think many people will use it but implementing it shouldn't be too hard for me :)

BTW: linuxrc development should be discussed in this thread:
http://forum.porteus.org/viewtopic.php?f=53&t=41