Home › Forums › Software › InstaDMG › Installing Packages on First Startup of a Newly Imaged Machine
- This topic has 5 replies, 4 voices, and was last updated 16 years, 3 months ago by
typofonic.
-
AuthorPosts
-
December 21, 2008 at 8:50 pm #375035
typofonic
Participant[QUOTE][u]Quote by: Patrick+Fergus[/u][p][QUOTE][u]Quote by: typofonic[/u][p]Hi arekdreyer,
Could you post your script? I have some problems making it check “Use Network Timeserver” in the preferences using a postfight script.
– Anders[/p][/QUOTE]######
Try this:[code]/usr/sbin/systemsetup -setnetworktimeserver ntpserver.company.com
/usr/sbin/systemsetup -setusingnetworktime on[/code]You’re going to need to run this on first boot of a freshly imaged machine, likely installing a payload-free pkg via launchd or SystemStarter. Someone else will probably provide the instructions on how to do this at InstaDMG image creation time (rather than first boot), but I figure if Apple has already provided a way to set this up I’d rather use it than have to cobble it together myself.Also, systemsetup can’t set setting on a non-startup disk.
– Patrick[/p][/QUOTE]
Thanks Patrick,
But how is it possible to install a payload-free pg via launchd or SystemStarter. Sorry if this is basic, I’m pretty new to this 🙂
#####
(split this post from this thread:
[url]https://www.afp548.com/forum/viewtopic.php?showtopic=21477[/url]
It’s a good question and should get the visibility it needs in a new thread.
– Patrick)
December 23, 2008 at 10:31 pm #375046Patrick Fergus
Participanttypofonic–I split your post to a new topic. It deserves it’s own since I’d also like to know how people are installing packages.
Regarding how to get the package installed on first boot, my script to do it is based on SystemStarter (IIRC, deprecated) and I don’t know if my employer would let me give it out. I’d suggest future-proofing yourself and using launchd. Create a script that will grab a list of packages and install them (you’re going to want to use a list of packages when you suddenly discover something else that you can’t do except when started up from the target disk). After this grab Lingon:
[url]http://www.tuppis.com/lingon/[/url]
and create a LaunchDaemon (someone correct me if I’m wrong about the choice) that:
– Runs at startup
– Runs your script to install your payload-free packages
– Deletes itselfSorry, I only can theorize at the process skin deep-ly because I’m using my deprecated, probably-not-publicly-releasable script.
Thanks,
– Patrick
December 27, 2008 at 2:30 am #375051Rusty Myers
ParticipantHere’s how I’m doing it:
I package a script called systemsetup.sh and install it in /Library/Scripts/ folder. I also install the launchdaemon for that script in /Library/LaunchDaemons. I have other packages that install scripts and launchd items for AD/OD binding and setting computer names. My systemsetup.sh script runs a few first boot settings, then installs the launchd item for a second script which binds to AD/OD. It also removes itself and it’s launchd item. The AD/OD binding script runs and then also clears itself and then installs the last few launchd items that I want to run at login or system boot. The last few launchd items are for keychain minder, an apple script to check ad password expiration, and a script to set the computer Sharing name.
My package is NOT being installed at first boot. I run it within the build train for my image. I find that the easiest.
Here is the trimmed down script:
[code]#!/bin/bash
#System Setup for COE
#Time Zone Setup
systemsetup -settimezone America/New_York#Set to use Network Time Server clock.psu.edu
systemsetup -setusingnetworktime on
systemsetup -setnetworktimeserver clock.server.com#Enable ARD for admin
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users “admin” -privs -all -restart -agent#Start Remote Login
sudo /sbin/service ssh start#Set SUS to Viper
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL “http://server.com:8088/”
sudo defaults write com.apple.SoftwareUpdate CatalogURL “http://server.com:8088/”#Set hard drive name
diskutil rename / “Macintosh HD”#Set hostname
hostName=InstaDMG
/usr/sbin/scutil –set ComputerName $hostName
/usr/sbin/scutil –set LocalHostName $hostName#Remove Launchd item
sudo rm /Library/LaunchDaemons/com.server.systemsetup.plist#Set AD/OD Bind Launchd item
mv /Library/Scripts/ETC/adodbind/com.server.adodautobind.plist /Library/LaunchDaemons/com.server.adodautobind.plist#Make sure the permissons are correct
sudo chown root:wheel /Library/LaunchDaemons/com.server.adodautobind.plist
sudo chmod 644 /Library/LaunchDaemons/com.server.adodautobind.plist#Reboot in 1 minute
#sudo shutdown -r +1
sudo reboot#Self Destruct
srm “$0″[/code]Well, there it is. I’d like to add variables later. I think all the commands were found somewhere on this forum, so thanks to all.
RustyJanuary 13, 2009 at 4:09 pm #375120typofonic
ParticipantThanks a lot Patrick and Rusty for your detailed help and descriptions! I downloaded Lingon to create the script and managed to do what you both describe and run the script using a launchd item. Also I found out an alternative to this was installing the script in /Library/StartupItems/.
Now the only thing missing is changing the Format in the International pane of System Preferences to Danish… Hmm
– Anders
January 15, 2009 at 2:05 pm #375148ttpedersen
ParticipantDepending on how you manage your installations you could either control language setting using MCX or by installing a custom package.
As we have a lot of international students, the main computer language is English but as most staff is Danish they prefer Danish on their computers whether desktop or laptop. I control desktops using MCX and laptops by slipping a custom package into the build train. This package installs a customized version of /Library/Preferences/.GlobalPreferences.plist
It looks like this:
[code]
AppleLanguages
da
en
ja
fr
de
es
it
nl
sv
nb
fi
pt
zh-Hans
zh-Hant
ko
AppleLocale
da_DK
Country
DK
[/code]
If we get more international staff I guess I would consider installing the package with NetRestore’s “install-pkgs.sh” post action to control default language on a per computer basis.-Thomas
January 16, 2009 at 12:07 am #375152typofonic
ParticipantThanks Thomas!
That seems like the way to go. Will try packaging a /Library/Preferences/.GlobalPreferences.plist file!
– Anders
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed