Skip to content

Commit 804cf4e

Browse files
authored
Merge pull request #34 from wl4g-k8s/master
fix: The problem that the login prompt script will overwrite the PATH & support obtaining multiple internal network card IPs
2 parents 70da895 + 7e71b03 commit 804cf4e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

kainstall-centos.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ EOF
647647
# @Author : lework
648648
# @Desc : ssh login banner
649649
650-
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
650+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\$PATH
651651
shopt -q login_shell && : || return 0
652652
echo -e "\033[0;32m
653653
██╗ ██╗ █████╗ ███████╗
@@ -719,7 +719,7 @@ MEM_INFO="\$(cat /proc/meminfo | awk '/MemTotal:/{total=\$2/1024/1024;next} /Mem
719719
720720
# network
721721
# extranet_ip=" and \$(curl -s ip.cip.cc)"
722-
IP_INFO="\$(ip a | grep glo | awk '{print \$2}' | head -1 | cut -f1 -d/)\${extranet_ip:-}"
722+
IP_INFO="\$(ip a|grep -E '^[0-9]+: em*|^[0-9]+: eno*|^[0-9]+: enp*|^[0-9]+: ens*|^[0-9]+: eth*|^[0-9]+: wlp*' -A2|grep inet|awk -F ' ' '{print $2}'|cut -f1 -d/|xargs echo)"
723723
724724
# Container info
725725
CONTAINER_INFO="\$(sudo /usr/bin/crictl ps -a -o yaml 2> /dev/null | awk '/^ state: /{gsub("CONTAINER_", "", \$NF) ++S[\$NF]}END{for(m in S) printf "%s%s:%s ",substr(m,1,1),tolower(substr(m,2)),S[m]}')Images:\$(sudo /usr/bin/crictl images -q 2> /dev/null | wc -l)"

kainstall-debian.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ MEM_INFO="\$(cat /proc/meminfo | awk '/MemTotal:/{total=\$2/1024/1024;next} /Mem
733733
734734
# network
735735
# extranet_ip=" and \$(curl -s ip.cip.cc)"
736-
IP_INFO="\$(ip a | grep glo | awk '{print \$2}' | head -1 | cut -f1 -d/)\${extranet_ip:-}"
736+
IP_INFO="\$(ip a|grep -E '^[0-9]+: em*|^[0-9]+: eno*|^[0-9]+: enp*|^[0-9]+: ens*|^[0-9]+: eth*|^[0-9]+: wlp*' -A2|grep inet|awk -F ' ' '{print $2}'|cut -f1 -d/|xargs echo)"
737737
738738
# Container info
739739
CONTAINER_INFO="\$(sudo /usr/bin/crictl ps -a -o yaml 2> /dev/null | awk '/^ state: /{gsub("CONTAINER_", "", \$NF) ++S[\$NF]}END{for(m in S) printf "%s%s:%s ",substr(m,1,1),tolower(substr(m,2)),S[m]}')Images:\$(sudo /usr/bin/crictl images -q 2> /dev/null | wc -l)"

kainstall-ubuntu.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ EOF
662662
# @Author : lework
663663
# @Desc : ssh login banner
664664
665-
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
665+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\$PATH
666666
shopt -q login_shell && : || return 0
667667
echo -e "\033[0;32m
668668
██╗ ██╗ █████╗ ███████╗
@@ -734,7 +734,7 @@ MEM_INFO="\$(cat /proc/meminfo | awk '/MemTotal:/{total=\$2/1024/1024;next} /Mem
734734
735735
# network
736736
# extranet_ip=" and \$(curl -s ip.cip.cc)"
737-
IP_INFO="\$(ip a | grep glo | awk '{print \$2}' | head -1 | cut -f1 -d/)\${extranet_ip:-}"
737+
IP_INFO="\$(ip a|grep -E '^[0-9]+: em*|^[0-9]+: eno*|^[0-9]+: enp*|^[0-9]+: ens*|^[0-9]+: eth*|^[0-9]+: wlp*' -A2|grep inet|awk -F ' ' '{print $2}'|cut -f1 -d/|xargs echo)"
738738
739739
# Container info
740740
CONTAINER_INFO="\$(sudo /usr/bin/crictl ps -a -o yaml 2> /dev/null | awk '/^ state: /{gsub("CONTAINER_", "", \$NF) ++S[\$NF]}END{for(m in S) printf "%s%s:%s ",substr(m,1,1),tolower(substr(m,2)),S[m]}')Images:\$(sudo /usr/bin/crictl images -q 2> /dev/null | wc -l)"

0 commit comments

Comments
 (0)