diff --git a/board/common/rootfs/bin/hostnm b/board/common/rootfs/bin/hostnm new file mode 100755 index 00000000..0875be2a --- /dev/null +++ b/board/common/rootfs/bin/hostnm @@ -0,0 +1,16 @@ +#!/bin/sh +# Changes hostname in /etc/hostname and /etc/hosts + +current=$(cat /etc/hostname) +newname=$1 + +[ -n "$newname" ] || exit 1 + +sed -i "s/$current/$newname/" /etc/hosts +sed -i "s/$current/$newname/" /etc/hostname + +hostname $newname + +initctl touch sysklogd +initctl touch dnsmasq +initctl reload