08-07-2012 fixed a few typos and problems with quotes.
01-29-2012 added some variables to check for the existence of things and get correct paths.
01-06-2012 fixed hostname path.
01-02-2012 Updated to truly work on all devices.
Check it out and let me know what you think.
Big thanks to cdesai for pointing out a nice little enhancement.
This is version 5 of this script.
This script is designed to change the hostname of your device so that you can access it through your network by name instead of android_0123456789ABCEDF.
Your device will also be able to be seen at your router by the new name as well.
#!/system/bin/sh #change devName to whatever you want. devName="changeMe" #random variables devHostPath=$(which hostname) devGetPath=$(which getprop) devSetPath=$(which setprop) if [ "$($devGetPath net.hostname)" = "$devName" ] then echo "Device hostname does not need to be changed." else echo "Device hostname is being changed to $devName." $devHostPath $devName $devSetPath net.hostname $devName if [ "$($devGetPath net.hostname)" != "$devName" ] then echo "Device hostname has not been changed." else echo "Device hostname has been successfully changed." fi fi
- Download Hostname.sh to your device.
- Use a text editor to change the "changeMe" in the script to whatever you want. [Keep the quotes]
- Use Script Manager to run the script.
- The script output will tell you if the command has completed successfully.
Once it has been run your device will be named whatever you change the "changeMe" to.
*Additionally, this script should be able to be run on any device without issues but I have only tested this on Galaxy Nexus AOKP and Droid Bionic Eclipse v3.0.
**Standard disclaimer, I am in no way responsible for ANYTHING that happens to your phone that you have done.
***This code is provided free of charge and is released with no warranty explicit or implied.
If you find this post useful or it helped in any way please hit the thanks button.