mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[macOS] Migrating python 2 scripts to python 3 (#5115)
This commit is contained in:
committed by
GitHub
parent
009a1bea38
commit
c2797f37cd
@@ -4,17 +4,8 @@ OLD_PASSWD="$2"
|
||||
NEW_PASSWD="$3"
|
||||
UPDATE_LOGIN_KEYCHAIN="${4:-true}"
|
||||
|
||||
export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin
|
||||
|
||||
macosver="$(sw_vers | grep ProductVersion | awk {'print $2'})"
|
||||
|
||||
if [[ $macosver =~ 10.13.* ]]; then
|
||||
sudo /usr/bin/dscl . -passwd /Users/$USERNAME "$NEW_PASSWD"
|
||||
else
|
||||
sudo /usr/sbin/sysadminctl -resetPasswordFor $USERNAME -newPassword "$NEW_PASSWD" -adminUser $USERNAME -adminPassword "$OLD_PASSWD"
|
||||
fi
|
||||
|
||||
sudo /usr/bin/python /Users/$USERNAME/bootstrap/kcpassword.py "$NEW_PASSWD"
|
||||
sudo /usr/sbin/sysadminctl -resetPasswordFor $USERNAME -newPassword "$NEW_PASSWD" -adminUser $USERNAME -adminPassword "$OLD_PASSWD"
|
||||
sudo /usr/bin/python3 /Users/$USERNAME/bootstrap/kcpassword.py "$NEW_PASSWD"
|
||||
sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
|
||||
|
||||
if [[ $UPDATE_LOGIN_KEYCHAIN == "true" ]]; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Port of Gavin Brock's Perl kcpassword generator to Python, by Tom Taylor
|
||||
# <tom@tomtaylor.co.uk>.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
echo "Enabling automatic GUI login for the '$USERNAME' user.."
|
||||
|
||||
python $HOME/bootstrap/kcpassword.py "$PASSWORD"
|
||||
python3 $HOME/bootstrap/kcpassword.py "$PASSWORD"
|
||||
|
||||
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF
|
||||
#!/bin/bash -e -o pipefail
|
||||
|
||||
name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')"
|
||||
name="Mac-$(python3 -c 'from time import time; print(int(round(time() * 1000)))')"
|
||||
scutil --set HostName "${name}.local"
|
||||
scutil --set LocalHostName $name
|
||||
scutil --set ComputerName "${name}.local"
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
"type": "shell",
|
||||
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
|
||||
"scripts": [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/add-network-interface-detection.sh",
|
||||
"./provision/configuration/autologin.sh",
|
||||
"./provision/configuration/disable-auto-updates.sh",
|
||||
@@ -129,7 +130,6 @@
|
||||
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
||||
"pause_before": "30s",
|
||||
"scripts": [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/core/homebrew.sh",
|
||||
"./provision/core/open_windows_check.sh",
|
||||
"./provision/core/powershell.sh",
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
"type": "shell",
|
||||
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
|
||||
"scripts": [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/add-network-interface-detection.sh",
|
||||
"./provision/configuration/autologin.sh",
|
||||
"./provision/configuration/disable-auto-updates.sh",
|
||||
@@ -116,7 +117,6 @@
|
||||
"scripts": [
|
||||
"./provision/configuration/preimagedata.sh",
|
||||
"./provision/configuration/configure-ssh.sh",
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/configure-machine.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
|
||||
@@ -98,6 +98,7 @@ build {
|
||||
}
|
||||
provisioner "shell" {
|
||||
scripts = [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/configure-tccdb-macos11.sh",
|
||||
"./provision/configuration/add-network-interface-detection.sh",
|
||||
"./provision/configuration/autologin.sh",
|
||||
@@ -117,7 +118,6 @@ build {
|
||||
scripts = [
|
||||
"./provision/configuration/preimagedata.sh",
|
||||
"./provision/configuration/configure-ssh.sh",
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/configure-machine.sh"
|
||||
]
|
||||
environment_vars = [
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
"type": "shell",
|
||||
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
|
||||
"scripts": [
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/add-network-interface-detection.sh",
|
||||
"./provision/configuration/autologin.sh",
|
||||
"./provision/configuration/disable-auto-updates.sh",
|
||||
@@ -116,7 +117,6 @@
|
||||
"scripts": [
|
||||
"./provision/configuration/preimagedata.sh",
|
||||
"./provision/configuration/configure-ssh.sh",
|
||||
"./provision/core/xcode-clt.sh",
|
||||
"./provision/configuration/configure-machine.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
|
||||
Reference in New Issue
Block a user