Hire me if you like: blake.irvin@gmail.com

Wednesday, March 07, 2007

Example script for pushing application updates to OS X clients with ARD

In this case I was pushing out a Lotus Notes DST patch.

--------------------------


#!/bin/bash

# space our downloads out over random intervals if we push this out with
# ARD

echo "preparing"
sleep `jot -r 1`

# we are grabbing the DST hotfix files in a disk image from our server

echo "getting hotfix disk image"
curl http://server.domain.com:8080/DSThotfix_654.dmg -o /tmp/DSThotfix_654.dmg

# we are attaching the disk image to our system

echo "mounting hotfix disk image"
hdiutil attach /tmp/DSThotfix_654.dmg

# we are backing up the appropriate files in the Lotus Notes template folder

echo "backing up Lotus Notes application template prior to changes -
backup files
will be stored in /Users/Shared/NotesDSTBackup"
ditto /System/Library/User\ Template/English.lproj/Lotus\ Notes/Notes
/Users/Shared/NotesDSTBackup/
ditto /System/Library/User\ Template/English.lproj/Lotus\ Notes/ndgts
/Users//Shared/NotesDSTBackup/
ditto /System/Library/User\ Template/English.lproj/Lotus\
Notes/NotesLib /Users/Shared/NotesDSTBackup/

# we are putting the updated DST hotfix files into the Lotus Notes
template folder

echo "updating Lotus Notes application template with DST hotfix files"
ditto /Volumes/DSThotfix_654/* /System/Library/User\
Template/English.lproj/Lotus\ Notes/

# we are getting the name of each user folder as [dname] and copying
DST hotfix files to the
# appropriate subdirectories of each user folder

echo "updating each local user profile's Lotus Notes application files
with DST hotfix"
for dname in `ls /Users`
do ditto /Volumes/DSThotfix_654/* /Users/$dname/Lotus\ Notes/; done

# we are making sure that each user's Lotus Notes directory and
contents are owned by that user
# we are also setting the group bit to 'staff'

echo "cleaning up ownership for each local user profile's Lotus Notes directory"
for dname in `ls /Users`
do chown -R $dname:staff /Users/$dname/Lotus\ Notes/; done

# we are making sure that only the owner of the Lotus Notes directory
can access that directory

echo "cleaning up ownership for each local user profile's Lotus Notes directory"
for dname in `ls /Users`
do chmod -R 700 /Users/$dname/Lotus\ Notes; done

No comments:

Archive