mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-11-03 23:15:54 +00:00
Improved debug, allow selection of wget for downloads, rearranged download list and fixed forgotten echo
This commit is contained in:
parent
c1c6446a63
commit
9301a56917
@ -102,29 +102,34 @@ for opt in ${@}; do
|
||||
pull )
|
||||
update_indices
|
||||
nanodroid_pull
|
||||
update_master
|
||||
check_nanodroid
|
||||
;;
|
||||
|
||||
u-microg )
|
||||
update_indices
|
||||
update_microg
|
||||
update_master
|
||||
check_nanodroid
|
||||
;;
|
||||
|
||||
u-fdroid )
|
||||
update_indices
|
||||
update_fdroid
|
||||
update_master
|
||||
check_nanodroid
|
||||
;;
|
||||
|
||||
u-apps )
|
||||
update_indices
|
||||
update_apps
|
||||
update_master
|
||||
check_nanodroid
|
||||
;;
|
||||
|
||||
u-swipe )
|
||||
update_swipe
|
||||
update_master
|
||||
check_nanodroid
|
||||
;;
|
||||
|
||||
|
@ -5,7 +5,7 @@ nanodroid_broken_files=0
|
||||
missing_database=""
|
||||
|
||||
debug_message () {
|
||||
[ "$DEBUG" = '1' ] && echo "$(tput setaf 3)$1$(tput sgr 0)"
|
||||
[ "$DEBUG" = '1' ] && echo "$2$(tput setaf 3)$1$(tput sgr 0)"
|
||||
}
|
||||
|
||||
check_nanodroid () {
|
||||
|
@ -18,6 +18,41 @@ for dep in gawk curl sha256sum jq gzip; do
|
||||
fi
|
||||
done
|
||||
|
||||
debug_download () {
|
||||
case $1 in
|
||||
index)
|
||||
if [ "$USE_WGET" = '1' ]; then
|
||||
rm -rf "$2"
|
||||
debug_message "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\"" " "
|
||||
wget -q --show-progress "$3" -O "$2" || error "$4"
|
||||
else
|
||||
debug_message "curl -sSL -o \"${2#$CWD/}\" \"$3\"" " "
|
||||
curl -sSL -o "$2" "$3" || error "$4"
|
||||
fi
|
||||
;;
|
||||
no_delete)
|
||||
if [ "$USE_WGET" = '1' ]; then
|
||||
rm -rf "$2"
|
||||
debug_message "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\""
|
||||
wget -q --show-progress "$3" -O "$2"
|
||||
else
|
||||
debug_message "curl -sSL -o \"${2#$CWD/}\" \"$3\""
|
||||
curl -sSL -o "$2" "$3"
|
||||
fi
|
||||
;;
|
||||
delete)
|
||||
if [ "$USE_WGET" = '1' ]; then
|
||||
rm -rf "$2"
|
||||
debug_message "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\""
|
||||
wget -q --show-progress "$3" -O "$2" || rm -f "$4"
|
||||
else
|
||||
debug_message "curl -sSL -o \"${2#$CWD/}\" \"$3\""
|
||||
curl -sSL -o "$2" "$3" || rm -f "$4"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
index_update_required () {
|
||||
index_file=${1}
|
||||
|
||||
@ -53,8 +88,7 @@ update_index () {
|
||||
local index_repo=${2}
|
||||
|
||||
if index_update_required ${index_json}; then
|
||||
debug_message " curl -sSL -o \"${index_jar#$CWD/}\" \"${index_repo}/index-v1.jar\""
|
||||
curl -sSL -o "${index_jar}" "${index_repo}/index-v1.jar" || error " failed to update repo index"
|
||||
debug_download index "${index_jar}" "${index_repo}/index-v1.jar" " failed to update repo index"
|
||||
|
||||
unzip -q ${index_jar} index-v1.json -d "$repofolder/"
|
||||
mv "$repofolder/index-v1.json" "${index_json}"
|
||||
@ -150,8 +184,7 @@ grab_apk_from_repo () {
|
||||
else echo -e "\nUpdating from ${repo_p} : ${4}.apk"
|
||||
mkdir -p "${apk_dest}"
|
||||
rm -f "${apk_dest}/${4}.apk.gz"
|
||||
debug_message "curl -sSL -o \"${apk_dest#$CWD/}/${4}.apk\" \"${apk_url}\""
|
||||
curl -sSL -o "${apk_dest}/${4}.apk" "${apk_url}"
|
||||
debug_download no_delete "${apk_dest}/${4}.apk" "${apk_url}"
|
||||
|
||||
if check_sha256sum "${apk_dest}/${4}.apk" "${sha_sum}"; then
|
||||
echo " SHA256 hash of ${4}.apk is correct"
|
||||
@ -178,9 +211,7 @@ grab_apk_from_url () {
|
||||
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
debug_message "curl -sSL -o \"${apk_dest#$CWD/}/${3}.apk\" \"${apk_url}\""
|
||||
curl -sSL -o "${apk_dest}/${3}.apk" "${apk_url}" || \
|
||||
rm -f "${apk_dest}/${3}.apk"
|
||||
debug_download delete "${apk_dest}/${3}.apk" "${apk_url}" "${apk_dest}/${3}.apk"
|
||||
|
||||
if [[ -f "${apk_dest}/${3}.apk" ]]; then
|
||||
gzip "${apk_dest}/${3}.apk"
|
||||
@ -205,9 +236,7 @@ grab_apk_from_github () {
|
||||
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
debug_message "curl -sSL -o \"${apk_dest#$CWD/}/${3}.apk\" \"${apk_url}\""
|
||||
curl -sSL -o "${apk_dest}/${3}.apk" "${apk_url}" || \
|
||||
rm -f "${apk_dest}/${3}.apk"
|
||||
debug_download delete "${apk_dest}/${3}.apk" "${apk_url}" "${apk_dest}/${3}.apk"
|
||||
|
||||
if [[ -f "${apk_dest}/${3}.apk" ]]; then
|
||||
gzip "${apk_dest}/${3}.apk"
|
||||
@ -217,7 +246,6 @@ grab_apk_from_github () {
|
||||
|
||||
grab_apk_from_gitlab () {
|
||||
local apk_url=$(curl -s -N "https://gitlab.com/${1}/-/tags" | grep '.apk' | head -n 1)
|
||||
echo "$apk_url"
|
||||
local apk_url=${apk_url%\">*.apk*}
|
||||
local apk_url="https://gitlab.com${apk_url##*a href=\"}"
|
||||
local apk_dest="${appsfolder[2]}/${2}/${3}"
|
||||
@ -232,9 +260,7 @@ grab_apk_from_gitlab () {
|
||||
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
debug_message "curl -sSL -o \"${apk_dest#$CWD/}/${3}.apk\" \"${apk_url}\""
|
||||
curl -sSL -o "${apk_dest}/${3}.apk" "${apk_url}" || \
|
||||
rm -f "${apk_dest}/${3}.apk"
|
||||
debug_download delete "${apk_dest}/${3}.apk" "${apk_url}" "${apk_dest}/${3}.apk"
|
||||
|
||||
if [[ -f "${apk_dest}/${3}.apk" ]]; then
|
||||
gzip "${apk_dest}/${3}.apk"
|
||||
@ -273,9 +299,7 @@ grab_apk_from_ogapps () {
|
||||
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
debug_message "curl -sSL -o \"${apk_dest#$CWD/}/${3}.apk\" \"${apk_url}\""
|
||||
curl -sSL -o "${apk_dest}/${3}.apk" "${apk_url}" || \
|
||||
rm -f "${apk_dest}/${3}.apk"
|
||||
debug_download delete "${apk_dest}/${3}.apk" "${apk_url}" "${apk_dest}/${3}.apk"
|
||||
|
||||
[ -f "${apk_dest}/${3}.apk" ] && gzip "${apk_dest}/${3}.apk"
|
||||
}
|
||||
@ -302,9 +326,7 @@ grab_lib_from_ogapps () {
|
||||
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
debug_message "curl -sSL -o \"${lib_dest#$CWD/}\" \"${lib_url}\""
|
||||
curl -sSL -o "${lib_dest}" "${lib_url}" || \
|
||||
rm -f "${lib_dest}"
|
||||
debug_download delete "${lib_dest}" "${lib_url}" "${lib_dest}"
|
||||
}
|
||||
|
||||
grab_patches () {
|
||||
@ -316,6 +338,5 @@ grab_patches () {
|
||||
echo -e "\nUpdating from Haystack : ${2}"
|
||||
echo " Checking SHA256 hash not (yet) supported"
|
||||
|
||||
curl -sSL -o "${patch_dst}" "${patch_url}" || \
|
||||
rm -f "${patch_dst}"
|
||||
debug_download delete "${patch_dst}" "${patch_url}""${patch_dst}"
|
||||
}
|
||||
|
@ -1,5 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# MicroG
|
||||
update_act[0]='0'
|
||||
# Swipe
|
||||
update_act[1]='0'
|
||||
# Gsync
|
||||
update_act[2]='0'
|
||||
# Bromite
|
||||
update_act[3]='0'
|
||||
# Osmand
|
||||
update_act[4]='0'
|
||||
# FDroid
|
||||
update_act[5]='0'
|
||||
# FDroid Privileged Extension
|
||||
update_act[6]='0'
|
||||
# AuroraDroid
|
||||
update_act[7]='0'
|
||||
# AuroraStore
|
||||
update_act[8]='0'
|
||||
# AuroraServices
|
||||
update_act[9]='0'
|
||||
# Yalp
|
||||
update_act[10]='0'
|
||||
# Phonesky
|
||||
update_act[11]='0'
|
||||
# General Apps
|
||||
update_act[12]='0'
|
||||
|
||||
nanodroid_pull () {
|
||||
update_microg
|
||||
update_fdroid
|
||||
@ -10,7 +37,7 @@ nanodroid_pull () {
|
||||
update_osmand
|
||||
}
|
||||
|
||||
update_swipe () {
|
||||
grab_swipe () {
|
||||
for arch in arm arm64 x86 x86_64; do
|
||||
grab_lib_from_ogapps libjni_keyboarddecoder.so 23 ${arch} false
|
||||
done
|
||||
@ -26,7 +53,11 @@ update_swipe () {
|
||||
done
|
||||
}
|
||||
|
||||
update_microg () {
|
||||
update_swipe () {
|
||||
update_act[1]='1'
|
||||
}
|
||||
|
||||
grab_microg () {
|
||||
# applications managed in repositories
|
||||
grab_apk_from_repo ${uG_GMSCORE[@]}
|
||||
grab_apk_from_repo ${uG_GSFPROXY[@]}
|
||||
@ -37,15 +68,17 @@ update_microg () {
|
||||
grab_apk_from_repo ${fd_NLPNOMINATIM[@]}
|
||||
grab_apk_from_repo ${fd_NLPAPPLE[@]}
|
||||
grab_apk_from_repo ${fd_NLPRADIOCELL[@]}
|
||||
grab_apk_from_repo ${fd_YALPSTORE[@]}
|
||||
grab_apk_from_repo ${fd_AURORASTORE[@]}
|
||||
grab_apk_from_repo ${nlx_PHONESKY[@]}
|
||||
|
||||
# GitLab
|
||||
grab_apk_from_gitlab ${gl_AURORASERVICES[@]}
|
||||
}
|
||||
|
||||
update_gsync () {
|
||||
update_microg () {
|
||||
update_act[0]='1'
|
||||
update_act[8]='1'
|
||||
update_act[9]='1'
|
||||
update_act[10]='1'
|
||||
update_act[11]='1'
|
||||
}
|
||||
|
||||
grab_gsync () {
|
||||
# KK LL M N O P
|
||||
for API in 19 21 23 24 26 28; do
|
||||
grab_apk_from_ogapps ${og_CONSYNC[@]} ${API}
|
||||
@ -55,14 +88,18 @@ update_gsync () {
|
||||
grab_apk_from_ogapps ${og_CALSYNC[@]}
|
||||
}
|
||||
|
||||
update_fdroid () {
|
||||
grab_apk_from_repo ${fd_FDROID[@]}
|
||||
grab_apk_from_repo ${fd_FDROID_PE[@]}
|
||||
grab_apk_from_repo ${fd_AURORADROID[@]}
|
||||
grab_apk_from_gitlab ${gl_AURORASERVICES[@]}
|
||||
update_gsync () {
|
||||
update_act[2]='1'
|
||||
}
|
||||
|
||||
update_apps () {
|
||||
update_fdroid () {
|
||||
update_act[5]='1'
|
||||
update_act[6]='1'
|
||||
update_act[7]='1'
|
||||
update_act[9]='1'
|
||||
}
|
||||
|
||||
grab_apps () {
|
||||
# applications managed in repositories
|
||||
grab_apk_from_repo ${fd_ALARMIO[@]}
|
||||
grab_apk_from_repo ${fd_AMAZE[@]}
|
||||
@ -97,13 +134,40 @@ update_apps () {
|
||||
grab_apk_from_url ${raw_XDALABS[@]}
|
||||
}
|
||||
|
||||
update_bromite () {
|
||||
update_apps () {
|
||||
update_act[12]='1'
|
||||
}
|
||||
|
||||
grab_bromite () {
|
||||
grab_apk_from_repo ${bm_WEBVIEW_arm64[@]}
|
||||
grab_apk_from_repo ${bm_WEBVIEW_arm[@]}
|
||||
grab_apk_from_repo ${bm_WEBVIEW_x86[@]}
|
||||
}
|
||||
|
||||
update_osmand () {
|
||||
update_bromite () {
|
||||
update_act[3]='1'
|
||||
}
|
||||
|
||||
grab_osmand () {
|
||||
grab_apk_from_repo ${fd_OSMAND[@]}
|
||||
grab_apk_from_repo ${fd_OSMAND_CONTOURLINES[@]}
|
||||
}
|
||||
|
||||
update_osmand () {
|
||||
update_act[4]='1'
|
||||
}
|
||||
|
||||
update_master () {
|
||||
[ "${update_act[0]}" = "1" ] && grab_microg
|
||||
[ "${update_act[7]}" = "1" ] && grab_apk_from_repo ${fd_AURORADROID[@]}
|
||||
[ "${update_act[8]}" = "1" ] && grab_apk_from_repo ${fd_AURORASTORE[@]}
|
||||
[ "${update_act[9]}" = "1" ] && grab_apk_from_gitlab ${gl_AURORASERVICES[@]}
|
||||
[ "${update_act[5]}" = "1" ] && grab_apk_from_repo ${fd_FDROID[@]}
|
||||
[ "${update_act[6]}" = "1" ] && grab_apk_from_repo ${fd_FDROID_PE[@]}
|
||||
[ "${update_act[10]}" = "1" ] && grab_apk_from_repo ${fd_YALPSTORE[@]}
|
||||
[ "${update_act[11]}" = "1" ] && grab_apk_from_repo ${nlx_PHONESKY[@]}
|
||||
[ "${update_act[3]}" = "1" ] && grab_bromite
|
||||
[ "${update_act[4]}" = "1" ] && grab_osmand
|
||||
[ "${update_act[12]}" = "1" ] && grab_apps
|
||||
[ "${update_act[2]}" = "1" ] && grab_gsync
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user