Skip to content

Instantly share code, notes, and snippets.

@jmahlman
Last active May 23, 2022
Embed
What would you like to do?
A manual install timer...not used in production.
#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