and then place the folders mounted on the desktop
make it executable and
place it in /root/Startup no user interaction
cd and dvd drives are not mounted
the writing to the desktop was tricky generating a new PuppyPin
for whatever drives you have and doing all this without it being event driven fully automatic
if you notice that the code to mount and draw to the desktop is very compact and doesnt use any of these listed below
pmount
gtkdialog
eventmanager
partprobe,
probedisk and a few other small scripts/apps that are used while mounting
special features will be added
here's a nice little trick if you used my code in the mount_all3
a file got generated called PuppyPin-old
so if you need or want to toggle off the folder icons you could by doing this code snip
Code: Select all
rox --pinboard=/root/Choices/ROX-Filer/PuppyPin-old
Code: Select all
rox --pinboard=/root/Choices/ROX-Filer/PuppyPin
MOUNT_ALL3
Code: Select all
#!/bin/bash
# call it mount_all3 updated 11-06-2010 Joe Arose
# auto_mount all drives non cd and dvd
# now if you have to mount stuff from the command line only here's one
# don't unmount a drive that has your save file !
# this doesnt depend on xdialog
# added folders to be auto drawn and updated on the desktop
# with auto generating of the xml PuppyPin depending
# on whichever drives are used note that this is not event driven
# it is meant to be placed in /root/Startup so there is no user interaction
# major changes in how a list of drives is generated and multiple
# screen displays are detected
# special thanks to aragon for this code snip below to detect the width and height
#SCW=`xwininfo -root | grep '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
#SCH=`xwininfo -root | grep '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
# this started as a special request for abushcrafter for something simple to auto mount
# then grew into writing to the desktop also with multiple screen sizes
# thanks for catching the loop error amigo
temp_file="/tmp/pin-fix"
rm -f /tmp/pin-fix
rm -f /tmp/NTFS_LIST
rm -f /tmp/FAT_LIST
rm -f /tmp/Linux_LIST
echo >/tmp/list_of_drives
#*************************************************************************
fdisk -l | grep NTFS | cut -f 1 -d ' '| sed 's/\/dev\///'>/tmp/NTFS_LIST
if [ "$?" == "0" ]; then
echo "NTFS_LIST written to /tmp/NTFS_LIST"
NTFS_LIST=$(</tmp/NTFS_LIST)
for ntfs_drive in `cat /tmp/NTFS_LIST` ; do
mkdir -p /mnt/$ntfs_drive
mount -t ntfs-3g /dev/$ntfs_drive /mnt/$ntfs_drive
cat /tmp/NTFS_LIST >>/tmp/list_of_drives
done
fi # bypass the mounting if no ntfs drive found
#*************************************************************************
fdisk -l | egrep '(FAT32|FAT16)' | cut -f 1 -d ' '| sed 's/\/dev\///'>/tmp/FAT_LIST
if [ "$?" == "0" ]; then
echo "FAT_LIST written to /tmp/FAT_LIST"
FAT_LIST=$(</tmp/FAT_LIST)
for fat_drive in `cat /tmp/FAT_LIST` ; do
mkdir -p /mnt/$fat_drive
mount -t vfat /dev/$fat_drive /mnt/$fat_drive
cat /tmp/FAT_LIST >>/tmp/list_of_drives
done
fi # bypass the mounting if no fat drives found
#*************************************************************************
fdisk -l | grep Linux | egrep -v "swap" | cut -f 1 -d ' '| sed 's/\/dev\///'>/tmp/Linux_LIST
if [ "$?" == "0" ]; then
echo "Linux_LIST written to /tmp/Linux_LIST"
Linux_LIST=$(</tmp/Linux_LIST)
for Linux_drive in `cat /tmp/Linux_LIST` ; do
mkdir -p /mnt/$Linux_drive
mount /dev/$Linux_drive /mnt/$Linux_drive
cat /tmp/Linux_LIST >>/tmp/list_of_drives
done
fi # bypass the mounting if no Linux drive found
# refresh icons
rox -p /root/Choices/ROX-Filer/PuppyPin
# set up positions of x and y to print the folder icons on the desktop
# they get repositioned depending on what drives you have. getting added to the right
# by the order they got detected
# preset base values here maybe a test to see what screen size you are using goes here
x_val="64"
c_val="64" #this is the constant
#the y_val="" gets auto detected and then adjusted here
SCW=`xwininfo -root | grep '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SCH=`xwininfo -root | grep '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
echo "screen width" $SCW x "height" $SCH
if [[ $SCH = "480" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="340"
elif [[ $SCH = "600" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="472"
elif [[ $SCH = "768" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="628"
elif [[ $SCH = "864" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="726"
elif [[ $SCH = "960" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="822"
elif [[ $SCH = "1024" ]]; then
echo " the condition is true ---> $SCH "
#do something here
y_val="882"
fi
# to remove any chance of double writes to screen
cat /tmp/list_of_drives | sort -u >/tmp/list_of_drives
for drive in `cat /tmp/list_of_drives` ; do
# edit this with much care it was tedious to format it. Save a copy first of your PuppyPin !
echo " <"icon x='"'$x_val'"' y='"'$y_val'"' label='"'$drive'"'">"/mnt/$drive"<"/icon">" >>$temp_file
# keep adding 64 to the x number to allow for spacing of the icons to be uniform
let x_val="$x_val + $c_val"
done
#----------------------------------------------------
#Append content of file year.txt at line 3 of data.txt.
#sed '3 r year.txt' data.txt > newdata.txt
#year.txt=/tmp/pin-fix data.txt=/root/Choices/ROX-Filer/PuppyPin newdata.txt=/root/Choices/ROX-Filer/PuppyPin4
#----------------------------------------------------
#remove out the /mnt/$drive because it keeps getting appended this wipes it clean each time
cat /root/Choices/ROX-Filer/PuppyPin | egrep -v "/mnt" >/root/Choices/ROX-Filer/PuppyPin1
mv /root/Choices/ROX-Filer/PuppyPin1 /root/Choices/ROX-Filer/PuppyPin
sed '10 r /tmp/pin-fix' /root/Choices/ROX-Filer/PuppyPin > /root/Choices/ROX-Filer/PuppyPin4
mv /root/Choices/ROX-Filer/PuppyPin /root/Choices/ROX-Filer/PuppyPin-old
mv /root/Choices/ROX-Filer/PuppyPin4 /root/Choices/ROX-Filer/PuppyPin
rox -p /root/Choices/ROX-Filer/PuppyPin
Joe