Skip to content

Instantly share code, notes, and snippets.

@bryanwb
Created April 19, 2013 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwb/5419180 to your computer and use it in GitHub Desktop.
Save bryanwb/5419180 to your computer and use it in GitHub Desktop.
#
cat <<EOF > ${rootfs_path}/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
DHCP_HOSTNAME="\$(if [ ! -z \`cat /etc/hostname\` ] ; then cat /etc/hostname ; else hostname ; fi )"
EOF
# result should be
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
DHCP_HOSTNAME=$(if [ ! -z `cat /etc/hostname` ] ; then cat /etc/hostname ; else hostname ; fi )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment