forked from moofit/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadPackagesJSSAPI.sh
38 lines (30 loc) · 1.08 KB
/
uploadPackagesJSSAPI.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
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
################################################
#
# Upload packages to Casper
#
# 2015 - Amsys - DA
#
################################################
# Variables
apiURL="https://casperurl.com:8443"
apiUser="username"
apiPass="password"
pathToPackages="/Volumes/Data/CasperDP/Packages"
# Advanced modification below this line
if [ ! -d /private/tmp/Packages ]; then
mkdir /private/tmp/Packages
fi
for PACKAGE in $(ls $pathToPackages)
do
echo "<package>" > /private/tmp/Packages/$PACKAGE.xml
echo " <name>$PACKAGE</name>" >> /private/tmp/Packages/$PACKAGE.xml
echo " <filename>$PACKAGE</filename>" >> /private/tmp/Packages/$PACKAGE.xml
echo " <priority>10</priority>" >> /private/tmp/Packages/$PACKAGE.xml
echo " <reboot_required>false</reboot_required>" >> /private/tmp/Packages/$PACKAGE.xml
echo " <boot_volume_required>true</boot_volume_required>" >> /private/tmp/Packages/$PACKAGE.xml
echo "</package>" >> /private/tmp/Packages/$PACKAGE.xml
curl -sfku $apiUser:$apiPass $apiURL/JSSResource/packages -T /private/tmp/Packages/$PACKAGE.xml -X POST
done
exit 0