summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-scripts/net.modules.d/rename')
-rw-r--r--net-scripts/net.modules.d/rename18
1 files changed, 9 insertions, 9 deletions
diff --git a/net-scripts/net.modules.d/rename b/net-scripts/net.modules.d/rename
index 2e531b1..a02f17c 100644
--- a/net-scripts/net.modules.d/rename
+++ b/net-scripts/net.modules.d/rename
@@ -22,36 +22,36 @@ rename_pre_start() {
interface_exists "${iface}" || return 0
- eval newname=\"\$\{rename_${ifvar}\}\"
- [[ -z ${newname} || ${iface} == "${newname}" ]] && return 0
+ newname="rename_${ifvar}"
+ [[ -z ${!newname} || ${iface} == "${!newname}" ]] && return 0
# We cannot rename vlan interfaces as /proc/net/vlan/config always
# returns the old interface name. We don't bail out though as it's
# not critical that the interface gets renamed.
if [[ -d /proc/net/vlan/config ]] ; then
- if grep -q "^eth0.2 " /proc/net/vlan/config ; then
+ if grep -q "^${iface} " /proc/net/vlan/config ; then
eerror "Cannot rename VLAN interfaces"
return 0
fi
fi
- ebegin "Renaming \"${iface}\" to \"${newname}\""
+ ebegin "Renaming \"${iface}\" to \"${!newname}\""
# Ensure that we have an init script
- [[ ! -e "/etc/init.d/net.${newname}" ]] \
- && ( cd /etc/init.d ; ln -s net.lo "net.${newname}" )
+ [[ ! -e "/etc/init.d/net.${!newname}" ]] \
+ && ( cd /etc/init.d ; ln -s net.lo "net.${!newname}" )
# Ensure that the interface is down and without any addresses or we
# will not work
interface_del_addresses "${iface}"
interface_down "${iface}"
- interface_set_name "${iface}" "${newname}"
- eend "$?" "Failed to rename interface" || return 1
+ interface_set_name "${iface}" "${!newname}"
+ eend $? "Failed to rename interface" || return 1
# Mark us as stopped, start the new interface and bail cleanly
mark_service_stopped "net.${iface}"
einfo "Stopped configuration of ${iface} due to renaming"
- service_stopped "net.${newname}" && start_service "net.${newname}"
+ service_stopped "net.${!newname}" && start_service "net.${!newname}"
exit 1
}