Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for on-prem JAMF users #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions DeploymentScripts/Mac/JAMF_silentinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ groupid="$4"
grouptoken="$5"
email="$6" #If email is entered in parameters, script will skip over using JAMF API, make sure related password is entered as well
password="$7"
JAMF_domain="$8"

# The script needs access to the JAMF Pro API to gather related the related email for a given user
# The script needs access to the JAMF Pro API to gather related the related email for a given user
# Account just needs to have Users - Read permissions
# You can configure a temp account for this in the "Jamf Pro User Accounts & Groups" section of your console
JAMF_url="$8"
JAMF_username="$9"
JAMF_password="${10}"

################ FUNCTIONS #########################
function url_protocol_check {
http_regex='https?:\/\/.*'
if [[ "${1}" =~ $http_regex ]];
then
echo "${1}"|sed -E 's/https?:\/\///g'
else
echo "${1}"
fi
}

function updateBackblaze {
return=$(sudo /Volumes/Backblaze\ Installer/Backblaze\ Installer.app/Contents/MacOS/bzinstall_mate -upgrade bzdiy)
}
Expand Down Expand Up @@ -44,7 +54,8 @@ function emailValidation {

function jamfAPI {
echo "Making GET request to Classic JAMF API"
response=$(curl -s "https://$JAMF_domain.jamfcloud.com/JSSResource/users/name/$username" -u "$JAMF_username:$JAMF_password")
JAMF_fqdn=$(url_protocol_check "${JAMF_url}")
response=$(curl -s "https://$JAMF_fqdn/JSSResource/users/name/$username" -u "$JAMF_username:$JAMF_password")

email=$(echo $response | /usr/bin/awk -F'<email_address>|</email_address>' '{print $2}')
emailValidation
Expand All @@ -71,8 +82,8 @@ function killSyspref {
}

function setDirectory {
if [ -n "$3" ]
then
if [ -n "$3" ]
then
cd /Users/"$3" || { echo "Failed to cd to user directory"; exit 1; }
fi
}
Expand All @@ -84,7 +95,7 @@ function downloadBackblaze {

function mountBackblaze {
echo "Mounting Installer..."
hdiutil attach -quiet -nobrowse install_backblaze.dmg
hdiutil attach -quiet -nobrowse install_backblaze.dmg
}
###################################################

Expand All @@ -95,8 +106,8 @@ mountBackblaze
#Kill System Preferences process to prevent related BZERROR
killSyspref

#Check to see if Backblaze is installed already, if so update it. Else continue as planned.
if open -Ra "Backblaze" ;
#Check to see if Backblaze is installed already, if so update it. Else continue as planned.
if open -Ra "Backblaze" ;
then
echo "Backblaze already installed, attempting to update"
updateBackblaze
Expand Down