From 6a6e45e62ca1c9f89fc63fb58c8de62ad1393703 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Sat, 3 Jun 2023 14:29:56 +0800 Subject: [PATCH] Update build_nat_network.sh --- scripts/build_nat_network.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build_nat_network.sh b/scripts/build_nat_network.sh index 6023878..81b0b0b 100644 --- a/scripts/build_nat_network.sh +++ b/scripts/build_nat_network.sh @@ -31,7 +31,9 @@ fi IPV4=$(ip -4 addr show | grep global | awk '{print $2}' | cut -d '/' -f1 | head -n 1) # 查询信息 -apt-get install lshw -y +if ! command -v lshw > /dev/null 2>&1; then + apt-get install -y lshw +fi interface=$(lshw -C network | awk '/logical name:/{print $3}' | head -1) if [ -z "$interface" ]; then interface="eth0"