-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.sh
29 lines (25 loc) · 1.25 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# inventory controller
DR_CTL="${BASEURL}index.php?/module/inventory/"
# Find out where the munki directory is to set accordingly.
munki_install_dir=$(osascript -l JavaScript -e "ObjC.import('Foundation'); ObjC.unwrap($.NSUserDefaults.alloc.initWithSuiteName('ManagedInstalls').objectForKey('ManagedInstallDir'))")
munki_install_dir=$(echo ${munki_install_dir} | sed 's/\/$//')
# Get the scripts in the proper directories
"${CURL[@]}" "${DR_CTL}get_script/inventory_add_plugins" -o "${MUNKIPATH}postflight.d/inventory_add_plugins.py"
# Check exit status of curl
if [ $? = 0 ]; then
# Make executable
chmod a+x "${MUNKIPATH}postflight.d/inventory_add_plugins.py"
# make sure the munki install directory is defined. If not default back to normal
if [[ "${munki_install_dir}" == "None" ]]; then
# This also intended behavior if munki isn't installed
setreportpref "inventory" '/Library/Managed Installs/ApplicationInventory.plist'
else
# Set preference to include this file in the preflight check
setreportpref "inventory" "${munki_install_dir}/ApplicationInventory.plist"
fi
else
echo "Failed to download all required components!"
rm -f "${MUNKIPATH}postflight.d/inventory_add_plugins.py"
ERR=1
fi