mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-19 05:10:57 +00:00
v0.5
This commit is contained in:
@@ -72,6 +72,13 @@ INSTALL=""
|
||||
# - force Install even if it’s the same version
|
||||
|
||||
|
||||
# Re-opening of closed app
|
||||
REOPEN="yes"
|
||||
# options:
|
||||
# - yes App wil be reopened if it was closed
|
||||
# - no App not reopened
|
||||
|
||||
|
||||
# NOTE: How labels work
|
||||
|
||||
# Each workflow label needs to be listed in the case statement below.
|
||||
@@ -179,7 +186,7 @@ cleanupAndExit() { # $1 = exit code, $2 message
|
||||
hdiutil detach "$dmgmount"
|
||||
fi
|
||||
# If we closed any processes, reopen the app again
|
||||
#reopenClosedProcess # We skip this again, not all apps work correctly when opened like this
|
||||
reopenClosedProcess
|
||||
printlog "################## End Installomator, exit code $1 \n\n"
|
||||
exit "$1"
|
||||
}
|
||||
@@ -191,6 +198,13 @@ runAsUser() {
|
||||
fi
|
||||
}
|
||||
|
||||
reloadAsUser() {
|
||||
if [[ $currentUser != "loginwindow" ]]; then
|
||||
uid=$(id -u "$currentUser")
|
||||
su - $currentUser -c "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
displaydialog() { # $1: message $2: title
|
||||
message=${1:-"Message"}
|
||||
title=${2:-"Installomator"}
|
||||
@@ -418,6 +432,12 @@ reopenClosedProcess() {
|
||||
# If Installomator closed any processes, let's get the app opened again
|
||||
# credit: Søren Theilgaard (@theilgaard)
|
||||
|
||||
# don't reopen if REOPEN is not "yes"
|
||||
if [[ $REOPEN != yes ]]; then
|
||||
printlog "REOPEN=no, not reopening anything"
|
||||
return
|
||||
fi
|
||||
|
||||
# don't reopen in DEBUG mode
|
||||
if [[ $DEBUG -ne 0 ]]; then
|
||||
printlog "DEBUG mode, not reopening anything"
|
||||
@@ -425,11 +445,15 @@ reopenClosedProcess() {
|
||||
fi
|
||||
|
||||
if [[ $appClosed == 1 ]]; then
|
||||
printlog "Telling app $name to open"
|
||||
#runAsUser osascript -e "tell app \"$name\" to open"
|
||||
runAsUser open -a "${name}"
|
||||
processuser=$(ps aux | grep -i "${name}")
|
||||
printlog "Reopened ${name} as $processuser"
|
||||
printlog "Telling app $appName to open"
|
||||
#runAsUser osascript -e "tell app \"$appName\" to open"
|
||||
#runAsUser open -a "${appName}"
|
||||
reloadAsUser "open -a \"${appName}\""
|
||||
#reloadAsUser "open \"${(0)applist}\""
|
||||
processuser=$(ps aux | grep -i "${appName}" | grep -vi "grep" | awk '{print $1}')
|
||||
printlog "Reopened ${appName} as $processuser"
|
||||
else
|
||||
printlog "App not closed, so no reopen."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user