rootcopy vss from_iso

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
Post Reply
lo-n-behold
White ninja
White ninja
Posts: 10
Joined: 14 Jan 2011, 11:13
Location: belgium

rootcopy vss from_iso

Post#1 by lo-n-behold » 16 Mar 2011, 12:36

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

User avatar
fanthom
Site Admin
Site Admin
Posts: 4546
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: rootcopy vss from_iso

Post#2 by fanthom » 16 Mar 2011, 17:49

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:
viewtopic.php?f=53&t=41
Please add [Solved] to your thread title if the solution was found.

Post Reply