diff --git a/join-ts-oauth.sh b/join-ts-oauth.sh new file mode 100644 index 0000000..d9c03bf --- /dev/null +++ b/join-ts-oauth.sh @@ -0,0 +1,84 @@ +#!/bin/sh +echo "*** PURPLE LAUNCH TAILSCALE SCRIPT ***" +############################################################################################### +# +# ****** +# *...../ / ****** +# ************** *****/ *****/*****/***/*************/ ****** /********** +# ******/..*****/ *****/ *****/********//******/ ,*****/******,***** ,*****/ +# *****/ ***** *****/ *****/*****/ *****/ /************************** +# *******//*****/ *************/*****/ *********************/*******./*/* ()) +# ************* ******/*****/*****/ *****/******/. ****** ********** (())) +# *****/ *****/ ()) +# *****/ *****/ +# +############################################################################################### +# NOTICE: MAC SPECIFIC SCRIPT, USING MOSYLE VARIABLES +############################################################################################### +#TAILSCALEAUTHKEY= +#SESSIONEXPIRY= + +APPNA="Tailscale" +DIR="/Applications/$APPNA.app" + + +if [ -d "$DIR" ]; then + ### Take action if $DIR exists ### + echo "$APPNA is installed." +else + ### Control will jump here if $DIR does NOT exists ### + echo "$APPNA is not installed." + /usr/local/bin/dialog dialog --title "Tailscale Error" --message "**Tailscale Application is missing.**\n\n Please install Tailscale from Self-Service.app and try again... \n\n" --alignment centre --centericon --small --icon warning --overlayicon "/Applications/Tailscale.app" --button1text "Okay" + exit 1 +fi +## DO NOT CHANGE OR SHARE BELOW + + +currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' ) +TSENGINEER=$(echo $currentUser) +uid=$(id -u "$currentUser") +runAsUser() { + if [ "$currentUser" != "loginwindow" ]; then + launchctl asuser "$uid" sudo -u "$currentUser" "$@" + else + echo "no user logged in" + exit 1 + fi +} + +ZDTICKETNO=$(/usr/local/bin/dialog dialog --title none --message "**Helpdesk Ticket Number Required**\n\n Please enter the Zendesk Ticket Number below without hash: \n\n" --alignment centre --centericon --small --ontop --infobuttontext "Cancel" --infobuttonaction "https://purplecomputing.com/support" --icon warning --overlayicon "/Applications/Tailscale.app" --textfield "Ticket" --quitoninfo --button1text "Continue") +ZDTICKETRAW0=$(echo $ZDTICKETNO | awk -F: '{print $2}') +ZDTICKETRAW=$(echo $ZDTICKETRAW0) + +echo +killall dialog Dialog +rm -rf /var/tmp/dialog.log +touch /var/tmp/dialog.log +chmod 777 /var/tmp/dialog.log +sleep 2 + +sudo -u $(stat -f "%Su" /dev/console) osascript <