[type/__interface_ifcfg] Add --type parameter

This commit is contained in:
Dennis Camera 2020-08-31 14:17:38 +02:00
parent 71f5fbad14
commit f464b382a6
4 changed files with 17 additions and 0 deletions

View file

@ -17,6 +17,10 @@ REQUIRED PARAMETERS
------------------- -------------------
bootproto bootproto
... ...
type
The type of the interface, e.g. ``Ethernet``, ``Bridge``, ``Dummy``,
``Loopback``.
Defaults to ``Ethernet``.
OPTIONAL PARAMETERS OPTIONAL PARAMETERS

View file

@ -61,6 +61,7 @@ fi
state_should=$(cat "${__object:?}/parameter/state") state_should=$(cat "${__object:?}/parameter/state")
bootproto=$(cat "${__object:?}/parameter/bootproto") bootproto=$(cat "${__object:?}/parameter/bootproto")
onchange=$(cat "${__object:?}/parameter/onchange") onchange=$(cat "${__object:?}/parameter/onchange")
iftype=$(cat "${__object:?}/parameter/type")
ifcfg_file="${NETWORK_SCRIPTS_DIR:?}/ifcfg-${__object_id:?}" ifcfg_file="${NETWORK_SCRIPTS_DIR:?}/ifcfg-${__object_id:?}"
@ -108,6 +109,8 @@ onchange_action() {
case $systype case $systype
in in
(redhat) (redhat)
opt_format TYPE "${iftype}"
for _param in onboot hotplug for _param in onboot hotplug
do do
_key=$(param2var "${_param}") _key=$(param2var "${_param}")
@ -116,6 +119,14 @@ onchange_action() {
unset _param _key unset _param _key
;; ;;
(suse) (suse)
iftype=$(echo "${iftype}" | tr '[:upper:]' '[:lower:]')
if test "${iftype}" = 'loopback' -o "${iftype}" = 'dummy'
then
# Only use INTERFACETYPE for lo/dummy.
# cf. /usr/share/YaST2/modules/NetworkInterfaces.rb
opt_format INTERFACETYPE "${iftype}"
fi
_startmode=manual _startmode=manual
if test -f "${__object:?}/parameter/onboot" if test -f "${__object:?}/parameter/onboot"

View file

@ -0,0 +1 @@
Ethernet

View file

@ -1 +1,2 @@
bootproto bootproto
type