mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 02:14:40 +01:00
small adjustments to second script
parent
049a7e9054
commit
cd60bb41f1
1 changed files with 25 additions and 19 deletions
44
Updates.md
44
Updates.md
|
@ -143,13 +143,13 @@ case $(uname -m) in
|
|||
DNSCRYPT_ARCH_TAR=linux-arm64
|
||||
echo -e "$INFO Detected ARMv8 architecture."
|
||||
;;
|
||||
*)
|
||||
*)
|
||||
echo "$ERROR This is unsupported platform, sorry."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
download () {
|
||||
download() {
|
||||
local TARG="$1"; shift
|
||||
local PERM=$1; shift
|
||||
local URL
|
||||
|
@ -212,14 +212,7 @@ Update() {
|
|||
mv -f "${TARG_DIR}/dnscrypt-proxy" "${TARG_DIR}/dnscrypt-proxy.old" &&
|
||||
mv -f ${BASE_DIR}/${DNSCRYPT_ARCH_TAR}/* ${TARG_DIR}/ &&
|
||||
chmod u+x "${TARG_DIR}/dnscrypt-proxy" &&
|
||||
cd "$TARG_DIR" &&
|
||||
download $TARG_DIR 644 $RESOLVERS_URL_PREFIX/public-resolvers.md \
|
||||
$RESOLVERS_URL_PREFIX/public-resolvers.md.minisig \
|
||||
$RESOLVERS_URL_PREFIX/relays.md \
|
||||
$RESOLVERS_URL_PREFIX/relays.md.minisig ||
|
||||
chown root:root ${TARG_DIR}/public-resolvers.md ${TARG_DIR}/public-resolvers.md.minisig ${TARG_DIR}/relays.md ${TARG_DIR}/relays.md.minisig ||
|
||||
./dnscrypt-proxy -check && ./dnscrypt-proxy -service install 2>/dev/null || : &&
|
||||
./dnscrypt-proxy -service restart || ./dnscrypt-proxy -service start
|
||||
Update-Resolv
|
||||
|
||||
updated_successfully=$?
|
||||
|
||||
|
@ -229,10 +222,22 @@ Update() {
|
|||
return 0
|
||||
else
|
||||
echo -e "$ERROR Unable to complete DNSCrypt-proxy update. Update has been aborted." >&2
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
Update-Resolv() {
|
||||
cd "$TARG_DIR" &&
|
||||
download $TARG_DIR 644 $RESOLVERS_URL_PREFIX/public-resolvers.md \
|
||||
$RESOLVERS_URL_PREFIX/public-resolvers.md.minisig \
|
||||
$RESOLVERS_URL_PREFIX/relays.md \
|
||||
$RESOLVERS_URL_PREFIX/relays.md.minisig ||
|
||||
chown root:root ${TARG_DIR}/public-resolvers.md ${TARG_DIR}/public-resolvers.md.minisig ${TARG_DIR}/relays.md ${TARG_DIR}/relays.md.minisig ||
|
||||
./dnscrypt-proxy -check && ./dnscrypt-proxy -service install 2>/dev/null || : &&
|
||||
./dnscrypt-proxy -service restart || ./dnscrypt-proxy -service start
|
||||
}
|
||||
|
||||
if [ ! -f "${TARG_DIR}/dnscrypt-proxy" ]; then
|
||||
echo -e "$ERROR DNSCrypt-proxy is not installed in '${TARG_DIR}/dnscrypt-proxy'. Update aborted..." >&2
|
||||
exit 1
|
||||
|
@ -250,15 +255,16 @@ if [ "$LOCAL_VERSION" != "$REMOTE_VERSION" ]; then
|
|||
Update
|
||||
exit $?
|
||||
else
|
||||
cd "$TARG_DIR" &&
|
||||
download $TARG_DIR 644 $RESOLVERS_URL_PREFIX/public-resolvers.md \
|
||||
$RESOLVERS_URL_PREFIX/public-resolvers.md.minisig \
|
||||
$RESOLVERS_URL_PREFIX/relays.md \
|
||||
$RESOLVERS_URL_PREFIX/relays.md.minisig ||
|
||||
chown root:root ${TARG_DIR}/public-resolvers.md ${TARG_DIR}/public-resolvers.md.minisig ${TARG_DIR}/relays.md ${TARG_DIR}/relays.md.minisig ||
|
||||
./dnscrypt-proxy -check && ./dnscrypt-proxy -service install 2>/dev/null || : &&
|
||||
./dnscrypt-proxy -service restart || ./dnscrypt-proxy -service start
|
||||
echo -e "$INFO No updated needed."
|
||||
Update-Resolv
|
||||
updated_successfully=$?
|
||||
if [ $updated_successfully -eq 0 ]; then
|
||||
echo -e "$INFO DNSCrypt-proxy Resolver files have been successfully updated!"
|
||||
return 0
|
||||
else
|
||||
echo -e "$ERROR Unable to complete DNSCrypt-proxy Resolver file update. Update has been aborted." >&2
|
||||
return 1
|
||||
fi
|
||||
echo -e "$INFO No new version available for DNSCrypt-proxy."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue