Add function to set hostname on osx.
This commit is contained in:
parent
a0ade716a2
commit
7d95670717
@ -166,3 +166,12 @@ function git_reset_author() {
|
||||
local filter_branch_command="$should_update_command"' && '"$update_command"' || test true'
|
||||
git filter-branch -f --env-filter $filter_branch_command -- --all
|
||||
}
|
||||
|
||||
function set_osx_hostname() {
|
||||
local new_hostname="$1"
|
||||
test -z new_hostname && new_hostname="IvansMac"
|
||||
sudo scutil --set ComputerName $new_hostname
|
||||
sudo scutil --set HostName $new_hostname
|
||||
sudo scutil --set LocalHostName $new_hostname
|
||||
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $new_hostname
|
||||
}
|
||||
|
@ -11,10 +11,7 @@ while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
###############################################################################
|
||||
|
||||
# Set computer name (as done via System Preferences → Sharing)
|
||||
sudo scutil --set ComputerName "IvansMac"
|
||||
sudo scutil --set HostName "IvanMalison"
|
||||
sudo scutil --set LocalHostName "IvanMalison"
|
||||
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "IvanMalison"
|
||||
set_osx_hostname
|
||||
|
||||
# Menu bar: disable transparency
|
||||
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
|
||||
|
Loading…
Reference in New Issue
Block a user