Skip to content

Commit

Permalink
show updates in the notification
Browse files Browse the repository at this point in the history
  • Loading branch information
grahampugh committed Jan 9, 2023
1 parent 6a78386 commit 0a0a26c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version="2.3"
updateRequiredTitle="macOS Software Updates Required"

# The message that is displayed when software updates are in progress and a user is logged in
updateRequiredMessage="Software updates are available to be installed on this Mac which require a restart.\n\nYour administrator requires that these updates are installed as soon as possible.\n\nPlease save your work and press **Continue**. This will open the Software Update panel. From here, press **Install Now** to begin the installation."
updateRequiredMessage="Your administrator requires that these updates are installed as soon as possible.\n\nPlease save your work and press **Continue**. This will open the Software Update panel. From here, press **Install Now** to begin the installation."

# The title of the message that is displayed when software updates are in progress and a user is logged in
updateInProgressTitle="Software Update In Progress"
Expand Down
2 changes: 1 addition & 1 deletion com.github.grahampugh.nice_updater.prefs.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>UpdateInProgressTitle</key>
<string>Software Update In Progress</string>
<key>UpdateRequiredMessage</key>
<string>Software updates are available to be installed on this Mac which require a restart.\n\nYour administrator requires that these updates are installed as soon as possible.\n\nPlease save your work and press **Continue**. This will open the Software Update panel. From here, press **Install Now** to begin the installation.</string>
<string>Your administrator requires that these updates are installed as soon as possible.\n\nPlease save your work and press **Continue**. This will open the Software Update panel. From here, press **Install Now** to begin the installation.</string>
<key>UpdateRequiredTitle</key>
<string>macOS Software Updates Required</string>
</dict>
Expand Down
9 changes: 1 addition & 8 deletions jamf_postinstall_script_for_nice_updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ echo "Stopping daemon..."
/bin/launchctl unload -w "$mainDaemonPlist"
/bin/launchctl unload -w "$mainOnDemandDaemonPlist"

# update the icon path
if [[ -f "$customIconPath" ]]; then
echo "Custom icon specified. Copying to /Library/Scripts/nice_updater_custom_icon.png..."
cp "$customIconPath" /Library/Scripts/nice_updater_custom_icon.png
chown root:wheel /Library/Scripts/nice_updater_custom_icon.png
chmod 644 /Library/Scripts/nice_updater_custom_icon.png
fi

# update the start time intervals
if [[ $startIntervalHour || $startIntervalMinute ]]; then
echo "Reconfiguring StartCalendarInterval..."
Expand All @@ -63,6 +55,7 @@ if [[ $alertTimeoutSeconds ]]; then
[[ $maxNotificationCount ]] && defaults write "$preferenceFileFullPath" MaxNotificationCount -int "$maxNotificationCount"
[[ $afterEmptyUpdateDelayDayCount ]] && defaults write "$preferenceFileFullPath" AfterEmptyUpdateDelayDayCount -int "$afterEmptyUpdateDelayDayCount"
[[ $afterFullUpdateDelayDayCount ]] && defaults write "$preferenceFileFullPath" AfterFullUpdateDelayDayCount -int "$afterFullUpdateDelayDayCount"
[[ $customIconPath ]] && defaults write "$preferenceFileFullPath" IconCustomPath -string "$customIconPath"
fi

# Start our LaunchDaemon
Expand Down
25 changes: 13 additions & 12 deletions nice_updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ get_default_dialog_args() {
default_dialog_args+=(
"--blurscreen"
"--width"
"50%"
"--height"
"50%"
"60%"
"--button1disabled"
"--iconsize"
"256"
Expand All @@ -118,9 +116,7 @@ get_default_dialog_args() {
default_dialog_args+=(
"--moveable"
"--width"
"600"
"--height"
"300"
"60%"
"--titlefont"
"size=20"
"--messagefont"
Expand Down Expand Up @@ -179,21 +175,26 @@ alert_user() {
[[ "$notificationsLeft" == "1" ]] && local subtitle="1 remaining deferral"
[[ "$notificationsLeft" == "0" ]] && local subtitle="No deferrals remaining! Click on \"Install Now\" to proceed"

message="**$subtitle**\n\nSoftware updates are available to be installed on this Mac which require a restart:\n\n"
for ((i=0; i<"${#updatesRestart[@]}"; i++)); do
message="$message""- ${updatesRestart[$i]} \n"
done
message="$message\n"
message="$message""$helperDesc"

writelog "Notifying $loggedInUser of available updates..."
if [[ "$notificationsLeft" == "0" ]]; then
# quit any existing window
echo "quit:" >> "$dialog_log"
writelog "Opening full screen dialog"
writelog "Opening utility dialog window without deferral button"
# set the dialog command arguments
get_default_dialog_args "utility"
dialog_args=("${default_dialog_args[@]}")
dialog_args+=(
"--title"
"$helperTitle"
"--heading"
"$subtitle"
"--message"
"$helperDesc"
"$message"
"--icon"
"$icon"
"--button1text"
Expand All @@ -205,15 +206,15 @@ alert_user() {
else
# quit any existing window
echo "quit:" >> "$dialog_log"
writelog "Opening full screen dialog"
writelog "Opening utility dialog window with deferral button"
# set the dialog command arguments
get_default_dialog_args "utility"
dialog_args=("${default_dialog_args[@]}")
dialog_args+=(
"--title"
"$helperTitle"
"--message"
"**$subtitle**\n\n$helperDesc"
"$message"
"--icon"
"$icon"
"--button1text"
Expand Down

0 comments on commit 0a0a26c

Please sign in to comment.