No capability to remove boot media with a savefile
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
No capability to remove boot media with a savefile
Post#16 by Rava » 31 Aug 2023, 03:34
That settles it, then. The solution already exists, you are just unable to find it.
Still you request me coding it anew. Quick audacious of you, instead of, you know, doing the obvious and finding and looking at the already existing solution.
Yours Rava
Rava
- Ed_P
- Contributor
- Posts: 8960
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
No capability to remove boot media with a savefile
Post#17 by Ed_P » 31 Aug 2023, 03:43
Ed_P
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
No capability to remove boot media with a savefile
Post#18 by Rava » 31 Aug 2023, 03:47
That might be, but you ignore the elephant in the room:
Please answer the obvious and no moving the goalpost.
Yours Rava
Rava
- Ed_P
- Contributor
- Posts: 8960
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
No capability to remove boot media with a savefile
Post#19 by Ed_P » 31 Aug 2023, 05:37
Ed_P
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
No capability to remove boot media with a savefile
Post#20 by Rava » 31 Aug 2023, 06:36
indeed, it is the section of
Code: Select all
# Save 'changes=EXIT:' session:
Code: Select all
if [ "$ans" = "" ]; then
DEST=`cat /tmp/changes-exit`; NAME=`basename $DEST`; MNAME=/memory/images/changes; FOLDERS=`grep '^/' /union/etc/changes-exit.conf | sed s/^.//g`
echo "saving changes to $NAME - do not power off the PC"
cd /memory/changes; rm -rf var/lock/subsys/* var/run/laptop-mode-tools/* `grep '^!' /union/etc/changes-exit.conf | sed s/^..//g | tr "\n" " "`

Added in 55 seconds:
Maybe how /tmp/changes-exit is set up is also of importance.
Yours Rava
Rava
Ed_P
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
No capability to remove boot media with a savefile
Post#22 by Rava » 02 Sep 2023, 07:25
Code: Select all
root@porteus:/# head -n 3 /mnt/live/init
#!/bin/sh
### linuxrc script by brokenman <http://www.porteus.org>
root@porteus:/#
Added in 1 minute 3 seconds:
At least there are no documented changes according to the initial code lines.
Yours Rava
Rava
- Ed_P
- Contributor
- Posts: 8960
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
No capability to remove boot media with a savefile
Post#23 by Ed_P » 07 Sep 2023, 21:42
It looks like this would be easier to impliment.
https://forum.porteus.org/viewtopic.php?p=86214#p86214 wrote:I like this idea Rapha_.
![]()
![]()
In my changes.sh script I changed myline to beCode: Select all
sudo -S find /mnt/live/memory/changes -iname "*" -mmin -$X
Code: Select all
sudo -S find /mnt/live/memory/changes -not -path "*/.cache/*" -iname "*" -mmin -$X
Ed_P
No capability to remove boot media with a savefile
Post#24 by KingJames » 17 Nov 2023, 17:59
I did create a custom script that rsync'd all changes in my home folder to the rootcopy directory on my drive, and it worked marvelously. However, I'd like to be able to save changes to the whole system, and I can't rsync the whole system. That would be prohibitively time consuming to copy to ram. Usually, I just save changes to a .xzm file if I change a system file, so it wasn't a problem. However, I'm trying to migrate to a fat32 thumb drive, and I need to sync file permissions too, which requires either a savefile or a module. I can create a savefile, but I don't know how to save to a .dat file manually. I also don't know how to save to a .xzm file without decompressing it, editing it, then recompressing it, which takes quite a while to do (I suspect ~30 seconds if I put it in a script. Too long on shutdown).
What I really want to do is edit some of the startup scripts to trick the built in changes system into thinking there was a drive mounted for changes on exit when there actually isn't. I can then edit the /etc/rc.d/rc.local_shutdown to remount to drive to the correct location so that the /mnt/live/cleanup file can save changes as it normally would.
If anyone has any wisdom to spare I'd really appreciate it!
KingJames
- Ed_P
- Contributor
- Posts: 8960
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
No capability to remove boot media with a savefile
Post#25 by Ed_P » 17 Nov 2023, 18:29
How long do you think this will take when the shutdown finds the USB drive hasn't been reinserted and you have to find it before the system shuts down? As for saving the changes to an .xzm file why decompress the old/current one and rebuild it? Rename the old one and create a new one. I rename mine to mychanges.xyzm and then build a new one when I update the module.
The problem that comes into play is manually remembering to use the USB drive and save changes when shutting down when you don't use the changes=EXIT cheatcode. Of course not all runs of Porteus create things that need to be saved.
Ed_P
No capability to remove boot media with a savefile
Post#26 by KingJames » 17 Nov 2023, 22:05

I would rather have a prompt on shutdown asking whether or not I wish to save changes for this boot. I could just open the porteus savefile manager and save changes to a file when i want, but it's rather inconvenient to have to do on every boot I change something. If there is absolutely no way to do what I want, then that's fine, don't waste too much time on it, I'll keep trying on my own until I get it.
Alternatively, is there a way I can invoke the porteus manager to save to a file directly from a terminal? If I could do that, I could just invoke it in /etc/rc.d/rc_local_shutdown and rename the old one, as you suggest, problem solved. It'll be kinda slow to create a new changes file every time, I'd rather sync it somehow, but I could live with it.
KingJames
No capability to remove boot media with a savefile
Post#27 by KingJames » 17 Nov 2023, 22:08
KingJames
No capability to remove boot media with a savefile
Post#28 by beny » 17 Nov 2023, 22:45
Code: Select all
#!/bin/bash
# Save changes into a module.
# Author: Brokenman <brokenman@porteus.org>
# Switch to root
if [ `whoami` != "root" ]; then
echo "Please enter your root password below"
su - -c "/opt/porteus-scripts/save-changes $1"
exit
fi
echo
ch=/mnt/live/memory/changes
usage(){
echo
echo "save-changes /path/to/resulting/module.xzm"
echo
echo "You must give a path to save your changes to."
}
if [ "$1" == "" -o "$1" == "-h" -o "$1" == "--help" ]; then
usage
exit
fi
# Make sure given path ends in .xzm
if [ `echo $1|awk -F. '{print$NF}'` != "xzm" ]; then
echo
echo "Your path must end in .xzm"
echo "Example: /tmp/changes.xzm"
echo
exit
fi
#dir2xzm $ch $1
mksquashfs $ch $1 -e dev tmp mnt
echo
echo "Your changes module has been created!"
echo "$1"
echo
exit
beny
- Ed_P
- Contributor
- Posts: 8960
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
No capability to remove boot media with a savefile
Post#29 by Ed_P » 17 Nov 2023, 22:57
Does the changes script you reference beny use the /etc/changes-exit.conf file when it is run?
Ed_P
No capability to remove boot media with a savefile
Post#30 by beny » 17 Nov 2023, 23:07
beny