Skip to content

Instantly share code, notes, and snippets.

@killfill
Created February 5, 2014 11:05
Show Gist options
  • Save killfill/8821283 to your computer and use it in GitHub Desktop.
Save killfill/8821283 to your computer and use it in GitHub Desktop.
#Parse sysinfo output
eval $(/usr/bin/sysinfo -f -p | sed -e "s/^/SYSINFO_/")
#Config hostname
hostname your_hostname
#Setup hostname
eval "ipaddr=\${SYSINFO_Network_Interface_${SYSINFO_NIC_admin}_IPv4_Address}"
hostname > /etc/nodename
sed -i.bak "/${ipaddr}/d" /etc/hosts
printf "${ipaddr}\t$(hostname)\n" >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment