From a4aed20499e8ce6aabb1bbf8476f4cfa7ed049ab Mon Sep 17 00:00:00 2001 From: sbwml Date: Wed, 17 Aug 2022 20:17:04 +0800 Subject: [PATCH] install.sh: enable openwrt 19 version support --- install.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 467c3ba..74a3721 100644 --- a/install.sh +++ b/install.sh @@ -25,16 +25,17 @@ CHECK() ( echo -e "\r\n${GREEN_COLOR}Checking available space ...${RES}" ROOT_SPACE=$(df -m /usr | awk 'END{print $4}') if [ $ROOT_SPACE -lt 40 ]; then - echo -e "${RED_COLOR}Error, The system storage space is less than 40MB.${RES}" + echo -e "\r\n${RED_COLOR}Error, The system storage space is less than 40MB.${RES}" exit 1; fi echo -e "\r\n${GREEN_COLOR}Checking platform ...${RES}" prebuilt="aarch64_cortex-a53 aarch64_cortex-a72 aarch64_generic arm_arm1176jzf-s_vfp arm_arm926ej-s arm_cortex-a15_neon-vfpv4 arm_cortex-a5_vfpv4 arm_cortex-a7 arm_cortex-a7_neon-vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_fa526 arm_mpcore arm_xscale i386_pentium-mmx i386_pentium4 mips64_octeonplus mips_24kc mips_4kec mips_mips32 mipsel_24kc mipsel_24kc_24kf mipsel_74kc mipsel_mips32 x86_64" - if [[ "$version" != "21" ]] && [[ "$version" != "22" ]]; then - echo -e "${RED_COLOR}Error! OpenWrt \"$(cat /etc/os-release | grep VERSION_ID | awk -F "[\"\"]" '{print $2}')\" version is not supported.${RES}" + verif=$(expr match "$prebuilt" ".*\($platform\)") + if [ "$version" != 19 -a "$version" != 21 -a "$version" != 22 ]; then + echo -e "\r\n${RED_COLOR}Error! OpenWrt \"$(cat /etc/os-release | grep VERSION_ID | awk -F "[\"\"]" '{print $2}')\" version is not supported.${RES}" exit 1; - elif [[ ! "$prebuilt" =~ "$platform" ]]; then - echo -e "${RED_COLOR}Error! The current \"$platform\" platform is not currently supported.${RES}" + elif [[ ! $verif ]]; then + echo -e "\r\n${RED_COLOR}Error! The current \"$platform\" platform is not currently supported.${RES}" exit 1; fi ) @@ -54,24 +55,24 @@ DOWNLOAD() ( luci_i18n=$(cat $TMPDIR/releases.txt | grep "browser_download_url" | grep luci-i18n-alist-zh-cn | head -1 | awk '{print $2}' | sed 's/\"//g') # download - echo -e "${GREEN_COLOR}Download $alist ...${RES}" + echo -e "${GREEN_COLOR}Downloading $alist ...${RES}" curl --connect-timeout 30 -m 600 -Lo "$TMPDIR/alist_$platform.ipk" $mirror$alist if [ $? -ne 0 ]; then - echo -e "${RED_COLOR}Error! download $alist failed.${RES}" + echo -e "\r\n${RED_COLOR}Error! Download $alist failed.${RES}" rm -rf $TMPDIR exit 1 fi - echo -e "${GREEN_COLOR}Download $luci_app ...${RES}" + echo -e "${GREEN_COLOR}Downloading $luci_app ...${RES}" curl --connect-timeout 30 -m 600 -Lo "$TMPDIR/luci-app-alist.ipk" $mirror$luci_app if [ $? -ne 0 ]; then - echo -e "${RED_COLOR}Error! download $luci_app failed.${RES}" + echo -e "\r\n${RED_COLOR}Error! Download $luci_app failed.${RES}" rm -rf $TMPDIR exit 1 fi - echo -e "${GREEN_COLOR}Download $luci_i18n ...${RES}" + echo -e "${GREEN_COLOR}Downloading $luci_i18n ...${RES}" curl --connect-timeout 30 -m 600 -Lo "$TMPDIR/luci-i18n-alist-zh-cn.ipk" $mirror$luci_i18n if [ $? -ne 0 ]; then - echo -e "${RED_COLOR}Error! download $luci_i18n failed.${RES}" + echo -e "\r\n${RED_COLOR}Error! Download $luci_i18n failed.${RES}" rm -rf $TMPDIR exit 1 fi @@ -80,6 +81,7 @@ DOWNLOAD() ( INSTALL() ( # Install echo -e "\r\n${GREEN_COLOR}Install Packages ...${RES}\r\n" + opkg update opkg install $TMPDIR/alist_$platform.ipk opkg install $TMPDIR/luci-app-alist.ipk opkg install $TMPDIR/luci-i18n-alist-zh-cn.ipk