|
@@ -8,7 +8,7 @@ fi
|
|
|
mkdir -p ${binpath%/*}
|
|
|
configpath=$(uci get AdGuardHome.AdGuardHome.configpath)
|
|
|
if [ -z "$configpath" ]; then
|
|
|
-uci get AdGuardHome.AdGuardHome.configpath="/etc/AdGuardHome.yaml"
|
|
|
+uci set AdGuardHome.AdGuardHome.configpath="/etc/AdGuardHome.yaml"
|
|
|
configpath="/etc/AdGuardHome.yaml"
|
|
|
fi
|
|
|
mkdir -p ${configpath%/*}
|
|
@@ -115,7 +115,7 @@ doupx(){
|
|
|
Arch="powerpc64"
|
|
|
;;
|
|
|
*)
|
|
|
- echo -e "error not support $Archt"
|
|
|
+ echo -e "error not support $Archt if you can use offical release please issue a bug"
|
|
|
exit 1
|
|
|
;;
|
|
|
esac
|
|
@@ -179,50 +179,57 @@ doupdate_core(){
|
|
|
exit 1
|
|
|
;;
|
|
|
*)
|
|
|
- echo -e "error not support $Archt"
|
|
|
-
|
|
|
+ echo -e "error not support $Archt if you can use offical release please issue a bug"
|
|
|
exit 1
|
|
|
;;
|
|
|
esac
|
|
|
- echo -e "start download ${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz"
|
|
|
- wget-ssl --no-check-certificate -t 2 -T 20 -O /tmp/AdGuardHomeupdate/AdGuardHome_linux_${Arch}.tar.gz "https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz" 2>&1
|
|
|
- if [ "$?" != "0" ]; then
|
|
|
- echo "github download failed try download from static.adguard.com"
|
|
|
- wget-ssl --no-check-certificate -t 2 -T 20 -O /tmp/AdGuardHomeupdate/AdGuardHome_linux_${Arch}.tar.gz "https://static.adguard.com/adguardhome/release/AdGuardHome_linux_${Arch}.tar.gz" 2>&1
|
|
|
+ echo -e "start download"
|
|
|
+ while read link
|
|
|
+ do
|
|
|
+ eval link=$link
|
|
|
+ wget-ssl --no-check-certificate -t 2 -T 20 -O /tmp/AdGuardHomeupdate/${link##*/} "$link" 2>&1
|
|
|
if [ "$?" != "0" ]; then
|
|
|
- echo "download failed"
|
|
|
+ echo "download failed try another download"
|
|
|
+ rm -f /tmp/AdGuardHomeupdate/${link##*/}
|
|
|
+ else
|
|
|
+ local success="1"
|
|
|
+ break
|
|
|
+ fi
|
|
|
+ done < "/usr/share/AdGuardHome/links.txt"
|
|
|
+ [ -z "$success" ] && echo "no download success" && exit 1
|
|
|
+ if [ "${link##*.}" == "gz" ]; then
|
|
|
+ tar -zxf "/tmp/AdGuardHomeupdate/${link##*/}" -C "/tmp/AdGuardHomeupdate/"
|
|
|
+ if [ ! -e "/tmp/AdGuardHomeupdate/AdGuardHome" ]; then
|
|
|
+ echo -e "Failed to download core."
|
|
|
+ rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
|
|
exit 1
|
|
|
fi
|
|
|
+ downloadbin="/tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome"
|
|
|
+ else
|
|
|
+ downloadbin="/tmp/AdGuardHomeupdate/${link##*/}"
|
|
|
fi
|
|
|
- tar -zxf "/tmp/AdGuardHomeupdate/AdGuardHome_linux_${Arch}.tar.gz" -C "/tmp/AdGuardHomeupdate/"
|
|
|
- if [ ! -e "/tmp/AdGuardHomeupdate/AdGuardHome" ]; then
|
|
|
- echo -e "Failed to download core."
|
|
|
- rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
|
|
- exit 1
|
|
|
- else
|
|
|
- echo -e "download success start copy"
|
|
|
- if [ ! -z "$upxflag" ]; then
|
|
|
+ chmod 755 $downloadbin
|
|
|
+ echo -e "download success start copy"
|
|
|
+ if [ ! -z "$upxflag" ]; then
|
|
|
echo -e "start upx may take a long time"
|
|
|
doupx
|
|
|
- #maybe need chmod
|
|
|
- /tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag /tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome
|
|
|
+ /tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $downloadbin
|
|
|
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
|
|
|
- fi
|
|
|
- echo -e "start copy"
|
|
|
- /etc/init.d/AdGuardHome stop
|
|
|
- rm "$binpath"
|
|
|
- mv -f /tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome "$binpath"
|
|
|
- if [ "$?" == "1" ]; then
|
|
|
- echo "mv failed maybe not enough space please use upx or change bin to /tmp/AdGuardHome"
|
|
|
- exit 1
|
|
|
- fi
|
|
|
- /etc/init.d/AdGuardHome start
|
|
|
fi
|
|
|
+ echo -e "start copy"
|
|
|
+ /etc/init.d/AdGuardHome stop
|
|
|
+ rm "$binpath"
|
|
|
+ mv -f "$downloadbin" "$binpath"
|
|
|
+ if [ "$?" == "1" ]; then
|
|
|
+ echo "mv failed maybe not enough space please use upx or change bin to /tmp/AdGuardHome"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ /etc/init.d/AdGuardHome start
|
|
|
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
|
|
|
echo -e "Succeeded in updating core."
|
|
|
uci set AdGuardHome.AdGuardHome.version="${latest_ver}"
|
|
|
uci commit AdGuardHome
|
|
|
- echo -e "Local version: ${now_ver}, cloud version: ${latest_ver}.\n"
|
|
|
+ echo -e "Local version: ${latest_ver}, cloud version: ${latest_ver}.\n"
|
|
|
}
|
|
|
|
|
|
main(){
|