diff --git a/install-mac.sh b/install-mac.sh index 26cb1ec..9a15943 100755 --- a/install-mac.sh +++ b/install-mac.sh @@ -42,6 +42,16 @@ mkdir -p $HOME/git/private # Activate asimov to automatically exclude node_modules from TM backup sudo brew services start asimov +read -p "Enter a name for your MacBook, typically 'MacBook YOURNAME' [default: MacBook cb.]: " computername +computername=${computername:-MacBook cb.} +echo "Setting hostname to $computername" + +# Set computer name (as done via System Preferences → Sharing) +sudo scutil --set ComputerName "$computername" +sudo scutil --set HostName "$computername" +sudo scutil --set LocalHostName "$computername" +sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$computername" + # Set macOS preferences - we will run this last because this will reload the shell source ${DOTFILES}/macos/.macos diff --git a/macos/.macos b/macos/.macos index c9646be..40a9ee1 100644 --- a/macos/.macos +++ b/macos/.macos @@ -17,12 +17,6 @@ while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # General UI/UX # ############################################################################### -# Set computer name (as done via System Preferences → Sharing) -sudo scutil --set ComputerName "MacBook Tobias" -sudo scutil --set HostName "MacBook Tobias" -sudo scutil --set LocalHostName "MacBook Tobias" -sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "MacBook Tobias" - # Disable the sound effects on boot sudo nvram SystemAudioVolume=" "