github.com/inloco/packer@v1.3.2/examples/alicloud/chef/user_data.sh (about)

     1  HOSTNAME=`ifconfig eth1|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
     2  if [ not $HOSTNAME ] ; then
     3      HOSTNAME=`ifconfig eth0|grep 'inet addr'|cut -d ":" -f2|cut -d " " -f1`
     4  fi
     5  hostname $HOSTNAME
     6  chef-server-ctl  reconfigure