- This topic has 9 replies, 5 voices, and was last updated 16 years, 10 months ago by
Patrick Fergus.
-
AuthorPosts
-
May 20, 2008 at 2:02 pm #372818
vogtstev
ParticipantJust needing a little clarification on some post action scripts. When trying to execute some post actions I’ve read to refer to $3 in my destination paths. In an example I’ve tried something like this to set a login script:
#!/bin/sh
cd “$3″/
defaults write com.apple.loginwindow LoginHook “/Library/Management/scripts/byhostfix-105.pl”I wasn’t able to get this to work. It does work if I execute it manually after imaging. Should I actually be putting $3 in my path of the LoginHook?
I know I could try using MCX records and plan to experiment more with that, but if I don’t get time I know I can use some login scripts I’ve used in the past. Any ideas?Thanks for any input!
SteveMay 20, 2008 at 3:59 pm #372820Patrick Fergus
ParticipantYep–you’re going to want to direct defaults to write to the plist you want to modify. I think, by default, defaults writes against ~/Library/Preferences. I think. In the case of InstaDMG, you’d be writing to the ~/L/P of root of the startup disk, since root is running InstaDMG.
This should work:
[code]#!/bin/sh
defaults write “$3″/private/var/root/Library/Preferences/com.apple.loginwindow LoginHook “/Library/Management/scripts/byhostfix-105.pl”[/code]
May 20, 2008 at 4:42 pm #372822thisgarryhas2rs
ParticipantYa, it took me awhile to figure out the same thing. It needs to be directed to the exact location on the volume.
May 21, 2008 at 5:38 pm #372837vogtstev
ParticipantThanks guys! I was just about to try the new script. I added those lines to another script and made a payload free package. However, I now have another set of lines in question. I tried making this package previously and it did not seem to execute the commands. I’m trying to set the Date & Time and Enable Root. I know I shouldn’t put the root password in the package and I’m hoping to eventually set this up with password hash, but for testing purposes I have the following:
#!/bin/sh
cd “$3″/
# Enable root
“$3″/usr/sbin/dsenableroot -d -u admin -p adminpassword -r rootpassword# Set Time
“$3″/usr/sbin/systemsetup -settimezone America/Chicago
“$3″/usr/sbin/systemsetup -setnetworktimeserver time.apple.com
“$3″/usr/sbin/systemsetup -setusingnetworktime on# Setup Login
defaults write “$3″/private/var/root/Library/Preferences/com.apple.loginwindow LoginHook “/Library/Management/scripts/byhostfix-105.pl”
defaults write “$3″/private/var/root/Library/Preferences/com.apple.loginwindow DesktopPicture “/Library/Management/backgrounds/crown.jpg”Let me know if you see any more problems! Thanks so much!!!
May 21, 2008 at 5:41 pm #372838vogtstev
ParticipantOne other thing to add:
This package runs during the build after the admin accounts are created with the “Create User” packages.
May 21, 2008 at 6:06 pm #372840vogtstev
ParticipantOK, I found one thing myself –
I accidently put the -d in dsenableroot and i should have put my passwords in ‘password”. It was evaluating the goofy characters.Oops
May 23, 2008 at 2:57 am #372867Patrick Fergus
Participantsystemsetup isn’t smart enough to address anything but the startup disk.
dsenableroot might not be smart enough to address anything but the startup disk–I’m not sure.
– Patrick
May 23, 2008 at 2:23 pm #372876knowmad
Participantdsenableroot can be made to do a non-booted volume, but it must be done with a pre-built hash or it will not work.
June 10, 2008 at 12:53 pm #373045ewhite
Participant@vogtstev
Did the script you posted above work? I’m curious because I’m trying to setup something similar right now…
The first go around, my script (below) screwed up permissions and I no longer had access to anything in my home folder… I’m re-building right now using something based on your script above. (This time I’ll cd into “$3” and pre-pend “$3” instead of $3).[code]#!/bin/bash
# Show Full directory path in Finder Windows
defaults write $3/Users/osxadmin/Library/Preferences/com.apple.finder _FXShowPosixPathInTitle -bool YES[/code]June 10, 2008 at 5:08 pm #373052Patrick Fergus
ParticipantThe reason your home was messed up is that defaults appears to build folder structures if they don’t exist, so if:
[code]”$3″/Users/osxadmin/Library/Preferences/[/code]
doesn’t exist, defaults builds it. Except defaults builds it as owned by root (which is to be expected, root is executing the command).
[code]pfergus:~ root# defaults write /Users/osxadmin/Library/Preferences/\
com.apple.finder _FXShowPosixPathInTitle -bool YES
pfergus:~ root# ls -al /Users/osxadmin/
total 0
drwx—— 3 root admin 102 Jun 10 11:50 .
drwxrwxr-t 9 root admin 306 Jun 10 11:50 ..
drwx—— 3 root admin 102 Jun 10 11:50 Library[/code]
Make sure when you finish modifying the home directory that you chown appropriately (using the uid you’ve set for osxadmin, in this example I’ll use 501):
[code]chown -R 501 /Users/osxadmin[/code]
– Patrick -
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed