Scripting updates

leehop

Registered
I have been trying to find a way to script OS X 10 updates. I have never used applescript, Xcode or automator, but I am willing to learn. I just want to know if its possible. I know it is possible in windows with a simple batch file. However, I am releatively new to OS X and have not found a way to automate updates.
So far
1) I figured out all updates are downloaded to /Library/Receipts in a pkg.
2) I also read the man page on the installer -pkg command for terminal, which is supposed to let me install pkg's at the command line. So, I figured I'd just try an applescript with a collection of installer -pkg commands. But when I try to run installer -pkg at the command line with an OS X update pkg it errors out saying it needs authentication. I was logged into the GUI as administrator with full rights. But I still tried su at the command line to get around the authentication error, but it did not work.

Is what I want to do possible? If it is, what's the easiest way to do it: applescript, Xcode or automator? Any ideas on how to begin?
 
'I have been trying to find a way to script OS X 10 updates.' - ?, you cannot script an update. You can possibly write a script to have 'Installer' open (or using 'do shell script "installer ..."') and install an update.

01. '1) I figured out all updates are downloaded to /Library/Receipts in a pkg.' - no, the '.pkg' files are saved into the '/Library/Packages/' folder. Files installed in the '/Library/Receipts/' folder are the result of being installed (by 'Installer').

Some updates may have (some or all) install items placed into folders of the '/System/' folder. If so, an 'Authenticate' window will appear requesting an administrator's user name and / or password to be entered.

02. 'I was logged into the GUI as administrator with full rights.' - full rights of an administrator ... yes; but, not full rights of 'root' (as via 'sudo' or 'sudo bash' and then providing an administrator's password). This is the Apple way, do not kill the messenger.

-----

I just played with 'Script Editor' and coded 'Installer' (a non-scriptable application) to get me (via 'System Events') as far as the 'Authenticate' window, in attempting to install 'iTunesPhoneDriver.pkg' - from the '/Library/Packages/' folder. Interesting ... I may play with this further.

'Applescript, Xcode or Automator?' - if it is possible, 'Automator' would require an 'Installer' 'Library' element and accompanying 'Action' element(s). However, if 'AppleScript' can be used to install an update, then using 'Automator's 'Automator' 'Library's 'Run AppleScript' Action - one could then create an 'Automator' '.workflow' or application.

If using 'AppleScript'; but, you want to use the 'installer' (UNIX) command - once you figure it out - then consider using AppleScript's 'do shell script "installer ....".

'Xcode' - never tried it to perform a '.pkg' installation.

'Installer' (UNIX) command - never tried it; but, may - out of curiosity.
 
Back
Top