Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new-style device naming from Network Manager on RHEL/CentOS 7 #617

Merged
merged 1 commit into from
Jul 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions scripts/centos/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,36 @@ for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do
fi
done

# new-style network device naming for centos7
if grep -q -i "release 7" /etc/redhat-release ; then
# radio off & remove all interface configration
nmcli radio all off
/bin/systemctl stop NetworkManager.service
for ifcfg in `ls /etc/sysconfig/network-scripts/ifcfg-* |grep -v ifcfg-lo` ; do
rm -f $ifcfg
done
rm -rf /var/lib/NetworkManager/*

echo "==> Setup /etc/rc.d/rc.local for CentOS7"
cat <<_EOF_ | cat >> /etc/rc.d/rc.local
#BENTO-BEGIN
LANG=C
# delete all connection
for con in \`nmcli -t -f uuid con\`; do
if [ "\$con" != "" ]; then
nmcli con del \$con
fi
done
# add gateway interface connection.
gwdev=\`nmcli dev | grep ethernet | egrep -v 'unmanaged' | head -n 1 | awk '{print \$1}'\`
if [ "\$gwdev" != "" ]; then
nmcli c add type eth ifname \$gwdev con-name \$gwdev
fi
sed -i "/^#BENTO-BEGIN/,/^#BENTO-END/d" /etc/rc.d/rc.local
chmod -x /etc/rc.d/rc.local
#BENTO-END
_EOF_
chmod +x /etc/rc.d/rc.local
fi

rm -f VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.?;