[macOS] Fix automationmodetool and loginwindow issue for macOS14.7 (#10684)

This commit is contained in:
sarathrajsrinivasan
2024-10-02 07:38:03 -07:00
committed by GitHub
parent 0a7abf330f
commit fdbe51d78c
9 changed files with 29 additions and 15 deletions

View File

@@ -9,6 +9,7 @@
echo "Enabling automatic GUI login for the '$USERNAME' user.." echo "Enabling automatic GUI login for the '$USERNAME' user.."
python3 $HOME/bootstrap/kcpassword.py "$PASSWORD" python3 $HOME/bootstrap/kcpassword.py "$PASSWORD"
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME" /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUserScreenLocked -bool false
: ' : '
The MIT License (MIT) The MIT License (MIT)

View File

@@ -50,21 +50,18 @@ done
rm -f ./add-certificate rm -f ./add-certificate
# enable-automationmode-without-authentication # enable-automationmode-without-authentication
brew install expect
retry=10 retry=10
while [[ $retry -gt 0 ]]; do while [[ $retry -gt 0 ]]; do
{ {
osascript <<EOF /usr/bin/expect <<EOF
tell application "Terminal" spawn automationmodetool enable-automationmode-without-authentication
activate expect "password"
do script "automationmodetool enable-automationmode-without-authentication" send "${PASSWORD}\r"
delay 2 expect {
tell application "System Events" "succeeded." { puts "Automation mode enabled successfully"; exit 0 }
keystroke "${PASSWORD}" eof
keystroke return }
end tell
end tell
delay 5
EOF EOF
} && break } && break
@@ -77,9 +74,15 @@ EOF
done done
echo "Getting terminal windows" echo "Getting terminal windows"
term_service=$(launchctl list | grep -i terminal | cut -f3) launchctl_output=$(launchctl list | grep -i terminal || true)
echo "Close terminal windows: gui/501/${term_service}"
launchctl bootout gui/501/${term_service} && sleep 5 if [ -n "$launchctl_output" ]; then
term_service=$(echo "$launchctl_output" | cut -f3)
echo "Close terminal windows: gui/501/${term_service}"
launchctl bootout gui/501/${term_service} && sleep 5
else
echo "No open terminal windows found."
fi
# test enable-automationmode-without-authentication # test enable-automationmode-without-authentication
if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then

View File

@@ -50,3 +50,6 @@ sudo rm -f /usr/local/bin/invoke_tests
# Clean Homebrew downloads # Clean Homebrew downloads
sudo rm -rf /Users/$USER/Library/Caches/Homebrew/downloads/* sudo rm -rf /Users/$USER/Library/Caches/Homebrew/downloads/*
# Uninstall expect used in configure-machine.sh
brew uninstall expect

View File

@@ -178,6 +178,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"

View File

@@ -179,6 +179,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"

View File

@@ -178,6 +178,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"

View File

@@ -180,6 +180,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"

View File

@@ -174,6 +174,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"
@@ -201,6 +202,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
pause_before = "30s" pause_before = "30s"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-windows.sh",
"${path.root}/../scripts/build/install-powershell.sh", "${path.root}/../scripts/build/install-powershell.sh",
"${path.root}/../scripts/build/install-dotnet.sh", "${path.root}/../scripts/build/install-dotnet.sh",
"${path.root}/../scripts/build/install-python.sh", "${path.root}/../scripts/build/install-python.sh",

View File

@@ -176,6 +176,7 @@ build {
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
scripts = [ scripts = [
"${path.root}/../scripts/build/configure-tccdb-macos.sh", "${path.root}/../scripts/build/configure-tccdb-macos.sh",
"${path.root}/../scripts/build/configure-autologin.sh",
"${path.root}/../scripts/build/configure-auto-updates.sh", "${path.root}/../scripts/build/configure-auto-updates.sh",
"${path.root}/../scripts/build/configure-ntpconf.sh", "${path.root}/../scripts/build/configure-ntpconf.sh",
"${path.root}/../scripts/build/configure-shell.sh" "${path.root}/../scripts/build/configure-shell.sh"