#!/bin/bash

# Copyright (c) 2022 SUSE LLC
#
# This file is part of cloud-netconfig.
#
# cloud-netconfig 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
# (at your option) any later version.
#
# cloud-netconfig is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cloud-netconfig.  If not, see <http://www.gnu.org/licenses/

# Netconfig wrapper script for cloud-netconfig

SCRIPTDIR=/usr/libexec/cloud-netconfig
IFS="=."
NET_SERVICE=(`systemctl --no-pager -p Id show network.service`)

if [ "${NET_SERVICE[1]}" == "NetworkManager" ]; then
    # handled via NetworkManager dispatch script
    exit 0
fi

exec $SCRIPTDIR/cloud-netconfig
