From 35c964473cbbde02539a49c6841e95042e7bb63d Mon Sep 17 00:00:00 2001 From: klzgrad Date: Wed, 20 Nov 2024 19:35:58 +0800 Subject: [PATCH] src/get-openwrt.sh --- src/get-openwrt.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/get-openwrt.sh b/src/get-openwrt.sh index 4ae0056172..547c92fc53 100755 --- a/src/get-openwrt.sh +++ b/src/get-openwrt.sh @@ -15,17 +15,33 @@ arm_*) abi=musl_eabi;; *) abi=musl;; esac -if [ "$subtarget" ]; then - SDK_PATH=openwrt-toolchain-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64 +major=${release%%.*} +if [ "$major" -ge 22 ]; then + path_suffix=toolchain else - subtarget='generic' - SDK_PATH=openwrt-toolchain-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64 + path_suffix=sdk +fi + +if [ ! "$subtarget" ]; then + subtarget=generic +fi + +if [ "$subtarget" != generic -o "$major" -ge 22 ]; then + SDK_PATH=openwrt-$path_suffix-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64 +else + SDK_PATH=openwrt-$path_suffix-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64 fi SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz rm -rf $SDK_PATH curl $SDK_URL | tar xJf - -cd $SDK_PATH + full_root=toolchain-*_gcc-${gcc_ver}_${abi} + +if [ "$major" -lt 22 ]; then + mv $SDK_PATH/staging_dir/$full_root $SDK_PATH +fi + +cd $SDK_PATH cat >include.txt <