Quote:
Originally Posted by diba
thats right
|
OK, I'm not quite sure what the problem is, so can you run this debugger script for me? Go to the folder profile1, make a backup of the file "hide.sh", and then create a new hide.sh with the following code:
Then post the "hide_profile_1_debug" file that is created (same level as documents)
Code:
#!/bin/bash
# debugger for my hide and show script.
# author VaniaSpeedy
#VARIABLES
config="/mnt/us/extensions/FolderToggle/profile1/config"
##----------
#pre-run
##1. does config exist, and is it readable?
#2. ls the start dir, double check that it is root
#3. check that the folders listed in config exist, and contain files (before they are moved)
#4.
#during run
#after run
##----------
TODAY=$(date +"%y-%m-%d")
echo "Date: "$TODAY ", running debugger" >> /mnt/us/hide_profile_1_debug
if [ ! -f $config ]
then
echo "Config file not found, exiting" >> /mnt/us/hide_profile_1_debug
exit 0
fi
# moves folders to /mnt/us/.hidden
# input is read line by line from config file
hide() {
if [ $1 = "." ] # redundant, but you never know
then
#echo "returning"
return
elif [ ! -d $1 ] #folder doesn't exist, quit
then
echo "folder doesnt exist, exiting" >> /mnt/us/hide_profile_1_debug
return
else # all is well, continue
origname=$1
newname=`echo "../.hidden/"$1`
mv $origname $newname
echo "moved" $origname "to" $newname >> /mnt/us/hide_profile_1_debug
fi
} #end hide()
# change dirs
echo "root listing:"
ls >> /mnt/us/hide_profile_1_debug
cd /mnt/us/documents
echo "documents listing:"
ls >> /mnt/us/hide_profile_1_debug
#mntroot rw # is this neccesary?
# if hidden dir doesnt exist, make it
if [ ! -d /mnt/us/.hidden ]
then
mkdir /mnt/us/.hidden
echo "hidden dir made" >> /mnt/us/hide_profile_1_debug
fi
#IFS work
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
while IFS= read -r file
do
echo "calling for" $file >> /mnt/us/hide_profile_1_debug
hide $file
done < $config
# restore IFS
IFS=$SAVEIFS
#mntroot ro
# refresh the home screen
#if flag empty, just refresh dbus. otherwise, reboot
if [ ! -f /mnt/us/extensions/FolderToggle/profile1/cycle ]
then
touch /mnt/us/extensions/FolderToggle/profile1/cycle # first cycle, make a flag
dbus-send --system /default com.lab126.powerd.resuming int32:1;exit # REFRESH
else # flag exists, delete it and reboot
rm -f /mnt/us/extensions/FolderToggle/profile1/cycle
shutdown -r now
fi