2011-01-14 15:16:11 +00:00
if [ ! -r /etc/redhat-release ] || ! grep "release 6" /etc/redhat-release >/dev/null; then
exit 0; #only rhel6 supported
fi
if [ -r /sys/devices/virtual/dmi/id/product_uuid ] ; then
duid = 'default-duid "\000\004' ;
2012-03-06 15:55:18 +00:00
for i in ` sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/;s/-//g;s/\(..\)/\1 /g' /sys/devices/virtual/dmi/id/product_uuid` ; do
2011-01-14 15:16:11 +00:00
num = ` printf "%d" 0x$i `
octnum = ` printf "\\%03o" 0x$i `
2011-05-17 13:54:48 +00:00
#Instead of hoping to be inside printable case, just make them all octal codes
# if [ $num -lt 127 -a $num -gt 34 ]; then
# octnum=`printf $octnum`
# fi
2011-01-14 15:16:11 +00:00
duid = $duid $octnum
done
duid = $duid '";'
2014-06-14 15:51:41 +00:00
#for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do
for interface in ` ip -4 -oneline link show| grep -i ether | awk -F ":" '{print $2}' | grep -o "[^ ]\+\( \+[^ ]\+\)*" ` ; do
2011-01-14 15:16:11 +00:00
echo $duid > /var/lib/dhclient/dhclient6-$interface .leases
done
echo $duid > /var/lib/dhclient/dhclient6.leases
fi