Add session restore to Google Chrome FMA updates - #36662
Merged
Merged
Conversation
fleet-release
approved these changes
Dec 4, 2025
allenhouchins
temporarily deployed
to
Docker Hub
December 4, 2025 04:17 — with
GitHub Actions
Inactive
fleet-release
previously approved these changes
Dec 4, 2025
Contributor
Script Diff Resultsee/maintained-apps/outputs/google-chrome/darwin.json=== Install // cb87ad28 -> d0438638 ===
--- /tmp/old.tMCQS8 2025-12-04 04:18:32.375503137 +0000
+++ /tmp/new.spqPaG 2025-12-04 04:18:32.375503137 +0000
@@ -37,5 +37,32 @@
fi
}
+restart_chrome() {
+ local console_user
+ console_user=$(stat -f "%Su" /dev/console 2>/dev/null || echo "")
+
+ if [[ -n "$console_user" && "$console_user" != "root" ]]; then
+ echo "Restarting Chrome for user: $console_user"
+ sudo -u "$console_user" open -a "Google Chrome" --args --restore-last-session
+ else
+ echo "No console user found, attempting direct Chrome start..."
+ open -a "Google Chrome" --args --restore-last-session
+ fi
+}
+
+# Check if Chrome was running before we quit it
+CHROME_WAS_RUNNING=false
+if osascript -e "application id \"com.google.Chrome\" is running" 2>/dev/null; then
+ CHROME_WAS_RUNNING=true
+fi
+
quit_application 'com.google.Chrome'
-installer -pkg "$INSTALLER_PATH" -target /
+installer -pkg "$INSTALLER_PATH" -target / || true
+
+# Restart Chrome if it was running before installation
+if [[ "$CHROME_WAS_RUNNING" == "true" ]]; then
+ sleep 2
+ restart_chrome || true
+fi
+
+exit 0
=== Uninstall Script (no changes) === |
fleet-release
approved these changes
Dec 4, 2025
allenhouchins
temporarily deployed
to
Docker Hub
December 4, 2025 04:59 — with
GitHub Actions
Inactive
Contributor
Script Diff Resultsee/maintained-apps/outputs/google-chrome/darwin.json=== Install // cb87ad28 -> d0438638 ===
--- /tmp/old.i3OxZp 2025-12-04 05:02:33.363724644 +0000
+++ /tmp/new.RKqjDX 2025-12-04 05:02:33.363724644 +0000
@@ -37,5 +37,32 @@
fi
}
+restart_chrome() {
+ local console_user
+ console_user=$(stat -f "%Su" /dev/console 2>/dev/null || echo "")
+
+ if [[ -n "$console_user" && "$console_user" != "root" ]]; then
+ echo "Restarting Chrome for user: $console_user"
+ sudo -u "$console_user" open -a "Google Chrome" --args --restore-last-session
+ else
+ echo "No console user found, attempting direct Chrome start..."
+ open -a "Google Chrome" --args --restore-last-session
+ fi
+}
+
+# Check if Chrome was running before we quit it
+CHROME_WAS_RUNNING=false
+if osascript -e "application id \"com.google.Chrome\" is running" 2>/dev/null; then
+ CHROME_WAS_RUNNING=true
+fi
+
quit_application 'com.google.Chrome'
-installer -pkg "$INSTALLER_PATH" -target /
+installer -pkg "$INSTALLER_PATH" -target / || true
+
+# Restart Chrome if it was running before installation
+if [[ "$CHROME_WAS_RUNNING" == "true" ]]; then
+ sleep 2
+ restart_chrome || true
+fi
+
+exit 0
=== Uninstall Script (no changes) === |
allenhouchins
marked this pull request as ready for review
December 4, 2025 15:41
fleet-release
previously approved these changes
Dec 4, 2025
fleet-release
approved these changes
Dec 4, 2025
allenhouchins
temporarily deployed
to
Docker Hub
December 4, 2025 15:43 — with
GitHub Actions
Inactive
Contributor
Script Diff Resultsee/maintained-apps/outputs/google-chrome/darwin.json=== Install // d0438638 -> 0eca52a6 ===
--- /tmp/old.HUg7Ul 2025-12-04 15:44:09.540698969 +0000
+++ /tmp/new.8xXVlH 2025-12-04 15:44:09.540698969 +0000
@@ -2,15 +2,9 @@
quit_application() {
local bundle_id="$1"
+ local console_user="$2"
local timeout_duration=10
- # check if the application is running
- if ! osascript -e "application id \"$bundle_id\" is running" 2>/dev/null; then
- return
- fi
-
- local console_user
- console_user=$(stat -f "%Su" /dev/console)
if [[ $EUID -eq 0 && "$console_user" == "root" ]]; then
echo "Not logged into a non-root GUI; skipping quitting application ID '$bundle_id'."
return
@@ -38,8 +32,7 @@
}
restart_chrome() {
- local console_user
- console_user=$(stat -f "%Su" /dev/console 2>/dev/null || echo "")
+ local console_user="$1"
if [[ -n "$console_user" && "$console_user" != "root" ]]; then
echo "Restarting Chrome for user: $console_user"
@@ -50,19 +43,20 @@
fi
}
-# Check if Chrome was running before we quit it
+# Get console user once (used by both quit and restart)
+CONSOLE_USER=$(stat -f "%Su" /dev/console 2>/dev/null || echo "")
+
+# Check if Chrome is running (only check once)
CHROME_WAS_RUNNING=false
if osascript -e "application id \"com.google.Chrome\" is running" 2>/dev/null; then
CHROME_WAS_RUNNING=true
+ quit_application 'com.google.Chrome' "$CONSOLE_USER"
fi
-quit_application 'com.google.Chrome'
-installer -pkg "$INSTALLER_PATH" -target / || true
+installer -pkg "$INSTALLER_PATH" -target /
# Restart Chrome if it was running before installation
if [[ "$CHROME_WAS_RUNNING" == "true" ]]; then
sleep 2
- restart_chrome || true
+ restart_chrome "$CONSOLE_USER" || true
fi
-
-exit 0
=== Uninstall Script (no changes) === |
2 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.