Detecting mounted drives.

Hi there i have a script. Shown below. It mounts a nerwork drive and then installs all my network printers in the office. It also copies a fresh set of drivers and presets on the users computer for them.

I want to make a change so that if can detect if the volume is mounted already and if so then skip the mount part.

Can any one help me with that.


#This section  logs onto the server and mounts the IT_support folder.
do shell script "mkdir /Volumes/IT_support/"

do shell script "mount -t afp afp://username:password@192.168.1.251/IT_support /Volumes/IT_support/"

#This copies a fresh copy of the drivers onto the system and replaces any exsisting drivers.
do shell script "cp -fRv /Volumes/IT_support/01_Mac/06_PrinterAutoInstall/104/Drivers/* /Library/Printers/PPDs/Contents/Resources/"


#This section adds the printers to the system.
do shell script "lpadmin -p A3_Colour_Laser -L South_Side_First_Floor -E -v lpd://192.168.1.26/ -P /Library/Printers/PPDs/Contents/Resources/en.lproj/RICOH\\ Aficio\\ AP3800C"

do shell script "lpadmin -p A3_Southside -L South_Side_First_Floor -E -v lpd://192.168.1.8/ -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 5500DN.gz"

do shell script "lpadmin -p A3_Northside -L North_Side_First_Floor -E -v lpd://192.168.1.17 -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 5500DN.gz"

do shell script "lpadmin -p DeathStar -L Print_Room_First_Floor -E -v lpd://192.168.1.20/ -P /Library/Printers/PPDs/Contents/Resources/HP\\ Designjet\\ 4500\\ PS3.gz"

do shell script "lpadmin -p HP_LaserJet_5100_Series -L Studio_4_Admin_BW -E -v lpd://192.168.1.14/ -P /Library/Printers/PPDs/Contents/Resources/HP\\ LaserJet\\ 5100\\ Series.gz"

do shell script "lpadmin -p Team1_Admin -L Studio_1_Admin_BW -E -v lpd://192.168.1.9/ -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 4500DT.gz"

do shell script "lpadmin -p Team3_Admin -L Studio_1_Admin_BW -E -v lpd://192.168.1.15/ -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 4500DT.gz"

do shell script "lpadmin -p Team4_Admin -L Studio_3_Admin -E -v lpd://192.168.1.16/ -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 4510DT.gz"

do shell script "lpadmin -p Xerox_Graphic_Laser -L Print_Room_First_Floor -E -v lpd://192.168.1.222/ -P /Library/Printers/PPDs/Contents/Resources/xrx7655.gz"

do shell script "lpadmin -p Xerox_Colour_Laser -L Kitchen -E -v lpd://192.168.1.111/ -P /Library/Printers/PPDs/Contents/Resources/en.lproj/Xerox\\ DocuColor3535\\ PS"

do shell script "lpadmin -p Reception -L Reception -E -v lpd://192.168.1.10/ -P /Library/Printers/PPDs/Contents/Resources/Xerox\\ Phaser\\ 4500DT.gz"



#This section copies a fresh copy of the printer presets back onto the system after the printers have been installed. Presets are stored in /etc/cups/PPD admin rights required to copy files into this folder

do shell script "cp -fRv /Volumes/IT_support/01_Mac/06_PrinterAutoInstall/104/ppdPresets/PPD/* /etc/cups/PPD" user name "username" password "password" with administrator privileges

#This unmounts the IT_support drive from the system.
do shell script "umount /Volumes/IT_support"



This will provide a list of the names of every drive already present:

set all_drives to every paragraph of (do shell script "ls /volumes")

Hope this helps,

I guess I would have to use something like that then pipe it to another command which would skip the mounting part of the script if it already exists. Any one got any ideas how I would go about that?

Hi,

try this


if {"IT_support"} is not in paragraphs of (do shell script "/bin/ls /Volumes") then
	do shell script "mkdir /Volumes/IT_support/"
	do shell script "mount -t afp afp://username:password@192.168.1.251/IT_support /Volumes/IT_support/"
end if
# This copies a fresh copy of the drivers onto the system and replaces any exsisting drivers.
do shell script "cp -fRv /Volumes/IT_support/01_Mac/06_PrinterAutoInstall/104/Drivers/* /Library/Printers/PPDs/Contents/Resources/"

.

Thanks.

That sorted my problem.