mirror of
https://github.com/actions/runner-images.git
synced 2025-12-10 19:16:48 +00:00
[macOS] Fix automationmodetool and loginwindow issue for macOS14.7 (#10684)
This commit is contained in:
committed by
GitHub
parent
0a7abf330f
commit
fdbe51d78c
@@ -9,6 +9,7 @@
|
||||
echo "Enabling automatic GUI login for the '$USERNAME' user.."
|
||||
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 autoLoginUserScreenLocked -bool false
|
||||
|
||||
: '
|
||||
The MIT License (MIT)
|
||||
|
||||
@@ -50,21 +50,18 @@ done
|
||||
rm -f ./add-certificate
|
||||
|
||||
# enable-automationmode-without-authentication
|
||||
|
||||
brew install expect
|
||||
retry=10
|
||||
while [[ $retry -gt 0 ]]; do
|
||||
{
|
||||
osascript <<EOF
|
||||
tell application "Terminal"
|
||||
activate
|
||||
do script "automationmodetool enable-automationmode-without-authentication"
|
||||
delay 2
|
||||
tell application "System Events"
|
||||
keystroke "${PASSWORD}"
|
||||
keystroke return
|
||||
end tell
|
||||
end tell
|
||||
delay 5
|
||||
/usr/bin/expect <<EOF
|
||||
spawn automationmodetool enable-automationmode-without-authentication
|
||||
expect "password"
|
||||
send "${PASSWORD}\r"
|
||||
expect {
|
||||
"succeeded." { puts "Automation mode enabled successfully"; exit 0 }
|
||||
eof
|
||||
}
|
||||
EOF
|
||||
} && break
|
||||
|
||||
@@ -77,9 +74,15 @@ EOF
|
||||
done
|
||||
|
||||
echo "Getting terminal windows"
|
||||
term_service=$(launchctl list | grep -i terminal | cut -f3)
|
||||
echo "Close terminal windows: gui/501/${term_service}"
|
||||
launchctl bootout gui/501/${term_service} && sleep 5
|
||||
launchctl_output=$(launchctl list | grep -i terminal || true)
|
||||
|
||||
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
|
||||
if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
|
||||
|
||||
@@ -50,3 +50,6 @@ sudo rm -f /usr/local/bin/invoke_tests
|
||||
|
||||
# Clean Homebrew downloads
|
||||
sudo rm -rf /Users/$USER/Library/Caches/Homebrew/downloads/*
|
||||
|
||||
# Uninstall expect used in configure-machine.sh
|
||||
brew uninstall expect
|
||||
|
||||
@@ -178,6 +178,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
|
||||
@@ -179,6 +179,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
|
||||
@@ -178,6 +178,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
|
||||
@@ -180,6 +180,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
|
||||
@@ -174,6 +174,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
@@ -201,6 +202,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
||||
pause_before = "30s"
|
||||
scripts = [
|
||||
"${path.root}/../scripts/build/configure-windows.sh",
|
||||
"${path.root}/../scripts/build/install-powershell.sh",
|
||||
"${path.root}/../scripts/build/install-dotnet.sh",
|
||||
"${path.root}/../scripts/build/install-python.sh",
|
||||
|
||||
@@ -176,6 +176,7 @@ build {
|
||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}"
|
||||
scripts = [
|
||||
"${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-ntpconf.sh",
|
||||
"${path.root}/../scripts/build/configure-shell.sh"
|
||||
|
||||
Reference in New Issue
Block a user