From 8f99dea046860b00f86b92c1112a3851d27ddc46 Mon Sep 17 00:00:00 2001 From: Amado Tejada <44622125+amadotejada@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:59:21 -0800 Subject: [PATCH 1/3] added --check-zoom If active Zoom meetings are detected, the script will exit. No user dialogs are shown. --- erase-install.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/erase-install.sh b/erase-install.sh index eaae263..49a1516 100755 --- a/erase-install.sh +++ b/erase-install.sh @@ -2494,6 +2494,7 @@ show_help() { --kc-service The name of the key containing the account and password --silent Silent mode. No dialogs. Requires use of keychain (--kc mode) for Apple Silicon to provide a password, or the --credentials/--very-insecure-mode mode. + --check-zoom If active Zoom meetings are detected, the script will exit. No user dialogs are shown. --quiet Remove output from mist during installer download. Note that no progress is shown. --preservecontainer Preserves other volumes in your APFS container when using --erase @@ -2694,6 +2695,7 @@ while test $# -gt 0 ; do ;; -c|--confirm) confirm="yes" ;; + --check-zoom) check_zoom="yes" --beta) beta="yes" ;; --preservecontainer) preservecontainer="yes" @@ -2827,6 +2829,9 @@ while test $# -gt 0 ; do shift credentials="$1" ;; + --check_zoom) + shift + ;; --confirmation-icon) shift custom_icon="yes" @@ -3029,6 +3034,27 @@ elif [[ ($overwrite == "yes" && $update_installer == "yes") || ($replace_invalid exit 1 fi +# ----------------------------------------------------------------------------- +# Check if the device is in a Zoom meeting. +# Exits out if Zoom is in a meeting. +# Called when --check-zoom option is used. +# Does not run if --silent is used. +# ----------------------------------------------------------------------------- +check_zoom() { + zoomInMeeting=$(lsof -i 4UDP | grep zoom | awk 'END{print NR}') + if [ "$zoomInMeeting" -gt 1 ]; then + writelog "[$script_name] Active Zoom meeting detected. Exiting." + exit 0 + else + writelog "[$script_name] No active Zoom meetings detected. Continuing." + fi +} + +# check for zoom active meetings +if [[ $check_zoom == "yes" && ! $silent ]]; then + check_zoom +fi + # different dialog icon for OS older than macOS 13 if [[ $(echo "$system_version_major < 13" | bc) == 1 ]]; then dialog_confirmation_icon="/System/Applications/System Preferences.app" From 55ed3e51fc8e6c07a3b7f9a2cdb4c45035cfbc74 Mon Sep 17 00:00:00 2001 From: Amado Tejada <44622125+amadotejada@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:45:30 -0800 Subject: [PATCH 2/3] Update erase-install.sh --- erase-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/erase-install.sh b/erase-install.sh index 49a1516..5ddf793 100755 --- a/erase-install.sh +++ b/erase-install.sh @@ -2696,6 +2696,7 @@ while test $# -gt 0 ; do -c|--confirm) confirm="yes" ;; --check-zoom) check_zoom="yes" + ;; --beta) beta="yes" ;; --preservecontainer) preservecontainer="yes" From 41da534a32ff995634cd212afe2b0738419cc1b6 Mon Sep 17 00:00:00 2001 From: Amado Tejada <44622125+amadotejada@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:51:43 -0500 Subject: [PATCH 3/3] rename to --check-activity - rename to --check-activity - moved function and in alphabetical order --- erase-install.sh | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/erase-install.sh b/erase-install.sh index 5ddf793..dd88159 100755 --- a/erase-install.sh +++ b/erase-install.sh @@ -214,6 +214,21 @@ check_fmm() { fi } +# ----------------------------------------------------------------------------- +# Checks for certain activities, currently only supports Zoom meetings. +# Exits out if activity is detected. +# Called when --check-activty option is used. +# ----------------------------------------------------------------------------- +check_for_activity() { + zoomInMeeting=$(lsof -i 4UDP | grep zoom | awk 'END{print NR}') + if [ "$zoomInMeeting" -gt 1 ]; then + writelog "[$script_name] Active Zoom meeting detected. Exiting." + exit 0 + else + writelog "[$script_name] No active Zoom meetings detected. Continuing." + fi +} + # ----------------------------------------------------------------------------- # Download mist if not present and not --silent mode # ----------------------------------------------------------------------------- @@ -2494,7 +2509,7 @@ show_help() { --kc-service The name of the key containing the account and password --silent Silent mode. No dialogs. Requires use of keychain (--kc mode) for Apple Silicon to provide a password, or the --credentials/--very-insecure-mode mode. - --check-zoom If active Zoom meetings are detected, the script will exit. No user dialogs are shown. + --check-activty If certain activity is detected, the script exits. Currently only supports Zoom meetings. --quiet Remove output from mist during installer download. Note that no progress is shown. --preservecontainer Preserves other volumes in your APFS container when using --erase @@ -2695,7 +2710,7 @@ while test $# -gt 0 ; do ;; -c|--confirm) confirm="yes" ;; - --check-zoom) check_zoom="yes" + --check-activity) check_for_activity="yes" ;; --beta) beta="yes" ;; @@ -2830,7 +2845,7 @@ while test $# -gt 0 ; do shift credentials="$1" ;; - --check_zoom) + --check-activity) shift ;; --confirmation-icon) @@ -3035,25 +3050,9 @@ elif [[ ($overwrite == "yes" && $update_installer == "yes") || ($replace_invalid exit 1 fi -# ----------------------------------------------------------------------------- -# Check if the device is in a Zoom meeting. -# Exits out if Zoom is in a meeting. -# Called when --check-zoom option is used. -# Does not run if --silent is used. -# ----------------------------------------------------------------------------- -check_zoom() { - zoomInMeeting=$(lsof -i 4UDP | grep zoom | awk 'END{print NR}') - if [ "$zoomInMeeting" -gt 1 ]; then - writelog "[$script_name] Active Zoom meeting detected. Exiting." - exit 0 - else - writelog "[$script_name] No active Zoom meetings detected. Continuing." - fi -} - -# check for zoom active meetings -if [[ $check_zoom == "yes" && ! $silent ]]; then - check_zoom +# check for user activity +if [[ $check_for_activity == "yes" ]]; then + check_for_activity fi # different dialog icon for OS older than macOS 13