Removing module and related data
Removing module and related data
Hi,
Is there a way to know which folders/files depend on a module/application so I can remove them at the same time as the module? ie, remove firefox module and then its related .mozilla folder to keep the system clean.
Is there a way to know which folders/files depend on a module/application so I can remove them at the same time as the module? ie, remove firefox module and then its related .mozilla folder to keep the system clean.
Re: Removing module and related data
It's totally unpredictable which files/folders a given application will touch/create, so I don't think it's possible to do what you're asking for.
However, you can do something radical, like not using savesession, and instead saving (via shutdown script) just what you want. In my case I only keep Opera, Pidgin, Audacious and Transmission histories. So excluding these things the next boot is totally fresh -- and that's one of main reasons I love Porteus
However, you can do something radical, like not using savesession, and instead saving (via shutdown script) just what you want. In my case I only keep Opera, Pidgin, Audacious and Transmission histories. So excluding these things the next boot is totally fresh -- and that's one of main reasons I love Porteus

- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: Removing module and related data
I agree with fulalas, there is no automatic way of knowing what files/folders a program will touch. A couple of options do exist for testing modules/apps and not having them impact your system. I use a porteussave.dat file and I use the changes=EXIT cheatcode. If I test a module and don't like it I deactivate the module then reboot using the option to not save my changes. I also backup my save.dat file periodically so if I forget to not save the changes from a test I can restore the save.dat file from a backup.
Similar to fulalas I also make a module of changes that are important to me, which I use when I boot to my safe mode where I don't use the save.dat file. To know which files and folders to save I use a small script I created. It shows all files and folders changed within the past few minutes.
There is also a changes-time command built into Porteus.
Similar to fulalas I also make a module of changes that are important to me, which I use when I boot to my safe mode where I don't use the save.dat file. To know which files and folders to save I use a small script I created. It shows all files and folders changed within the past few minutes.
Code: Select all
#!/bin/sh
# https://forum.porteus.org/viewtopic.php?f=81&t=3776#p27204
if [ `whoami` != "root" ]; then
echo guest | sudo -S sh $0 $1
exit
fi
X=1
if [ ! "$1" == "" ]; then
X=$1
fi
echo " mmin = "$X
echo toor | sudo -S find /mnt/live/memory/changes -iname "*" -mmin -$X
read
exit
Re: Removing module and related data
Hi,
@Ed_P, your script and the changes-time one are gold for me.
thanks both for the answers. Now I think I can make a "diff" before activating a module and use it to undo changes if I don't like it.
Thanks.
@Ed_P, your script and the changes-time one are gold for me.
thanks both for the answers. Now I think I can make a "diff" before activating a module and use it to undo changes if I don't like it.
Thanks.
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Removing module and related data

Another approach you can try;
1. Boot to AF (Always Fresh) mode.
2. Activate the modules you normally use.
3. Tweak your system: time zone, network connection, browser bookmarks, etc. May take a few minutes.

4. Make a module of your changes.
This is similar to fulalas's shutdown script concept.
I boot from ISO files and my Porteus Modules , Optional, changes folders are on a NTFS drive. This is what I use to make a module of my changes. You will have to change it to fit your system but the files/folders I back up should appeal to you.
mkmodchanges.sh
Code: Select all
#!/bin/bash
# Save changes as a mod file
# https://forum.porteus.org/viewtopic.php?f=81&t=5981&start=15#p46643
MOD=mychanges # mychanges-$(date +%Y%m%d)
TO=Modsavedat
# http://forum.porteus.org/viewtopic.php?f=53&t=3801&start=30#p28472
BOOT=`grep -A1 "Porteus data found in:" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
SYSTM=
DRV=${BOOT:5:4}
if [ "${BOOT:0:12}" == "/mnt/isoloop" ]; then
ISOBOOT=`grep -A1 "//porteus" /var/log/porteus-livedbg`
SYSTM="${ISOBOOT:11:10}/"
DRV=${ISOBOOT:5:4}
fi
CHANGES=/mnt/$DRV/$SYSTM$TO/$MOD
# Color definitions # ups.sh
txtbld=$(tput bold) # Bold
txtred=${txtbld}$(tput setaf 1) # Bold Red
txtgreen=${txtbld}$(tput setaf 2) # Bold Green
txtcyan=${txtbld}$(tput setaf 6) # Bold Cyan
rst=$(tput sgr0) # Reset
function redpswd() {
echo -E "$1" $txtred
}
function cyan() {
echo -E "$1" $txtcyan
}
if [ `whoami` != "root" ]; then
cyan "Enter root's password"
# echo -e "Enter root's password"
su -c "sh $0 $1"
exit
fi
echo $rst
# Changes
# Start mkmodchanges with a numeric argument (for mmin minutes)
if [ "$1" != "" ] && [ "$1" != "r" ] ; then
echo 'find /mnt/live/memory/changes -iname "*" -mmin -'$1
find /mnt/live/memory/changes -iname "*" -mmin -$1
echo
exit
fi
# Restore
if [ "$1" == "r" ]; then
echo
echo "Restoring backup files from $CHANGES.xzm."
mloop $CHANGES.xzm
echo "--------------------------------------------------------"
echo "Press Enter to restore ALL backed up files."
echo "Press Ctrl+C to restore select files/folders. "
echo " To restore select files/folders use: "
echo " cp -a -v /mnt/loop/xxxxx/* / "
echo " When done enter: uloop."
read
cp -a -v /mnt/loop/* /
# http://forum.porteus.org/viewtopic.php?f=140&t=6646&p=52904#p52904
uloop
exit
fi
if [ -d /tmp/mod/ ]; then
rm -rf /tmp/mod
fi
mkdir -p /tmp/mod
if [ ! -d /home/guest/.java/deployment/security/ ]; then
mkdir -p /home/guest/.java/deployment/security/
cp /home/guest/Backups/Java/*.sites /home/guest/.java/deployment/security/
fi
# copy modified files
cp -a --parents /home/guest/.config/dconf/* /tmp/mod/
cp -a --parents /etc/resolv.conf /tmp/mod/
# -- File Manager - nemo - bookmarks --
cp -a --parents /root/.config/nemo* /tmp/mod/
cp -a --parents /root/.config/gtk-3.0/* /tmp/mod/
cp -a --parents /home/guest/.config/nemo/* /tmp/mod/
cp -a --parents /home/guest/.config/gtk-3.0/* /tmp/mod/
# -- My Home files --
cp -a --parents /home/guest/* /tmp/mod/
cp -a --parents /home/guest/.config/gnome-games/* /tmp/mod/
# -- Browser files - Firefox --
FFPATH=`grep "Path=" /home/guest/.mozilla/firefox/profiles.ini`; FFPATH=${FFPATH:5}
cp -a --parents /home/guest/.mozilla/plugins /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/profiles.ini /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/content-prefs.sqlite /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/cookies.sqlite /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/formhistory.sqlite /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/key3.db /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/logins.json /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/permissions.sqlite /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/places.sqlite /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/prefs.js /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/search.json.mozlz4 /tmp/mod/
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/xulstore.json /tmp/mod/
if [ -f /home/guest/.mozilla/firefox/$FFPATH/extensions/* ]; then
cp -a --parents /home/guest/.mozilla/firefox/$FFPATH/extensions/* /tmp/mod/
fi
cp -a --parents /home/guest/.java/deployment/security/exception.sites /tmp/mod/
cp -a --parents /usr/share/mime/packages/freedesktop.org.xml /tmp/mod/
# http://askubuntu.com/questions/478169/why-cant-firefox-run-local-swf-files
# -- Cinnamom tweaks --
cp -a --parents /home/guest/.cinnamon/configs/[email protected]/* /tmp/mod/
cp -a --parents /home/guest/.cinnamon/configs/[email protected]/* /tmp/mod/
cp -a --parents /home/guest/.local/share/cinnamon/applets/ /tmp/mod/
cp -a --parents /home/guest/.cinnamon/configs/weather@mockturtl/* /tmp/mod/
# -- Network files --
# touch /var/lib/dhcpcd/dhcpd.leases
cp -a --parents /etc/NetworkManager/system-connections/* /tmp/mod/
cp -a --parents /var/run/NetworkManager/* /tmp/mod/
cp -a --parents /var/lib/dhcpcd/* /tmp/mod/
cp -a --parents /etc/hosts /tmp/mod/
# -- My machine tweaks --
cp -a --parents /etc/localtime /tmp/mod/
cp -a --parents /etc/rc.d/rc.local* /tmp/mod/
cp -a --parents /etc/xdg/autostart/Touchpad* /tmp/mod/
cp -a --parents /etc/changes-exit.conf /tmp/mod/
# -- My menu tweaks --
cp -a --parents /usr/share/applications/cups* /tmp/mod/
cp -a --parents /usr/share/applications/*print* /tmp/mod/
cp -a --parents /usr/share/applications/*TightVNC* /tmp/mod/
cp -a --parents /usr/share/applications/*keepassx* /tmp/mod/
cp -a --parents /usr/share/applications/*firefox* /tmp/mod/
if [ -f /usr/share/applications/sun_java* ]; then
cp -a --parents /usr/share/applications/sun_java* /tmp/mod/
fi
# -- My printer files --
cp -a --parents /home/guest/.hplip/hplip.conf /tmp/mod/
cp -a --parents /var/cache/cups/* /tmp/mod/
cp -a --parents /etc/cups/ppd/* /tmp/mod/
cp -a --parents /etc/cups/printers.conf /tmp/mod/
# -- USM files --
cp -a --parents /etc/usm/* /tmp/mod/
cp -a --parents /var/usm/ /tmp/mod/
du -h /tmp/mod/
echo
echo Changed files copied. Press Enter to create module, Ctrl+C to exit.
read
echo
dir2xzm /tmp/mod /tmp/$MOD.xzm && rm -rf /tmp/mod
echo
ls -sh /tmp/*.xzm
#read
DIR () {
ls -lght --time-style long-iso $1 | awk '{print $5,$6,$4,$7}'
}
echo
echo Press Enter to copy /tmp/$MOD.xzm to $TO, Ctrl+C to exit.
DIR /tmp/$MOD.xzm
DIR $CHANGES*.xzm
read
mv $CHANGES*.xzm $CHANGES.xyzm
cp /tmp/$MOD.xzm /mnt/$DRV/$SYSTM$TO
rm /tmp/$MOD.xzm
echo Finished!
read
Removing module and related data
Did it weeks ago on the live pendrive and will do for my frugal install too.You're welcome.
Another approach you can try;
1. Boot to AF (Always Fresh) mode.
2. Activate the modules you normally use.
3. Tweak your system: time zone, network connection, browser bookmarks, etc. May take a few minutes.![]()
4. Make a module of your changes.
Woooww!! Yesterday night I wrote a first simple script and this one will be of great help to enhance it. Really apreciated.I boot from ISO files and my Porteus Modules , Optional, changes folders are on a NTFS drive. This is what I use to make a module of my changes. You will have to change it to fit your system but the files/folders I back up should appeal to you.
mkmodchanges.shCode: Select all
#!/bin/bash ...
Right now I run Porteus as my main hd OS and expecting to see 5.0, 6.0 and so on. These are my installs:Basically I run Porteus in 4 modes: AF, AF+, AF ', normal. The 1st should be obvious, the 2nd is the 1st plus all my modules, the 3rd is the 2nd plus my changes module, the 4th is the 2nd plus my Porteussave.dat file.
1) Porteus LXDE 32 live on pendrive + VirtualBox to make tests and newbie things.
2) Porteus LXDE 64 frugal install on SSD, Firefox, Thunderbird and VirtualBoxes of Porteus Mate, Cinnamon, xfce and kde for me to learn a bit of all and a running samba too so anybody at home can sync pictures/videos/data to an external 1TB drive with the smbsync2 android app with just a tap.
Both working flawlessly till now and I am very happy with the software and the help from the guys on the forum.
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Removing module and related data
I test other DEs (desktops) in my live system by adding the desired 003 module to my Modules folder and the cheatcode noload=cinnamon to my startup parms.
I need to learn how to use VirtualBox so may bug you later.
I need to learn how to use VirtualBox so may bug you later.
Removing module and related data
Hi,
I know about the 003 modules but found a post day ago where someone stated it could be sort of dangerous, that is why I got the VBox lane.
VBox is a toy now in terms of setting up the machines, you can setup one machine (better two, one for 32 and other for 64 bit) and use it to test as many distros as you need just attaching the iso and running it. It is a pleasure to run them without worries about partitions, etc. Today I ran PorteusMate64.iso as live and ended up doing a frugal install to a virtual 10gb hard disk, removed the iso from the machine and now it boots from the virtual disk as a host OS. Copied it to an external hd so I can use it later.
It will be a pleasure to help you whenever you need it.
BTW, maybe I should add to my ToDos a reminder to write a howto setup a virtual box to test all the Porteus flavours.
I know about the 003 modules but found a post day ago where someone stated it could be sort of dangerous, that is why I got the VBox lane.
VBox is a toy now in terms of setting up the machines, you can setup one machine (better two, one for 32 and other for 64 bit) and use it to test as many distros as you need just attaching the iso and running it. It is a pleasure to run them without worries about partitions, etc. Today I ran PorteusMate64.iso as live and ended up doing a frugal install to a virtual 10gb hard disk, removed the iso from the machine and now it boots from the virtual disk as a host OS. Copied it to an external hd so I can use it later.
It will be a pleasure to help you whenever you need it.
BTW, maybe I should add to my ToDos a reminder to write a howto setup a virtual box to test all the Porteus flavours.
Removing module and related data
Hi,
just did a module with all my changes. Is there a way to exclude folders like '/home/guest/VMs'? I already have a backup of my VBox machines and they make the module sooo big, so no need to include them there.
just did a module with all my changes. Is there a way to exclude folders like '/home/guest/VMs'? I already have a backup of my VBox machines and they make the module sooo big, so no need to include them there.
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Removing module and related data
With an installed system that may be true.
BTW, maybe I should add to my ToDos a reminder to write a howto setup a virtual box to test all the Porteus flavours.

I would think before doing the dir2xzm command a rm /tmp/mod/home/guest/VM* command would work. If you mloop the module you made with them you can delete them with rm /mnt/loop/home/guest/VM*.Is there a way to exclude folders like '/home/guest/VMs'?
Re: Removing module and related data
Today I wrote a little scheme for the howto. I will do it on next holidays.
Tested the mloop approach but it fails with a "read only system" error and it doesn't serve my purpose since this way I have to wait until all the VMs are stored just to remove them.I would think before doing the dir2xzm command a rm /tmp/mod/home/guest/VM* command would work. If you mloop the module you made with them you can delete them with rm /mnt/loop/home/guest/VM*.
I have a doubt about the "rm /tmp/mod/home/guest/VM" before the dir2xzm, is "/tmp/<mod>" a placeholder for the real module name or it is always the real path on every run?
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: Removing module and related data
It was meant as a one-time fix for the file you've already created.
It is always that name.I have a doubt about the "rm /tmp/mod/home/guest/VM" before the dir2xzm, is "/tmp/<mod>" a placeholder for the real module name or it is always the real path on every run?
To exclude your VM folders it's probably easiest to change the cp -a command for /home/guest/* to cp -d and then add cp -a commands for all the /home/guest/ subfolders you want to backup.
Code: Select all
cp -d --parents --preserve=all /home/guest/*
cp -a --parents /home/guest/Desktop/*
cp -a --parents /home/guest/Documents/*
etc
Re: Removing module and related data
To be sure:
Code: Select all
rm -d /tmp/mod/home/guest/VMs
I will try the 'rm' approach first as it seems easy to maintain.To exclude your VM folders it's probably easiest to change the cp -a command for /home/guest/* to cp -d and then add cp -a commands for all the /home/guest/ subfolders you want to backup.
Code: Select all
cp -d --parents --preserve=all /home/guest/* cp -a --parents /home/guest/Desktop/* cp -a --parents /home/guest/Documents/* etc
Maybe I did something wrong and I didn't want to investigate more on the issue.Somewhat surprised to find the mloop file was read only. I use that approach to delete .wh. files from my porteussave.dat file.
- Ed_P
- Contributor
- Posts: 8908
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Re: Removing module and related data
Note these lines in my module.Olaf wrote: ↑10 Dec 2018, 11:59To be sure:Will always remove the correct directory regarding of the settings module name? So saving it as "settings.zxm", "test.xzm" it will work.Code: Select all
rm -d /tmp/mod/home/guest/VMs
Code: Select all
MOD=mychanges # mychanges-$(date +%Y%m%d) <<<< in your case MOD=settings or MOD=test
TO=Modsavedat
if [ -d /tmp/mod/ ]; then <<<< The /tmp/mod folder's name.
rm -rf /tmp/mod
fi
mkdir -p /tmp/mod
dir2xzm /tmp/mod /tmp/$MOD.xzm && rm -rf /tmp/mod <<<< Still named /tmp/mod and made into /tmp/$MOD.xzm
True but a few seconds slower when creating the module. And the command would be:I will try the 'rm' approach first as it seems easy to maintain.
rm -rf /tmp/mod/home/guest/VM*
if all the VM folders started with VM.
No, I just tried it also and got the same results.Maybe I did something wrong and I didn't want to investigate more on the issue.Somewhat surprised to find the mloop file was read only. I use that approach to delete .wh. files from my porteussave.dat file.

Re: Removing module and related data
Ed_P,
many thanks for all the help with this topic. Step by step, my system is getting fine tuned to the most degree.
many thanks for all the help with this topic. Step by step, my system is getting fine tuned to the most degree.