浏览代码

improve: try to --force-overwrite install ipk

rufengsuixing 5 年之前
父节点
当前提交
990cd2694e
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      root/usr/share/AdGuardHome/update_core.sh

+ 5 - 3
root/usr/share/AdGuardHome/update_core.sh

@@ -17,8 +17,10 @@ check_wgetcurl(){
 	which curl && downloader="curl -L -k --retry 2 --connect-timeout 20 -o" && return
 	which wget-ssl && downloader="wget-ssl --no-check-certificate -t 2 -T 20 -O" && return
 	[ -z "$1" ] && opkg update || (echo error opkg && EXIT 1)
-	[ -z "$1" ] && (opkg remove wget wget-nossl --force-depends ; opkg install wget ; check_wgetcurl 1 ;return)
-	[ "$1" == "1" ] && (opkg install curl ; check_wgetcurl 2 ; return)
+	#wgetver=$(opkg list wget | awk '{print $3}' | sort -r | head -n 1)
+	#[ -z "$1" ] && (opkg install wget=$wgetver --force-overwrite ; check_wgetcurl 1 ;return)
+	[ -z "$1" ] && (opkg remove wget wget-nossl --force-depends ; opkg install wget --force-overwrite; check_wgetcurl 1 ;return)
+	[ "$1" == "1" ] && (opkg install curl --force-overwrite; check_wgetcurl 2 ; return)
 	echo error curl and wget && EXIT 1
 }
 check_latest_version(){
@@ -105,7 +107,7 @@ doupx(){
 	upx_latest_ver="$($downloader - https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E '[0-9.]+' -o 2>/dev/null)"
 	$downloader /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/upx-${upx_latest_ver}-${Arch}_linux.tar.xz" 2>&1
 	#tar xvJf
-	which xz || (opkg list | grep ^xz || opkg update && opkg install xz) || (echo "xz download fail" && EXIT 1)
+	which xz || (opkg list | grep ^xz || opkg update && opkg install xz || (opkg update && opkg install xz)) || (echo "xz download fail" && EXIT 1)
 	mkdir -p /tmp/upx-${upx_latest_ver}-${Arch}_linux
 	xz -d -c /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz| tar -x -C "/tmp" >/dev/null 2>&1
 	if [ ! -e "/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx" ]; then