Last active
August 29, 2015 14:02
-
-
Save joshua-d-miller/4ced51d1fde94f1f8843 to your computer and use it in GitHub Desktop.
Check for manifest and create one if it doesn't exist (Munki)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Determine if a manifest exists for the computer | |
username="" | |
encpassword="" | |
password=`echo "$encpassword" | base64 --decode` | |
/bin/mkdir /Volumes/client\ manifests | |
/sbin/mount_afp afp://$username:$password@servername/munki/repo/manifests/hosts /Volumes/client\ manifests | |
path="/Volumes/client manifests/$computername" | |
if [[ -e $path ]] | |
then | |
/bin/echo "Manifest exists. System will image normally." | |
else | |
/bin/echo "Manifest does not exist. Creating manifest for $computername." | |
# Determine if Computer is a wireless system. | |
if [[ $computername == *w* ]] | |
then | |
/bin/cp /Volumes/client\ manifests/_wireless\ template /Volumes/client\ manifests/$computername | |
else | |
/bin/cp /Volumes/client\ manifests/_secure\ template /Volumes/client\ manifests/$computername | |
fi | |
if [[ -e $path ]] | |
then | |
/bin/echo "Manifest for $computername created." | |
else | |
/bin/echo "Could not create Manifest for $computername." | |
fi | |
fi | |
/sbin/umount /Volumes/client\ manifests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment