Tiny Core Base > TCB Talk

plz delete the home during shutdown in case is in filetool and persistent

<< < (3/3)

jls:
ok, I made the below script:

--- Code: ---#!/bin/sh
#removes the eventual persistent home if exists and is listed in /opt/.filetool.lst
#called from exitcheck.sh
#copyleft jls_legalize (unsenepopiu at tin dot it)

. /etc/init.d/tc-functions

for i in `cat /proc/cmdline`; do
case $i in
*=*)
case $i in
home*) MYHOME=${i#*=};;
user*) USER=${i#*=} ;;
esac
esac
done
if [ $MYHOME ]; then
[ $USER ] || MYHOME=tc
for i in `cat /opt/.filetool.lst`; do
if [ $i == "home/tc" ]; then
echo -n "${BLUE}removing ${MAGENTA}/mnt/$MYHOME/home/$USER"
sudo rm -rf /mnt/$MYHOME/home/$USER/* /mnt/$MYHOME/home/$USER/.[!.] /mnt/$MYHOME/home/$USER/.??* &
rotdash $!
sync
exit 1
fi
done
fi

--- End code ---

mikshaw:
I guess I understand what you hope for, but I agree with robert that this behavior would be an odd thing to have in TC base.  If you have  persistent home that would typically mean that this particular installation is not intended to be portable.  The portable system would seem to imply that your persistency  comes in the form of mydata, and just assuming that you want to delete home because it's in filetool.lst is likely to cause a lot of trouble.  For example, I don't use backup/restore, and I do use a peristent home.  I haven't made any change to the default filetool.lst, which by default includes /home/tc. Your script would seriously tick me off if it ran on my system, since I'd lose everything

jpeters:

--- Quote from: mikshaw on May 29, 2009, 10:18:01 PM --- I haven't made any change to the default filetool.lst, which by default includes /home/tc. Your script would seriously tick me off if it ran on my system, since I'd lose everything

--- End quote ---
:D

jls:
I've modified my script, see the post above, so now it doesn't delete the home but only it's content, and I've also added rotdash $! and sync which I've copied from filetool.sh.
put this line:

--- Code: ---aterm +tr +sb -bg white -fg black -geometry 80x3 -e persistent_home_removal
--- End code ---
in exitxhech.sh before the ACTION="$1" line
Also posted in the wiki

Navigation

[0] Message Index

[*] Previous page

Go to full version