#!/bin/bash # 2.1 var4="-reset -preLogin NoMADLoginAD:RunScript,privileged" var5="ING_DiBa" var6="Frankfurt" var7="macOS_client" var9="-reset" PRODUCTNAME="000_JamfConnect_VWIC_ALL_MUI_After-2.1" LOGFILE="/var/log/${PRODUCTNAME}.log" ENROLLMENT_PLIST="/Library/Preferences/vwg.client.plist" exec >> $LOGFILE exec 2>&1 echo $(DATE)" | ==== Start $PRODUCTNAME ====" set -x if [ -n "${var4}" ]; then AUTHCHANGER_PARAMETER="${var4}" fi if [ -n "${var5}" ]; then defaults write "${ENROLLMENT_PLIST}" Brand -string "${var5}" fi if [ -n "${var6}" ]; then defaults write "${ENROLLMENT_PLIST}" Site -string "${var6}" fi if [ -n "${var7}" ]; then defaults write "${ENROLLMENT_PLIST}" Adaptation -string "${var7}" fi if [ -n "${8}" ]; then defaults write "${ENROLLMENT_PLIST}" Computername -string "${8}" fi if [ -n "${var9}" ]; then defaults write "${ENROLLMENT_PLIST}" LoginWindowType -string "${var9}" fi RESTARTLOGINWINDOW="${10}" ##################################################################################################### # Add Notify Mechanism to system.login.console ##################################################################################################### if [ -n "${AUTHCHANGER_PARAMETER}" ]; then /usr/local/bin/authchanger ${AUTHCHANGER_PARAMETER} fi ##################################################################################################### # Run DEPNotify Mechanism and fill with initial content ##################################################################################################### DEPNOTIFYLOG="/var/tmp/depnotify.log" echo "Command: Image: /usr/local/vwg/enrollment/logo.png" > "${DEPNOTIFYLOG}" echo "Command: KillCommandFile:" >> "${DEPNOTIFYLOG}" echo "Command: MainTitle: Welcome" >> "${DEPNOTIFYLOG}" echo "Command: MainText: Welcome to the Volkswagen Group DEP Enrollment.\n Please be patient while we configure your device.\n The configuration will take a few minutes." >> "${DEPNOTIFYLOG}" #The duration of configuration process will take a few minutes depending on your network speed. >> /var/tmp/depnotify.log echo "Status: Initializing ..." >> "${DEPNOTIFYLOG}" #say "You can continue with the user creation and the installation will finish up" ## Path to JAMFHelper.app jhPath="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" ## Description passed in from parameter set in the policy Desc="To finalize the setup process! please click ok and create the user with the setup assistant!" DescTitle="Volkswagen Intenetclient" DescHeading="Finalize The Setup Process" ## The new message variable passed to jamfHelper ICON="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/FinderIcon.icns" MSG=$( echo "$Desc" ) TITLE=$( echo "$DescTitle") HEADING=$( echo "$DescHeading") sudo "$jhPath" -windowType utility -icon "$ICON" -title "$TITLE" -heading "$HEADING" -alignHeading center -description "$MSG" -button1 "OK" -defaultButton 1 jamf policy -trigger fvnag #if [ "${RESTARTLOGINWINDOW}" != "No" ]; then # echo "Waiting for Setup Asstistant to terminate" # ##################################################################################################### # # wait for Setup Assistant to terminate # ##################################################################################################### # while : # do # /usr/bin/pgrep -x "Setup Assistant" > /dev/null # if [ $? -ne 0 ]; then # break # fi # sleep 0.5 # done # # echo "Check if Apple Loginwindow is running" # /usr/sbin/lsof -c SecurityAgent | grep "/System/Library/CoreServices/SecurityAgentPlugins/loginwindow.bundle/Contents/MacOS/loginwindow" 2>&1 >/dev/null # if [ $? -eq 0 ]; then # echo "Restart Apple Loginwindow" # /usr/bin/killall loginwindow # else # echo "Apple Loginwindow is not running" # fi #fi set +x echo $(DATE)" | ==== End $PRODUCTNAME ====" exit 0