blob: 6e4ba365e07ae2cc37a8351d634f7986a8850ee6 [file] [log] [blame]
#!/bin/bash
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[ -n "${gbmc_net_lib_init-}" ] && return
gbmc_net_networkd_reload() {
if [ "$(systemctl is-active systemd-networkd)" != 'inactive' ]; then
echo "Reloading networkd + reconfiguring ($*) from $(caller 0)" >&2
networkctl reload || return
local st=0
local intf
for intf in "$@"; do
networkctl reconfigure "$intf" || st=$?
done
return $st
fi
}
gbmc_net_lib_init=1