View gist:0874c23c002c98488283526dd6532f0a
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 | |
args=("$@") | |
jssAPIUsername='' | |
jssAPIPassword='' | |
jssAddress="" | |
file="${args[0]}" | |
#Verify we can read the file | |
data=`cat $file` | |
if [[ "$data" == "" ]]; then |
View gist:fa638783ff6f751ebbddfc54c5708e81
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 | |
# originally written by @franton | |
osvers_major=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $1}') | |
osvers_minor=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}') | |
osvers_dot_version=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $3}') | |
if [[ "$osvers_major" -eq 10 && "$osvers_minor" -lt 13 ]]; then | |
echo "<result>Older macOS version</result>" |
View gist:4dba9f36252552dca6b16c43464ab899
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/zsh | |
mylogpath=/tmp/mylog | |
mylog=$mylogpath/myawesomlog-$(date +%Y%m%d-%H%M).log | |
[[ ! -d ${mylogpath} ]]; mkdir -p $mylogpath | |
set -xv; exec 1> $mylog 2>&1 | |
... do some stuff ... |
View gist:461ac4d7db4f52e9b7e3df603f897cd3
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 | |
args=("$@") | |
pkgName="${args[0]}" | |
echo "Supply the package name and version: build.sh <pkgname> <version>" | |
# get date for package name | |
myDate=`date +%Y%m%d` | |
# Name of the package. | |
NAME="${pkgName}" |
View gist:caf2de88462dfb7716310573f4284280
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 | |
args=("$@") | |
pkgName="${args[0]}" | |
echo "Supply the package name and version: build.sh <pkgname> <version>" | |
# get date for package name | |
myDate=`date +%Y%m%d` | |
# Name of the package. | |
NAME="${pkgName}" |
View gist:f9d57f624083a2e5fe50c438fed04067
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 | |
## basic package, not signed. Provide name you want and version as command line arguments. | |
args=("$@") | |
pkgName="${args[0]}" | |
echo "Supply the package name and version: build.sh <pkgname> <version>" | |
# get date for package name | |
myDate=`date +%Y%m%d` |
View gist:8ade3c4133fe0fcdc853bc7be10f9436
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
## upload log to JPS | |
xpath() { | |
# the xpath tool changes in Big Sur | |
if [[ $(sw_vers -buildVersion) > "20A" ]]; then | |
/usr/bin/xpath -e "$@" | |
else | |
/usr/bin/xpath "$@" | |
fi | |
} |
View gist:4d66eb7ed4611755ae4bb859fce37016
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
curl -sku $apiUser:$apiPass $jpsURL/JSSResource/fileuploads/computers/id/$JSS_ID -F name=@${mylog} -X POST |
View gist:53ab550a5568f873c973aac15d37da65
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
JSS_ID=$(curl -H "Accept: text/xml" -sfku "${jss_user}:${jss_pass}" "${jss_url}/JSSResource/computers/serialnumber/${serial}/subset/general" | xpath /computer/general/id[1] | awk -F'>|<' '{print $3}') |
View gist:919c5d2d10eba4f306e57862f47a84f1
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
serial=$(system_profiler SPHardwareDataType | awk '/Serial\ Number\ \(system\)/ {print $NF}'); |
NewerOlder