touch sysconfig network script when absent

sysconfig network scripts are missing on pure NetworkManager installs.
This commit touches a placeholder to allow the network configuration to
be generated and loaded via NetworkManager.

Signed-off-by: bcambl <blayne@blaynecampbell.com>
This commit is contained in:
bcambl 2021-01-19 22:58:05 -06:00
parent 8e7670db41
commit c6810a0124

View file

@ -997,9 +997,14 @@ setStaticIPv4() {
# if an ifcfg config does not exists for the interface name, try the connection name via network manager # if an ifcfg config does not exists for the interface name, try the connection name via network manager
if is_command nmcli && nmcli general status &> /dev/null; then if is_command nmcli && nmcli general status &> /dev/null; then
CONNECTION_NAME=$(nmcli dev show "${PIHOLE_INTERFACE}" | grep 'GENERAL.CONNECTION' | cut -d: -f2 | sed 's/^System//' | xargs | tr ' ' '_') CONNECTION_NAME=$(nmcli dev show "${PIHOLE_INTERFACE}" | grep 'GENERAL.CONNECTION' | cut -d: -f2 | sed 's/^System//' | xargs | tr ' ' '_')
if [[ -f "/etc/sysconfig/network-scripts/ifcfg-${CONNECTION_NAME}" ]];then
# If it exists,
IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${CONNECTION_NAME} IFCFG_FILE=/etc/sysconfig/network-scripts/ifcfg-${CONNECTION_NAME}
if [[ -f "${IFCFG_FILE}" ]];then
# If it exists,
setIFCFG "${IFCFG_FILE}"
return 0
else
printf " %b Warning: sysconfig network script not found. Creating ${IFCFG_FILE}\\n" "${INFO}"
touch "${IFCFG_FILE}"
setIFCFG "${IFCFG_FILE}" setIFCFG "${IFCFG_FILE}"
return 0 return 0
fi fi