Updated Updates (markdown)

jumpsmm7 2021-01-04 22:11:13 -05:00
parent 015fac48f8
commit 502d574b09

@ -157,18 +157,18 @@ download () {
local MD5SUM_OLD
local MD5SUM_CURR
for URL in "$@"; do
FILENAME="$(basename $URL)"
FILENAME="$(basename "$URL")"
MD5SUM_OLD="$([ -f "$TARG"/"$FILENAME" ] && md5sum "$TARG"/"$FILENAME" | cut -d' ' -f1)"
MD5SUM_CURR="$(curl -fsL "$URL" | md5sum | awk '{print $1}')"
if [ $(echo -n $MD5SUM_CURR | wc -c) -eq 32 ] && [ "$MD5SUM_CURR" == "$MD5SUM_OLD" ]; then
if [ $(echo -n "$MD5SUM_CURR" | wc -c) -eq 32 ] && [ "$MD5SUM_CURR" == "$MD5SUM_OLD" ]; then
echo -e "$INFO $FILENAME is up to date. Skipping..."
else
local COUNT=0
while [ $COUNT -lt 3 ]; do
echo -e "$INFO Downloading $FILENAME"
curl -L -k -s "$URL" -o $TARG/$FILENAME
curl -L -k -s "$URL" -o "$TARG"/"$FILENAME"
if [ $? -eq 0 ]; then
chmod $PERM $TARG/$FILENAME
chmod "$PERM" "$TARG"/"$FILENAME"
break
fi
COUNT=$((COUNT+1))
@ -184,7 +184,7 @@ Update() {
DNSCRYPT_TAR=dnscrypt-proxy-${DNSCRYPT_ARCH}-${REMOTE_VERSION}.tar.gz
DOWNLOAD_URL="https://github.com/jedisct1/dnscrypt-proxy/releases/download/"${REMOTE_VERSION}"/"${DNSCRYPT_TAR}""
echo -e "$INFO Downloading update from '$DOWNLOAD_URL'..."
download $BASE_DIR 644 $DOWNLOAD_URL
download $BASE_DIR 644 "$DOWNLOAD_URL"
response=$?
if [ $response -ne 0 ]; then
@ -194,7 +194,7 @@ Update() {
fi
if [ -x "$(command -v minisign)" ]; then
download $BASE_DIR 644 ${DOWNLOAD_URL}.minisig
download $BASE_DIR 644 "${DOWNLOAD_URL}".minisig
minisign -Vm "${BASE_DIR}/${DNSCRYPT_TAR}" -P "$DNSCRYPT_PUBLIC_KEY"
valid_file=$?
@ -223,7 +223,7 @@ Update() {
updated_successfully=$?
rm -Rf "${BASE_DIR}/${DNSCRYPT_TAR}" "${BASE_DIR}/${DNSCRYPT_ARCH_TAR}"
rm -Rf ${BASE_DIR}/${DNSCRYPT_TAR} ${BASE_DIR}/${DNSCRYPT_ARCH_TAR}
if [ $updated_successfully -eq 0 ]; then
echo -e "$INFO DNSCrypt-proxy has been successfully updated!"
return 0