OSX script help.

Soldato
Joined
1 Sep 2005
Posts
10,001
Location
Scottish Highlands
Right, I'm trying to get the following script to work in OSX, but it's not having ball. Any idea where I'm going wrong?

defaultuser.command
#!/bin/bash

cd /System/Library/User\ Template1/
sudo ditto -rsrcFork English.lproj/* English.lproj.bak
sudo rm -rf /System/Library/User\ Template1/English.lproj/*
sudo cp -R /Users/default/* /System/Library/User\ Template1/English.lproj/
sudo chown -R root English.lproj
sudo chgrp -R wheel English.lproj

cd /Volumes/USB2/
sudo cp /Volumes/USB2/scripts/logoutscript.command /System/Library/Custom\ Settings/
sudo chown a+x /System/Library/Custom\ Settings/logoutscript.command
sudo defaults write com.apple.loginwindow \ LogoutHook /System/Library/Custom\ Settings/logoutscript.command

logoutscript.command
#!/bin/bash
sudo rm -rf /Users/temp/*

The basic plan is to copy the contents of the default local user folder to the user template folder, so that whenever a new user is generated, it takes all the settings etc of the default user.

It should then copy the logoutscript.command and set it to run on logout. This script simply removes the contents of the temp user, so it is regenerated on login. At the moment though it is doing none of that and simply sits there after launching it from finder. I have set them both as executable as well.
 
Back
Top Bottom