Commit 8d01d9f2 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Rename networking drivers for debian & redhat

Rename debian.sh to ifupdown.sh and redhat.sh to ifcfg.sh. This is done
to make things more clear in case we add more network drivers that do
apply to Debian and RedHat like a driver for NetworkManager.
parent 7538331f
......@@ -290,6 +290,22 @@ get_distro() {
fi
}
get_networking_tool() {
local root_dir distro tool
root_dir=$1
distro=$(get_base_distro "$root_dir")
if [ "$distro" = debian ]; then
tool=ifupdown
elif [ "$distro" = redhat ]; then
tool=ifcfg
else
tool=$distro
fi
echo "@networkingdir@/$tool.sh"
}
get_partition_table() {
local dev output
dev="$1"
......
networkingdir=$(libdir)/$(PACKAGE)/networking
dist_networking_SCRIPTS = debian.sh redhat.sh freebsd.sh openbsd.sh netbsd.sh
dist_networking_SCRIPTS = ifupdown.sh ifcfg.sh freebsd.sh openbsd.sh netbsd.sh
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
......
......@@ -42,9 +42,9 @@ fi
# Check if the image overwrites the task
check_if_overwritten
distro=$(get_base_distro "$SNF_IMAGE_TARGET")
networking_tool=$(get_networking_tool "$SNF_IMAGE_TARGET")
if [ ! -f "@networkingdir@/$distro.sh" ]; then
if [ ! -f "$networking_tool" ]; then
warn "Don't know how to configure the network for this OS"
exit 0
fi
......@@ -52,7 +52,7 @@ fi
export SNF_IMAGE_TARGET
# Initialize the driver
"@networkingdir@/$distro.sh" -i
"$networking_tool" -i
for index in $(seq 0 $((SNF_IMAGE_NIC_COUNT-1))); do
dhcp=no
......@@ -129,12 +129,12 @@ for index in $(seq 0 $((SNF_IMAGE_NIC_COUNT-1))); do
fi
fi
"@networkingdir@/$distro.sh" $ARGS
"$networking_tool" $ARGS
done
# Finalize the driver
"@networkingdir@/$distro.sh" -f
"$networking_tool" -f
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment