Skip to content

Instantly share code, notes, and snippets.

@joshua-d-miller
Last active August 29, 2015 14:02
Show Gist options
  • Save joshua-d-miller/4ced51d1fde94f1f8843 to your computer and use it in GitHub Desktop.
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)
#!/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