-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# .DS_Store files! | ||
.DS_Store | ||
|
||
# our build directory | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>distribution_style</key> | ||
<false/> | ||
<key>identifier</key> | ||
<string>com.github.sphen13.computernametohostname</string> | ||
<key>install_location</key> | ||
<string>/</string> | ||
<key>name</key> | ||
<string>ComputerName to HostName-${version}.pkg</string> | ||
<key>ownership</key> | ||
<string>recommended</string> | ||
<key>postinstall_action</key> | ||
<string>none</string> | ||
<key>suppress_bundle_relocation</key> | ||
<true/> | ||
<key>version</key> | ||
<string>1.1</string> | ||
</dict> | ||
</plist> |
19 changes: 19 additions & 0 deletions
19
ComputerName to HostName/payload/Library/LaunchDaemons/computer-to-hostname.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" | ||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Disabled</key> | ||
<false/> | ||
<key>Label</key> | ||
<string>computer-to-hostname</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>/Library/Scripts/computer-to-hostname.sh</string> | ||
</array> | ||
<key>StartInterval</key> | ||
<integer>43200</integer> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
</dict> | ||
</plist> |
10 changes: 10 additions & 0 deletions
10
ComputerName to HostName/payload/Library/Scripts/computer-to-hostname.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
new_name=`networksetup -getcomputername | sed -e "s/[+=., \"'()]//g"` | ||
|
||
echo "Setting Local DNS Name to: $new_name" | ||
scutil --set LocalHostName $new_name | ||
echo "Setting HostName Name to: $new_name" | ||
scutil --set HostName $new_name | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
## postinstall | ||
|
||
# reload | ||
launchctl unload /Library/LaunchDaemons/computer-to-hostname.plist | ||
launchctl load -w /Library/LaunchDaemons/computer-to-hostname.plist | ||
|
||
exit 0 |