diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b82527..7b947c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [2.1.0] - 2019/02/xx +Added depNotifyPolicySupplement.sh to assist with deployment with DEP Enrollment Packages. Thanks to @arekdreyer for your hard work and collaboration. + ## [2.0.1] - 2019/01/08 Made small change to chmod and chown for the DEPNotify configuration plist. There was an issue if EULA and Registration window were not used that the plist would not have proper permissions. diff --git a/RELEASES.md b/RELEASES.md index a4b21dd..07b3c74 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -2,6 +2,16 @@ This page is to document version of the DEPNotify script in relation to the DEPNotify app. Script and app versions are independent of one another and can be confusing as releases continue. +## 1.1.4 of DEPNotify appear +No major changes in 1.1.4 of DEPNotify that would effect the script. Mainly bug fixes that were introduced in 1.1.3. + +##### App Download Link +* [DEPNotify 1.1.14](https://s3.amazonaws.com/nomadbetas/DEPNotify-1.1.4.pkg) + +##### Tested versions of DEPNotify.sh +* [v2.1.0](https://github.com/jamf/DEPNotify-Starter/releases/tag/v2.1.0) +* [v2.0.1](https://github.com/jamf/DEPNotify-Starter/releases/tag/v2.0.1) + ## 1.1.3 of DEPNotify app Due to changes with menu.depnotify.plist, it was easier to update the script without backwards compatibility. As such v.2.0.0 of the script only supports this version of the app diff --git a/depNotify.sh b/depNotify.sh index 8f5c4d6..b860410 100644 --- a/depNotify.sh +++ b/depNotify.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Version 2.0.1 +# Version 2.1.0 ######################################################################################### # License information @@ -133,6 +133,16 @@ ######################################################################################### # Policy Variable to Modify ######################################################################################### +# If installing DEPNotify and this script as an Enrollment Package during DEP enrollment, +# and have configured the depNotifyPolicySupplement.sh as a policy, then set this flag +# to true. Otherwise leave as false. For more info on how to configure, see the readme. + POLICY_SUPPLEMENT=false + + # THIS ONLY NEEDS TO BE CONFIGURED IF POLICY_SUPPLEMENT IS SET TO TRUE! + # To call the POLICY_SUPPLEMENT, there must be a policy with the supplement configured. + # Create a custom trigger and add it below. + POLICY_SUPPLEMENT_TRIGGER="depNotifyPolicySupplement" + # The policy array must be formatted "Progress Bar text,customTrigger". These will be # run in order as they appear below. POLICY_ARRAY=( @@ -709,7 +719,19 @@ # Adding nice text and a brief pause for prettiness echo "Status: $INITAL_START_STATUS" >> "$DEP_NOTIFY_LOG" - sleep 5 + +# Added until/wait based on the POLICY_SUPPLEMENT flag + if [ "$POLICY_SUPPLEMENT" = false ]; then + echo "$(date "+%a %h %d %H:%M:%S"): Sleeping 5 seconds to allow for pretty inital start message to show." >> "$DEP_NOTIFY_DEBUG" + sleep 5 + else + until [ -f "$JAMF_BINARY" ]; do + echo "$(date "+%a %h %d %H:%M:%S"): Jamf binary has yet to be installed on the client. Waiting..." >> "$DEP_NOTIFY_DEBUG" + sleep 1 + done + fi + +##### NEEED TO ASSESS AS THE DETERMINATE IS BROKEN WHEN USING THE POLICY_SUPPLEMENT ##### # Setting the status bar # Counter is for making the determinate look nice. Starts at one and adds @@ -729,6 +751,8 @@ ARRAY_LENGTH="$((${#POLICY_ARRAY[@]}+ADDITIONAL_OPTIONS_COUNTER))" echo "Command: Determinate: $ARRAY_LENGTH" >> "$DEP_NOTIFY_LOG" +##### NEEED TO ASSESS AS THE DETERMINATE IS BROKEN WHEN USING THE POLICY_SUPPLEMENT ##### + # EULA Window Display Logic if [ "$EULA_ENABLED" = true ]; then echo "Status: $EULA_STATUS" >> "$DEP_NOTIFY_LOG" @@ -757,14 +781,18 @@ fi # Loop to run policies - for POLICY in "${POLICY_ARRAY[@]}"; do - echo "Status: $(echo "$POLICY" | cut -d ',' -f1)" >> "$DEP_NOTIFY_LOG" - if [ "$TESTING_MODE" = true ]; then - sleep 10 - elif [ "$TESTING_MODE" = false ]; then - "$JAMF_BINARY" policy -event "$(echo "$POLICY" | cut -d ',' -f2)" - fi - done + if [ "$POLICY_SUPPLEMENT" = false ]; then + for POLICY in "${POLICY_ARRAY[@]}"; do + echo "Status: $(echo "$POLICY" | cut -d ',' -f1)" >> "$DEP_NOTIFY_LOG" + if [ "$TESTING_MODE" = true ]; then + sleep 10 + elif [ "$TESTING_MODE" = false ]; then + "$JAMF_BINARY" policy -event "$(echo "$POLICY" | cut -d ',' -f2)" + fi + done + else + "$JAMF_BINARY" policy -event "$POLICY_SUPPLEMENT_TRIGGER" + fi # Nice completion text echo "Status: $INSTALL_COMPLETE_TEXT" >> "$DEP_NOTIFY_LOG" diff --git a/depNotifyPolicySupplement.sh b/depNotifyPolicySupplement.sh new file mode 100644 index 0000000..61a140c --- /dev/null +++ b/depNotifyPolicySupplement.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# Version 2.1.0 + +######################################################################################### +# License information +######################################################################################### +# Copyright 2018 Jamf Professional Services + +# Permission is hereby granted, free of charge, to any person obtaining a copy of this +# software and associated documentation files (the "Software"), to deal in the Software +# without restriction, including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +# to whom the Software is furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all copies or +# substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +######################################################################################### +# General Information +######################################################################################### +# This script is designed to make implementation of DEPNotify very easy with limited +# scripting knowledge. The section below has variables that may be modified to customize +# the end user experience. DO NOT modify things in or below the CORE LOGIC area unless +# major testing and validation is performed. + +# More information at: https://github.com/jamfprofessionalservices/DEP-Notify + +# This script will not work without depNotify.sh Please review the readme for more info. + +######################################################################################### +# Testing Mode +######################################################################################### +# Testing flag will enable the following things to change: +# Auto removal of BOM files to reduce errors +# Sleep commands instead of policies or other changes being called +# Quit Key set to command + control + x + TESTING_MODE=true # Set variable to true or false + +######################################################################################### +# Policy Variable to Modify +######################################################################################### +# The policy array must be formatted "Progress Bar text,customTrigger". These will be +# run in order as they appear below. + POLICY_ARRAY=( + "Installing Adobe Creative Cloud,adobeCC" + "Installing Adobe Reader,adobeReader" + "Installing Chrome,chrome" + "Installing CrashPlan,crashplan" + "Installing Firefox,firefox" + "Installing Java,java" + "Installing NoMAD,nomad" + "Installing Office,msOffice" + "Installing Webex,webex" + "Installing Critical Updates,updateSoftware" + ) + +######################################################################################### +######################################################################################### +# Core Script Logic - Don't Change Without Major Testing +######################################################################################### +######################################################################################### + +# Variables for File Paths + JAMF_BINARY="/usr/local/bin/jamf" + DEP_NOTIFY_LOG="/var/tmp/depnotify.log" + DEP_NOTIFY_DEBUG="/var/tmp/depnotifyDebug.log" + +# Testing Mode + if [ "$4" != "" ]; then TESTING_MODE="$4"; fi + +# Validating true/false flags + if [ "$TESTING_MODE" != true ] && [ "$TESTING_MODE" != false ]; then + echo "$(date "+%a %h %d %H:%M:%S"): Testing configuration not set properly. Currently set to $TESTING_MODE. Please update to true or false." >> "$DEP_NOTIFY_DEBUG" + exit 1 + fi + +# Loop to run policies + for POLICY in "${POLICY_ARRAY[@]}"; do + echo "Status: $(echo "$POLICY" | cut -d ',' -f1)" >> "$DEP_NOTIFY_LOG" + if [ "$TESTING_MODE" = true ]; then + sleep 10 + elif [ "$TESTING_MODE" = false ]; then + "$JAMF_BINARY" policy -event "$(echo "$POLICY" | cut -d ',' -f2)" + fi + done