Update linupx-scripts.sh
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
action="$1"
|
action="$1"
|
||||||
FOLDER='/opt/idssys/linupx'
|
FOLDER='/opt/idssys/linupx'
|
||||||
VERS='6.7-08122023'
|
VERS='6.8-08122023'
|
||||||
|
|
||||||
if [ -d /opt/idssys/settings ]; then
|
if [ -d /opt/idssys/settings ]; then
|
||||||
[ $(ls /opt/idssys/settings | wc -l) -eq 0 ] && rm -rf /opt/idssys/settings
|
[ $(ls /opt/idssys/settings | wc -l) -eq 0 ] && rm -rf /opt/idssys/settings
|
||||||
@@ -711,6 +711,31 @@ RECONFIGURE_NETWORK(){
|
|||||||
fi
|
fi
|
||||||
netplan apply >/dev/null 2>&1
|
netplan apply >/dev/null 2>&1
|
||||||
echo "${idsCL[Green]}Done${idsCL[Default]}\n\n"
|
echo "${idsCL[Green]}Done${idsCL[Default]}\n\n"
|
||||||
|
|
||||||
|
elif grep /etc/sysconfig/network-scripts/ifcfg-eth0 -e "Generated by VMWare" >/dev/null; then
|
||||||
|
rm -f /etc/sysconfig/network-scripts/ifcfg-eth0 >/dev/null 2>&1
|
||||||
|
echo -e "TYPE=Ethernet
|
||||||
|
PROXY_METHOD=none
|
||||||
|
BROWSER_ONLY=no
|
||||||
|
BOOTPROTO=none
|
||||||
|
DEFROUTE=yes
|
||||||
|
IPV4_FAILURE_FATAL=no
|
||||||
|
IPV6INIT=no
|
||||||
|
NAME="eth0"
|
||||||
|
UUID=43def898-c3e6-402b-ad94-e8047a2c2a63
|
||||||
|
DEVICE="eth0"
|
||||||
|
ONBOOT=yes
|
||||||
|
IPADDR=10.10.4.20
|
||||||
|
PREFIX=16
|
||||||
|
GATEWAY=10.10.0.1
|
||||||
|
DNS1=10.10.10.10
|
||||||
|
DNS2=10.10.10.11
|
||||||
|
DOMAIN="scity.us schroedercity.com"
|
||||||
|
IPV6_DISABLED=yes
|
||||||
|
" > /etc/sysconfig/network-scripts/ifcfg-eth0 >/dev/null 2>&1
|
||||||
|
|
||||||
|
/usr/bin/nmcli connection up ETH0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -en "\n${idsCL[LightCyan]}Would you like to configure the hostname and network settings (y/N)? ${idsCL[Default]}"
|
echo -en "\n${idsCL[LightCyan]}Would you like to configure the hostname and network settings (y/N)? ${idsCL[Default]}"
|
||||||
@@ -771,30 +796,41 @@ RECONFIGURE_NETWORK(){
|
|||||||
*)
|
*)
|
||||||
echo -en "${idsCL[LightCyan]}Making configuration changes ... ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}Making configuration changes ... ${idsCL[Default]}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1
|
hostnamectl set-hostname ${HOSTNAME} >/dev/null 2>&1
|
||||||
sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1
|
sed -i '/127.0.1.1/d' /etc/hosts >/dev/null 2>&1
|
||||||
[ "${DOMAIN}" == "" ] && echo "127.0.1.1 ${HOSTNAME}" >> /etc/hosts || echo "127.0.1.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME}" >> /etc/hosts
|
sed -i '/::1/d' /etc/hosts >/dev/null 2>&1
|
||||||
|
|
||||||
NEWSUB=`IPprefix_by_netmask ${SUBNET}`
|
NEWSUB=`IPprefix_by_netmask ${SUBNET}`
|
||||||
REPSUB=`IPprefix_by_netmask ${REPSUB}`
|
REPSUB=`IPprefix_by_netmask ${REPSUB}`
|
||||||
sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
[ "${DOMAIN}" == "" ] && echo "127.0.1.1 ${HOSTNAME}" >> /etc/hosts || echo "127.0.1.1 ${HOSTNAME}.${DOMAIN} ${HOSTNAME}" >> /etc/hosts
|
||||||
sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
|
||||||
|
if [ -f /etc/netplan/eth0.yaml ]; then
|
||||||
|
sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
||||||
|
sed -i "s/${REPIP}\/${REPSUB}/${IPADDRESS}\/${NEWSUB}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
||||||
|
|
||||||
[ "${SECDNS}" != "" ] && DNS="${PRIDNS},${SECDNS}" || DNS="${PRIDNS}"
|
[ "${SECDNS}" != "" ] && DNS="${PRIDNS},${SECDNS}" || DNS="${PRIDNS}"
|
||||||
[ "${REPSECDNS}" != "" ] && REPDNS="${REPPRIDNS},${REPSECDNS}" || REPDNS="${REPPRIDNS}"
|
[ "${REPSECDNS}" != "" ] && REPDNS="${REPPRIDNS},${REPSECDNS}" || REPDNS="${REPPRIDNS}"
|
||||||
sed -i "s/${REPDNS}/${DNS}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
sed -i "s/${REPDNS}/${DNS}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
||||||
|
|
||||||
sed -i "s/${REPGW}/${GATEWAY}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
sed -i "s/${REPGW}/${GATEWAY}/g" /etc/netplan/eth0.yaml >/dev/null 2>&1
|
||||||
|
|
||||||
sed -i '/search/d' /etc/netplan/eth0.yaml >/dev/null 2>&1
|
sed -i '/search/d' /etc/netplan/eth0.yaml >/dev/null 2>&1
|
||||||
if [ "${DOMAIN}" != "" ]; then
|
if [ "${DOMAIN}" != "" ]; then
|
||||||
echo " search: [${DOMAIN}]" >> /etc/netplan/eth0.yaml
|
echo " search: [${DOMAIN}]" >> /etc/netplan/eth0.yaml
|
||||||
|
fi
|
||||||
|
|
||||||
|
netplan apply
|
||||||
|
|
||||||
|
elif [ -f /etc/sysconfig/network-scripts/ifcfg-eth0 ]; then
|
||||||
|
/usr/bin/nmcli connection modify ETH0 ipv4.addresses ${IPADDRESS}/${NEWSUB}
|
||||||
|
|
||||||
|
/usr/bin/nmcli connection modify ETH0 ipv4.dns "${PRIDNS}"
|
||||||
|
[ "${SECDNS}" != "" ] && nmcli connection modify ETH0 ipv4.dns "${SECDNS}"
|
||||||
|
|
||||||
|
/usr/bin/nmcli connection modify ETH0 ipv4.gateway ${GATEWAY}
|
||||||
|
|
||||||
|
/usr/bin/nmcli connection up ETH0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
netplan apply
|
|
||||||
|
|
||||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user