From 881a7368e37c4f4194c3b72d4d4324e4adaab88a Mon Sep 17 00:00:00 2001 From: actions-user Date: Tue, 21 May 2024 20:10:03 +0800 Subject: [PATCH] update 2024-05-21 20:10:03 --- luci-app-store/Makefile | 2 +- luci-app-store/root/bin/is-opkg | 36 ++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/luci-app-store/Makefile b/luci-app-store/Makefile index 319b2651..f9af2c3b 100644 --- a/luci-app-store/Makefile +++ b/luci-app-store/Makefile @@ -11,7 +11,7 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +coreutils +coreutils-stat +libuci-lua LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.17) LUCI_PKGARCH:=all -PKG_VERSION:=0.1.14-3 +PKG_VERSION:=0.1.16-1 # PKG_RELEASE MUST be empty for luci.mk PKG_RELEASE:= diff --git a/luci-app-store/root/bin/is-opkg b/luci-app-store/root/bin/is-opkg index 5bc97ae6..d8947071 100755 --- a/luci-app-store/root/bin/is-opkg +++ b/luci-app-store/root/bin/is-opkg @@ -7,7 +7,10 @@ DL_DIR=${IS_ROOT}/tmp/dl LISTS_DIR_O=/tmp/opkg-lists LISTS_DIR=${IS_ROOT}${LISTS_DIR_O} OPKG_CONF_DIR=${IS_ROOT}/etc/opkg +OPKG_CONF_DIR_M=${IS_ROOT}/etc/opkg_m FEEDS_SERVER=https://istore.linkease.com/repo +FEEDS_SERVER_MIRRORS="https://repo.istoreos.com/repo" +DISABLE_MIRROR=false ARCH=`sed -n -e 's/^Architecture: *\([^ ]\+\) *$/\1/p' /rom/usr/lib/opkg/info/libc.control /usr/lib/opkg/info/libc.control 2>/dev/null | head -1` # for istore self upgrade @@ -39,10 +42,33 @@ opkg_wrap() { OPKG_CONF_DIR=${OPKG_CONF_DIR} opkg -f ${IS_ROOT}/etc/opkg.conf "$@" } -fcurl() { - curl --fail --show-error "$@" +opkg_wrap_mirrors() { + local server + local file + if ! $DISABLE_MIRROR; then + for server in $FEEDS_SERVER_MIRRORS ; do + rm -rf "${OPKG_CONF_DIR_M}" 2>/dev/null + mkdir -p "${OPKG_CONF_DIR_M}" 2>/dev/null + ls "${OPKG_CONF_DIR}/" | while read; do + file="$REPLY" + if [ -f "${OPKG_CONF_DIR}/$file" -a "${file: -5}" = ".conf" ]; then + sed "s#$FEEDS_SERVER/#$server/#g" "${OPKG_CONF_DIR}/$file" >"${OPKG_CONF_DIR_M}/$file" + touch -r "${OPKG_CONF_DIR}/$file" "${OPKG_CONF_DIR_M}/$file" 2>/dev/null + else + cp -a "${OPKG_CONF_DIR}/$file" "${OPKG_CONF_DIR_M}/" + fi + done + echo "Try mirror server $server" + OPKG_CONF_DIR=${OPKG_CONF_DIR_M} opkg -f ${IS_ROOT}/etc/opkg.conf "$@" && return 0 + done + DISABLE_MIRROR=true + fi + echo "Try origin server $FEEDS_SERVER" + OPKG_CONF_DIR=${OPKG_CONF_DIR} opkg -f ${IS_ROOT}/etc/opkg.conf "$@" } +alias fcurl='curl -L --fail --show-error' + check_space() { local free="$((`stat -c '%a * %S' -f /` >> 20 ))" if [ "$free" -lt 1 ]; then @@ -140,10 +166,10 @@ step_upgrade() { fi done if [ -n "$pkgs" ]; then - opkg_wrap upgrade $pkgs || return 1 + opkg_wrap_mirrors upgrade $pkgs || return 1 fi if [ -n "$metapkg" ]; then - opkg_wrap upgrade $metapkg || return 1 + opkg_wrap_mirrors upgrade $metapkg || return 1 fi return 0 } @@ -186,7 +212,7 @@ case $action in ;; "install") check_space - wrapped_in_update opkg_wrap install "$@" + wrapped_in_update opkg_wrap_mirrors install "$@" ;; "upgrade") new_upgrade "$@"