[Fed-Talk] Script help
[Fed-Talk] Script help
- Subject: [Fed-Talk] Script help
- From: "Nichols, Jared - 1170 - MITLL" <email@hidden>
- Date: Thu, 20 May 2010 15:00:37 -0400
- Acceptlanguage: en-US
- Thread-topic: Script help
Title: Script help
Hi all-
I could use help with a script that I’ve written and have gotten stuck with. The gist is that I’ve got CUPS-PDF being installed to get around the changes that Acrobat made in 10.6 so we can have an actual PDF printer on user systems for a particular user group. I’d like to add a folder where the rendered PDFs land when they’ve been run through the CUPS-PDF printer and am doing it with the script below. The problem is that the /var/spool/cups-pdf/$user is not being enumerated and is being dropped into the Dock plist file as is - “/var/spool/cups-pdf/$user.” As a result, you get a ? In the Dock because that “$user” folder doesn’t exists. Any clues on how I can get it to work itself out? I have a feeling that it has to do something with the need to single quote the entire –array-add parameter...
Thanks!
j
PS the user folder creation and chown works as expected.
#!/bin/sh
################################################################################################
##### Filename: CUPS-PDFuser.sh #####
##### Author: Jared F. Nichols #####
##### Purpose: Finishing steps for CUPS-PDF setup #####
################################################################################################
user=`ls -l /dev/console | cut -d " " -f 4`
##Ask for admin password
echo "Please enter your password to create the PDF printer"
echo
##Create the user's PDF rendering folder
sudo mkdir /var/spool/CUPS-PDF/$user
##Assign the folder proper ownership
sudo chown -R $user /var/spool/CUPS-PDF/$user
##Add the PDF rendering folder to the user's dock
defaults write /Users/$user/Library/Preferences/com.apple.dock persistent-others -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/var/spool/CUPS-PDF/$user</string><key>_CFURLStringType</key><integer>0</integer></dict><key>file-label</key><string>Converted to PDF</string><key>file-type</key><integer>41</integer></dict><key>tile-type</key><string>directory-tile</string></dict>'
sudo chown -R $user /Users/$user/Library/Preferences/com.apple.dock.plist
##Restart the dock
killall Dock
exit 0
--
Jared F. Nichols
Desktop Engineer, Client Services
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Fed-talk mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden