-
-
Save jmahlman/5fec4fe400011ec34af6b91b4c7fd036 to your computer and use it in GitHub Desktop.
A manual install timer...not used in production.
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
#BEGINNING OF FUNCTION GHOES HERE | |
elif [[ "$1" == "manualInstall" ]]; then | |
echo "Command: MainTitle: Installing $APPNAME" >> $DNLOG | |
# Install started, lets set the progress bar | |
{ | |
echo "Command: Image: $INSTALL_ICON" | |
/bin/echo "Command: MainText: $INSTALL_DESC" | |
echo "Status: Preparing to Install $PKG_NAME" | |
echo "Command: DeterminateManual: $INSTALL_TIMER" | |
} >> $DNLOG | |
# Update the progress using a timer until a receipt is found. If it gets full it'll just wait for a receipt. | |
until [[ "$current_progress_value" -ge $INSTALL_TIMER ]] && [[ $(receiptIsPresent) -eq 1 ]]; do | |
userCancelProcess | |
sleep 5 | |
current_progress_value=$((current_progress_value + 5)) | |
echo "Command: DeterminateManualStep: 5" >> $DNLOG | |
echo "Status: Installing $PKG_NAME" >> $DNLOG | |
receiptIsPresent && break | |
last_progress_value=$current_progress_value | |
done | |
fi | |
# END OF FUNCTION GOES HERE | |
receiptIsPresent() { | |
if [[ $(find "/Library/Application Support/JAMF/Receipts/$PKG_NAME" -type f -maxdepth 1) ]]; then | |
current_progress_value="100" | |
# If it finds the receipt, just set the progress bar to full | |
{ | |
echo "Installer is not running, exiting." | |
echo "Command: DeterminateManualStep: 100" | |
echo "Status: $PKG_NAME successfully installed." | |
} >> $DNLOG | |
sleep 10 | |
return 0 | |
fi | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment