[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Here is a place for your projects which are not officially supported by the Porteus Team. For example: your own kernel patched with extra features; desktops not included in the standard ISO like Gnome; base modules that are different than the standard ISO, etc...
User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3925
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#16 by ncmprhnsbl » 29 Oct 2021, 21:24

Ed_P wrote:
29 Oct 2021, 15:02
thought that was what this whole thread is about.
it should be noted that there is no rootcopy cheatcode. it's automatically picked up if there's files in the rootcopy folder (structured in a proper fakeroot to do anything meaningful)
norootcopy is just another part of the suite of "alway fresh" cheatcodes that only has an effect if there's files in the rootcopy folder, otherwise it does nothing (in essense: no files in rootcopy = norootcopy)
and for completeness: rootcopy=/path/to/rootcopy is only to define a non standard location for it.
Ed_P wrote:
29 Oct 2021, 15:02
Will future ISO's be built with fulalas's initrd.xz in them? Should Porteus testers boot their ISOs with it?
probly not this one exactly.
if testers boot their ISOs with it, they should be very careful about what they put in rootcopy ... preferably nothing ;) (that goes for whatever filesystem you use)
Kulle wrote:
29 Oct 2021, 18:54
does this also apply to Porteus 4.0?
there is a sure way to find out: try it ;) backup the original and if there's a problem, it's easy enough to swap back..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#17 by Ed_P » 30 Oct 2021, 03:19

ncmprhnsbl wrote:
29 Oct 2021, 21:24
and for completeness: rootcopy=/path/to/rootcopy is only to define a non standard location for it.
Ok, so rootcopy= is similar to the extramod= cheatcode. Thank you ncmp. :)
Ed

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#18 by fulalas » 30 Oct 2021, 09:51

I believe this might work on Porteus 4, yes. You don't need to do anything with the file, just place it in /boot/syslinux and reboot.

User avatar
M. Eerie
Moderator
Moderator
Posts: 620
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#19 by M. Eerie » 01 Nov 2021, 09:20

Works great.

Image

Thanks for that!

:)
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 620
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#20 by M. Eerie » 01 Nov 2021, 18:01

Doing some testing, I've took fulalas code and added the option to uncompress tar.gz/tgz/tar.xz/txz files only in $PORTDIR/rootcopy level dir.

Code: Select all

if param norootcopy; then
    ROOTCOPY=none
    echo $i"skipping /rootcopy directory"
else
	FILESYSTEM=$(cat /etc/fstab | grep -o /mnt/$DEV.* | cut -f2- -d' ' | cut -f1 -d' ')
	if [ $FILESYSTEM = "ntfs" ] || [ $FILESYSTEM = "vfat" ]; then
		ISPOSIX=0
		COPYPARAMS="-rf"
	else
		ISPOSIX=1
		COPYPARAMS="-af"
	fi
	if [ $ROOTCOPY ]; then
		locate -d $ROOTCOPY
		if [ $? -eq 0 ]; then echo $i"copying content of $ROOTCOPY directory"; cp $COPYPARAMS /mnt/$DEV/$LPTH/. /union/. 2>/dev/null; 

### ADDED Decompress files _only_ in parent rootcopy dir
		find /mnt/$DEV/$LPTH -maxdepth 1 \( -name "*.tgz" -o -name "*.tar.gz" -o -name "*.txz" -o -name "*.tar.xz" \) 2>/dev/null -exec tar -xvf {} -C /union \; 
###

		else fail $ROOTCOPY; ROOTCOPY=none; fi
	else
		ROOTCOPY=none
		echo $i"copying content of $PTH/rootcopy directory"
		cp $COPYPARAMS $PTH/rootcopy/. /union/. 2>/dev/null
	fi
	if [ $ISPOSIX -eq 0 ]; then chown -R guest /union/home/guest 2>/dev/null; fi
fi

EDIT: That didn't work for me.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#21 by fulalas » 01 Nov 2021, 22:46

M. Eerie wrote:
01 Nov 2021, 09:20
Works great.
Beautiful, isn't it? :)

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#22 by Rava » 02 Nov 2021, 14:26

Ed_P wrote:
29 Oct 2021, 04:23
Rootcopy is for files on .ext4 file systems.
or ext2 or ext3 or reiserfs or… you get my drift.
Cheers!
Yours Rava

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#23 by fulalas » 02 Nov 2021, 22:20

...or FAT or NTFS :)

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#24 by fulalas » 02 Nov 2021, 22:42

Linus (from the YouTube channel Linus Tech Tips) is migrating to Linux, after using Windows since forever. And among many things he has been saying about his new experience, he said something that I completely agree: Linux users/devs want to tell you what you should and shouldn't do, to the point they want to curb the very freedom that makes Linux wonderful.

How many times we saw someone asking for help on Linux just to see an experienced user/dev replying 'you should NOT do that'? This is very annoying. I think big corporations have been imposing so many rules, so most people choose Linux exactly to avoid this kind of bullshit, just to face another type of 'I know what's best for you, stupid user'. :no:

We should let people do what they want with their machines. Freedom of choice, open access to information. :good:

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#25 by babam » 03 Nov 2021, 07:34

M. Eerie wrote:
01 Nov 2021, 18:01
Doing some testing, I've took fulalas code and added the option to uncompress tar.gz/tgz/tar.xz/txz files only in $PORTDIR/rootcopy level dir.

Code: Select all

if param norootcopy; then
    ROOTCOPY=none
    echo $i"skipping /rootcopy directory"
else
	FILESYSTEM=$(cat /etc/fstab | grep -o /mnt/$DEV.* | cut -f2- -d' ' | cut -f1 -d' ')
	if [ $FILESYSTEM = "ntfs" ] || [ $FILESYSTEM = "vfat" ]; then
		ISPOSIX=0
		COPYPARAMS="-rf"
	else
		ISPOSIX=1
		COPYPARAMS="-af"
	fi
	if [ $ROOTCOPY ]; then
		locate -d $ROOTCOPY
		if [ $? -eq 0 ]; then echo $i"copying content of $ROOTCOPY directory"; cp $COPYPARAMS /mnt/$DEV/$LPTH/. /union/. 2>/dev/null; 

### ADDED Decompress files _only_ in parent rootcopy dir
		find /mnt/$DEV/$LPTH -maxdepth 1 \( -name "*.tgz" -o -name "*.tar.gz" -o -name "*.txz" -o -name "*.tar.xz" \) 2>/dev/null -exec tar -xvf {} -C /union \; 
###

		else fail $ROOTCOPY; ROOTCOPY=none; fi
	else
		ROOTCOPY=none
		echo $i"copying content of $PTH/rootcopy directory"
		cp $COPYPARAMS $PTH/rootcopy/. /union/. 2>/dev/null
	fi
	if [ $ISPOSIX -eq 0 ]; then chown -R guest /union/home/guest 2>/dev/null; fi
fi

EDIT: That didn't work for me.
Inside initrd there is no gzip and xz so just use tar.

Code: Select all

pushd /union
find /mnt/$DEV/$LPTH -maxdepth 1 -name "*.tar" -exec tar -xf {} \;
popd
Note: Untested
Sorry, my English is bad.

User avatar
M. Eerie
Moderator
Moderator
Posts: 620
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

[TUTORIAL] Allowing safe rootocopy on FAT/NTFS

Post#26 by M. Eerie » 03 Nov 2021, 10:20

babam wrote:
03 Nov 2021, 07:34
Inside initrd there is no gzip and xz so just use tar.
Thanks, babam I didn't realize that.

:)
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

Post Reply