From b088ff7a143b373cf59ea9a624dde14f309b5f05 Mon Sep 17 00:00:00 2001 From: Ing Date: Thu, 8 May 2025 13:09:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=91=BD=E4=BB=A4=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=EF=BC=8C=E4=BD=BF=E7=94=A8=20type=20=E6=9B=BF?= =?UTF-8?q?=E4=BB=A3=20command=20-v=20=E4=BB=A5=E6=8F=90=E9=AB=98=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/data.yml | 3 +-- files/initrd/opt/rr/include/functions.sh | 10 +++++----- localbuild.sh | 2 +- scripts/func.sh | 2 +- sourcebuild.sh | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/data.yml b/.github/workflows/data.yml index f0e981bd..97ed1d6d 100644 --- a/.github/workflows/data.yml +++ b/.github/workflows/data.yml @@ -79,11 +79,10 @@ jobs: sudo pip3 install -U -r scripts/requirements.txt python3 scripts/func.py getmodels -w "rr/ws/initrd" -j "docs/models.json" -x "docs/models.xlsx" + python3 scripts/func.py getpats -w "rr/ws/initrd" -j "docs/pats.json" -x "docs/pats.xlsx" python3 scripts/func.py getaddons -w "rr/ws" -j "docs/addons.json" -x "docs/addons.xlsx" python3 scripts/func.py getmodules -w "rr/ws" -j "docs/modules.json" -x "docs/modules.xlsx" - python3 scripts/func.py getpats -w "rr/ws/initrd" -j "docs/pats.json" -x "docs/pats.xlsx" - - name: Upload to Artifacts if: success() uses: actions/upload-artifact@v4 diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 14398055..11d0fd0f 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -23,10 +23,10 @@ function checkBootLoader() { [ ! -w "${PART1_PATH}" ] && return 1 [ ! -w "${PART2_PATH}" ] && return 1 [ ! -w "${PART3_PATH}" ] && return 1 - command -v awk >/dev/null 2>&1 || return 1 - command -v cut >/dev/null 2>&1 || return 1 - command -v sed >/dev/null 2>&1 || return 1 - command -v tar >/dev/null 2>&1 || return 1 + type awk >/dev/null 2>&1 || return 1 + type cut >/dev/null 2>&1 || return 1 + type sed >/dev/null 2>&1 || return 1 + type tar >/dev/null 2>&1 || return 1 return 0 } @@ -220,7 +220,7 @@ function _set_conf_kv() { # @ - url list function _get_fastest() { local speedlist="" - if command -v ping >/dev/null 2>&1; then + if type ping >/dev/null 2>&1; then for I in "$@"; do speed=$(LC_ALL=C ping -c 1 -W 5 "${I}" 2>/dev/null | awk -F'[= ]' '/time=/ {for(i=1;i<=NF;i++) if ($i=="time") print $(i+1)}') speedlist+="${I} ${speed:-999}\n" # Assign default value 999 if speed is empty diff --git a/localbuild.sh b/localbuild.sh index b75e5efb..4ff3a10f 100755 --- a/localbuild.sh +++ b/localbuild.sh @@ -39,7 +39,7 @@ function create() { sudo apt install -y locales busybox dialog gettext sed gawk jq curl sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils dosfstools cpio xz-utils lz4 lzma bzip2 gzip zstd # sudo snap install yq - if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then + if ! type yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq fi diff --git a/scripts/func.sh b/scripts/func.sh index bbd7e2fc..89cac4c4 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -329,7 +329,7 @@ function createvmx() { local BLIMAGE=${1} local VMNAME=${2} - if ! command -v qemu-img &>/dev/null; then + if ! type qemu-img &>/dev/null; then sudo apt install -y qemu-utils fi diff --git a/sourcebuild.sh b/sourcebuild.sh index 43a6f402..be94e8f6 100755 --- a/sourcebuild.sh +++ b/sourcebuild.sh @@ -9,7 +9,7 @@ # sudo apt install -y locales busybox dialog gettext sed gawk jq curl # sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils dosfstools cpio xz-utils lz4 lzma bzip2 gzip zstd # # sudo snap install yq -# if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then +# if ! type yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then # sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq # fi #