EDIT: Needs more testing and work done on the symlinks in the case of development libraries.
Code: Select all
#!/bin/sh
#sfs remover by stemsee
#copyright (c) 2015 Marcos Contant
#
#For removing all files in an sfs module that has been added to main sfs
#by remastering or added flat (manually copied in). Requires original
#( or any) sfs module for building list of files to be removed.
#for example a devx_vivid_beta.sfs to remove development files.
#The list that is built can also be used as an installed file list in
#~/.packages/ . So that running this script before creating an sfs module
#from a dir and saving the resultant list to ./$HOME/.packages/devx.files
#will give the option to uninstall files using ppm (i think) or slocategui
#and apptree.
#
echo "Enter /path/to/*.sfs module whose files you want to remove from system.
e.g. /mnt/home/devx.sfs
The sfs module will be decompressed then all files will be listed and removed
from running system."
read hit
if [ -f "$hit" ]; then
unsquashfs -dest "$hit"-extracted "$hit"
cd "$hit"-extracted
else
echo "'$hit' not found. press Enter to try again."
read U-dummy
exec "$0"
fi
[[ -f /tmp/rmsfs.lst ]] && rm -f /tmp/rmsfs.lst
touch /tmp/rmsfs.lst
tree -f -i -F --noreport | sed '/\/$/d' >> /tmp/rmsfs.lst
sed -i 's|./|/|' /tmp/rmsfs.lst
sed -i 1d /tmp/rmsfs.lst
sed -i 's/ .*//g' /tmp/rmsfs.lst
geany /tmp/rmsfs.lst &
echo "Ready to remove displayed files from running system. Press y or n."
read hut
case $hut in
y) while read line
do
rm -f $line
done < /tmp/rmsfs.lst
cd ../
cp /tmp/rmsfs.lst "$hit"-extracted/root/.packages/"$hit".files;;
n) exit 0;;
*) exec "$0";;
esac