mirror of
https://github.com/leitbogioro/Tools.git
synced 2024-11-16 06:05:33 +08:00
Update InstallNET.sh
This commit is contained in:
parent
34609cf846
commit
aea4acb911
1 changed files with 6 additions and 2 deletions
|
@ -519,6 +519,10 @@ function checkSys(){
|
|||
CurrentOS="Vzlinux"
|
||||
elif [[ `echo "$RedHatRelease" | grep -i 'ol\|oracle'` != "" ]]; then
|
||||
CurrentOS="OracleLinux"
|
||||
elif [[ `echo "$RedHatRelease" | grep -i 'opencloudos'` != "" ]]; then
|
||||
CurrentOS="OpenCloudOS"
|
||||
elif [[ `echo "$RedHatRelease" | grep -i 'alibaba\|aliyun'` != "" ]]; then
|
||||
CurrentOS="AlibabaCloudLinux"
|
||||
elif [[ "$IsUbuntu" ]] || [[ `echo "$DebianRelease" | grep -i "ubuntu"` != "" ]]; then
|
||||
CurrentOS="Ubuntu"
|
||||
CurrentOSVer=`lsb_release -r | awk '{print$2}' | cut -d'.' -f1`
|
||||
|
@ -577,7 +581,7 @@ function getInterface(){
|
|||
if [[ "$1" == 'Ubuntu' ]] && [[ "$2" -ge "18" ]]; then
|
||||
NetCfgDir="/etc/netplan/"
|
||||
NetCfgFile=`ls -Sl $NetCfgDir | grep ".yaml" | head -n 1 | awk -F' ' '{print $NF}'`
|
||||
elif [[ "$1" == 'CentOS' || "$1" == 'AlmaLinux' || "$1" == 'RockyLinux' || "$1" == 'Fedora' || "$1" == 'Vzlinux' || "$1" == 'OracleLinux' ]]; then
|
||||
elif [[ "$1" == 'CentOS' || "$1" == 'AlmaLinux' || "$1" == 'RockyLinux' || "$1" == 'Fedora' || "$1" == 'Vzlinux' || "$1" == 'OracleLinux' || "$1" == 'OpenCloudOS' || "$1" == 'AlibabaCloudLinux' ]]; then
|
||||
for Count in "/etc/sysconfig/network-scripts/" "/etc/NetworkManager/system-connections/" "/run/NetworkManager/system-connections/" "/usr/lib/NetworkManager/system-connections/" "/run/sysconfig/network-scripts/" "/run/network-scripts/" "/usr/lib/sysconfig/network-scripts/" "/usr/lib/network-scripts/"; do
|
||||
NetCfgDir="$Count"
|
||||
NetCfgFile=`ls -Sl $NetCfgDir | grep "nmconnection\|ifcfg-*" | grep -iv 'lo\|sit\|stf\|gif\|dummy\|vmnet\|vir\|gre\|ipip\|ppp\|bond\|tun\|tap\|ip6gre\|ip6tnl\|teql\|ocserv\|vpn' | head -n 1 | awk -F' ' '{print $NF}'`
|
||||
|
@ -600,7 +604,7 @@ function getInterface(){
|
|||
# $1 is $CurrentOS $2 is $CurrentOSVer
|
||||
function checkDHCP(){
|
||||
getInterface "$CurrentOS" "$CurrentOSVer"
|
||||
if [[ "$1" == 'CentOS' || "$1" == 'AlmaLinux' || "$1" == 'RockyLinux' || "$1" == 'Fedora' || "$1" == 'Vzlinux' || "$1" == 'OracleLinux' ]]; then
|
||||
if [[ "$1" == 'CentOS' || "$1" == 'AlmaLinux' || "$1" == 'RockyLinux' || "$1" == 'Fedora' || "$1" == 'Vzlinux' || "$1" == 'OracleLinux' || "$1" == 'OpenCloudOS' || "$1" == 'AlibabaCloudLinux' ]]; then
|
||||
# RedHat like linux system 8 and before network config name is "ifcfg-interface", deposited in /etc/sysconfig/network-scripts/
|
||||
# RedHat like linux system 9 and later network config name is "interface.nmconnection", deposited in /etc/NetworkManager/system-connections
|
||||
if [[ -n `grep -Ewrn "BOOTPROTO=none|BOOTPROTO=\"none\"|BOOTPROTO=\'none\'|BOOTPROTO=NONE|BOOTPROTO=\"NONE\"|BOOTPROTO=\'NONE\'|BOOTPROTO=static|BOOTPROTO=\"static\"|BOOTPROTO=\'static\'|BOOTPROTO=STATIC|BOOTPROTO=\"STATIC\"|BOOTPROTO=\'STATIC\'" $NetCfgDir*` ]] || [[ -n `grep -Ewrn "method=manual" $NetCfgDir*` ]] || [[ "$tmpDHCP" == "static" || "$tmpDHCP" == "manual" || "$tmpDHCP" == "none" || "$tmpDHCP" == "false" || "$tmpDHCP" == "no" || "$tmpDHCP" == "0" ]]; then
|
||||
|
|
Loading…
Reference in a new issue