Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an extra parameter to script #50

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions Installomator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,29 @@ printlog "################## $label"
# lowercase the label
label=${label:l}

# Second parameter as the handling of blocked process (so admin can force update)
# credit: Søren Theilgaard (@theilgaard)
if [[ $2 ]]; then
BLOCKING_PROCESS_ACTION=$2
case $BLOCKING_PROCESS_ACTION in
ignore|silent_fail|prompt_user|kill)
printlog "Handling of blocking process set by parameter."
;;
*)
printlog "Incorrect parameter for handling of blocked process."
printlog "Can be the following:"
printlog "- ignore continue even when blocking processes are found"
printlog "- silent_fail exit script without prompt or installation"
printlog "- prompt_user show a user dialog for each blocking process found abort after three attempts to quit"
printlog "- kill kill process without prompting or giving the user a chance to save"
printlog "Continue with prompt_user"
BLOCKING_PROCESS_ACTION=prompt_user
;;
esac

fi
printlog "Handling of blocking process: $BLOCKING_PROCESS_ACTION"

# get current user
currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }')

Expand Down