I used $HOME for saving and removing files in frugal install.
Slitaz 5.0 RC3
First to do:
#Create a parent folder
mkdir $HOME/slitazsave
#Create a list of original programs
tazpkg list > $HOME/slitazsave/list.org
#Tell the bootloader, where $HOME is saved
kernel.... rw root=/dev/null nomodeset home=cb58a50f-6401-4f41-8cf3-409ec78a9f38
#The first script saves the installed programs in $HOME. After booting they
#will be loaded with "echo root | su -c "cp -r $HOME/slitazsave/packages/* /".
#This can be done automatically with a file $HOME/.config/autostart/load.desktop.
#!/bin/sh
rm $HOME/slitazsave/files.list
rm $HOME/slitazsave/*.fi
tazpkg list > /tmp/list.new
diff $HOME/slitazsave/list.org /tmp/list.new | grep ^+[a-z] | cut -c 2- > /tmp/diff+
diff $HOME/slitazsave/list.org /tmp/list.new | grep ^-[a-z] | cut -c 2- > /tmp/diff-
diff /tmp/diff+ /tmp/diff- | grep ^-[a-z] | cut -c 2- | cut -d " " -f1 > /tmp/list.pak.new
a=$(wc -l /tmp/list.pak.new | cut -d " " -f1)
cat /tmp/list.pak.new >> $HOME/slitazsave/list.pak
sort -u $HOME/slitazsave/list.pak > $HOME/slitazsave/list.new
rm -r $HOME/slitazsave/list.pak
mv $HOME/slitazsave/list.new $HOME/slitazsave/list.pak
c=$(wc -l $HOME/slitazsave/list.pak | cut -d " " -f1)
for i in $(seq 1 $c);do cp -r /var/lib/tazpkg/installed/$(head -n$i /$HOME/slitazsave/list.pak | tail -1)/files.list $HOME/slitazsave/$(head -n$i /$HOME/slitazsave/list.pak | tail -1).fi;done
for i in $(seq 1 $c);do cat $HOME/slitazsave/$(head -n$i $HOME/slitazsave/list.pak | tail -1).fi >> $HOME/slitazsave/files.list;done
b=$(wc -l $HOME/slitazsave/files.list | cut -d " " -f1)
mkdir /tmp/folder
mkdir -p /tmp/folder/var/lib/tazpkg/installed
for i in $(seq 1 $c);do cp -r /var/lib/tazpkg/installed/$(head -n$i $HOME/slitazsave/list.pak | tail -1) /tmp/folder/var/lib/tazpkg/installed;done
for i in $(seq 1 $b);do mkdir -p /tmp/folder/$(head -n$i $HOME/slitazsave/files.list | tail -1);done
for i in $(seq 1 $b);do rm -r /tmp/folder/$(head -n$i $HOME/slitazsave/files.list | tail -1);done
for i in $(seq 1 $b);do cp -r $(head -n$i $HOME/slitazsave/files.list | tail -1) /tmp/folder/$(head -n$i $HOME/slitazsave/files.list | tail -1);done
echo root | su -c "rm -r $HOME/slitazsave/packages"
echo root | su -c "cp -r /tmp/folder $HOME/slitazsave/packages"
rm -r /tmp/*
#The second script removes programs with a little GUI as well as dependencies, if they
#are not necessary for other programs.
#!/bin/sh
a=$(yad --center --text "remove package" --entry $(cat $HOME/slitazsave/list.pak))
tazpkg depends $a | cut -d "(" -f1 | sed 's/ //g' | sort > /tmp/$a
cat $HOME/slitazsave/list.pak | grep -v $a > /tmp/list2
diff /tmp/list2 /tmp/$a | grep ^-[a-z] | cut -c 2- > /tmp/other
diff /tmp/list2 /tmp/$a | grep ^" "[a-z] | cut -c 2- > /tmp/list-dep
b=$(wc -l /tmp/other | cut -d " " -f1)
for i in $(seq 1 $b);do tazpkg depends $(head -n$i /tmp/other | tail -1) | cut -d "(" -f1 | sed 's/ //g' >> /tmp/otherdep;done
sort -u /tmp/otherdep > /tmp/oth-dep
diff /tmp/oth-dep /tmp/list-dep | grep ^" " | cut -c 2- > /tmp/res
cat /tmp/other >> /tmp/pak-new
cat /tmp/res >> /tmp/pak-new
cp $HOME/slitazsave/list.pak $HOME/slitazsave/list.pak.bak
rm -r $HOME/slitazsave/list.pak
cp -r /tmp/pak-new $HOME/slitazsave/list.pak
rm -r /tmp/*