Automating software updates

Discussion in 'Mac Programming' started by serrix, Aug 30, 2009.

  1. serrix macrumors newbie

    Joined:
    Aug 30, 2009
    #1
    Hi all,
    This is a task i thought would be pretty easy - a script to push updates out to the macs. We only have a few here, but its a pain manually updating them all.
    I'm not sure if this is a good forum to post to but couldn't find one with alot of bash scripting support. Please suggest others that may be helpful.

    I was surprised that i couldn't find much information on doing this - prehaps theres a applescript or automator way though?

    Anyways, we have an authenticated proxy here. So when you run "softwareupdate -l" as root it recognises that and asks for usersname/password.
    Thats great, however the problem comes when you try to automate it.

    I've tried pushing the variables (and indeed just text) to the stdin of softwareupdate like so: echo [CACHE USERNAME]$'\n'$(sleep 2;)[CACHE PASSWORD]$ | softwareupdate -l and this enters in the username, but then leaves me on the password field?

    I've tested that I am in fact pushing the username, enter, wait 2s, password, enter by sending the same input to the following script:
    echo Script running
    echo Please put in username:
    read username
    echo Please enter in password:
    read password

    echo $username $password

    As expected i get the following when i enter 'user' as the username and 'userpassword' when i enter that as the password.:
    Script running
    Please put in username:
    Please enter in password:
    user userpassword

    Any ideas? i'm sure this has been done before!
     
  2. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #2
    Have you considered remote desktop?

    Using the remote desktop task server(or just installing directly, thats what we do here sometimes), you can automate package installs(your own custom packages too, unlike softwareupdate the package does not have to be signed by Apple).

    Your other option would be writing a bash script that runs as root(either using launchd or cron) to do softwareupdate, but that of course comes with a host of security considerations.
     
  3. serrix thread starter macrumors newbie

    Joined:
    Aug 30, 2009

Share This Page