Merge pull request #398 from f0o/issue-397

Added ifAlias support for various distributions
This commit is contained in:
Neil Lathwood
2015-01-08 09:34:30 +00:00
+25 -2
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# (c) 2013, f0o@devilcode.org
# (c) 2013, 2014, f0o@devilcode.org
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@@ -45,6 +45,29 @@ if [ "X${IFACE}" = "X" ]; then
echo noSuchName
else
echo "string"
echo $(grep "^# $IFACE:" /etc/network/interfaces | sed "s/^# $IFACE: //")
if [ -x /usr/bin/distro ]; then
case $(distro | cut -d " " -f 1) in
Debian)
cnf="/etc/network/interfaces"
;;
Gentoo)
cnf="/etc/conf.d/net"
;;
CentOS|RedHat|SuSE|Mandriva|Mandrake)
cnf="/etc/sysconfig/network-scripts/ifcfg-$IFACE"
;;
Archlinux)
cnf="/etc/conf.d/net-conf-$IFACE"
;;
*)
cnf=""
;;
esac
fi
if [ -n "$cnf" ]; then
echo $(grep -i "^# $IFACE:" $cnf | sed "s/^# $IFACE: //i")
else
echo
fi
fi
exit 0