From 910309655e71878a40187433f9d80e323ed3a643 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 25 Jul 2023 22:05:08 -0500 Subject: [PATCH] Update linupx-scripts.sh --- linupx-scripts.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/linupx-scripts.sh b/linupx-scripts.sh index 206727c..cbba395 100755 --- a/linupx-scripts.sh +++ b/linupx-scripts.sh @@ -3,7 +3,7 @@ action="$1" FOLDER='/opt/idssys/linupx' -VERS='6.2-07172023' +VERS='6.5-07252023' if [ -d /opt/idssys/settings ]; then [ $(ls /opt/idssys/settings | wc -l) -eq 0 ] && rm -rf /opt/idssys/settings @@ -690,6 +690,28 @@ UPDATEREPOKEYS(){ } RECONFIGURE_NETWORK(){ + + if [ -f /etc/netplan/99-netcfg-* ]; then + echo -en "${idsCL[LightYellow]}New VM Detected, fixing netplan: " + rm -f /etc/netplan/*.yaml >/dev/null 2>&1 + [ -f /etc/netplan/eth0* ] && mv /etc/netplan/eth0* /etc/netplan/eth0.yaml >/dev/null 2>&1 + if [ ! -f /etc/netplan/eth0.yaml ]; then + echo -e "network: + version: 2 + renderer: networkd + ethernets: + eth0: + dhcp4: no + addresses: [10.10.4.20/16] + gateway4: 10.10.0.1 + nameservers: + addresses: [10.10.10.10,10.10.10.11] +" > /etc/netplan/eth0.yaml >/dev/null 2>&1 + fi + netplan apply >/dev/null 2>&1 + echo "${idsCL[Green]}Done${idsCL[Default]}\n\n" + fi + echo -en "\n${idsCL[LightCyan]}Would you like to configure the hostname and network settings (y/N)? ${idsCL[Default]}" read choice case "$choice" in @@ -748,23 +770,7 @@ RECONFIGURE_NETWORK(){ *) echo -en "${idsCL[LightCyan]}Making configuration changes ... ${idsCL[Default]}" - if [ -f /etc/netplan/99-netcfg-* ]; then - rm -f /etc/netplan/*.yaml >/dev/null 2>&1 - [ -f /etc/netplan/eth0* ] && mv /etc/netplan/eth0* /etc/netplan/eth0.yaml - if [ ! -f /etc/netplan/eth0.yaml ]; then - echo -e "network: - version: 2 - renderer: networkd - ethernets: - eth0: - dhcp4: no - addresses: [10.5.4.20/20] - gateway4: 10.5.1.1 - nameservers: - addresses: [10.10.10.10,10.10.10.11] -" > /etc/netplan/eth0.yaml - fi - fi + hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1 sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1