mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
build-package: compress APKs using ZStd instead of GZip
(provides better performance on low end devices)
This commit is contained in:
parent
7f63fcfdd1
commit
c9a927881d
@ -19,15 +19,18 @@ debug_message () {
|
||||
}
|
||||
|
||||
check_nanodroid () {
|
||||
# check for gzip'ed APKs (we switched to ZStd with NanoDroid 23.0) and remove them
|
||||
find Full/ -type f -name '*.apk.gz' | xargs rm -fv
|
||||
|
||||
for file in ${file_database[@]}; do
|
||||
if [[ ! -f ${CWD}/${file} ]]; then
|
||||
nanodroid_missing_files=1
|
||||
missing_database=(${missing_database[@]} ${file})
|
||||
else
|
||||
case ${file} in
|
||||
*.gz )
|
||||
*.zst )
|
||||
mimetype=$(file -b --mime-type ${CWD}/${file})
|
||||
mimetype_int=$(gzip -dc ${CWD}/${file} | file -b --mime-type - )
|
||||
mimetype_int=$(zstd -dcf ${CWD}/${file} 2>/dev/null | file -b --mime-type - )
|
||||
;;
|
||||
|
||||
*.so* )
|
||||
@ -41,7 +44,7 @@ check_nanodroid () {
|
||||
# library
|
||||
;;
|
||||
|
||||
application/gzip )
|
||||
application/zstd )
|
||||
# APK
|
||||
;;
|
||||
|
||||
@ -58,7 +61,7 @@ check_nanodroid () {
|
||||
# library
|
||||
;;
|
||||
|
||||
application/java-archive | application/zip )
|
||||
*application/java-archive* | *application/zip* )
|
||||
# APK
|
||||
;;
|
||||
|
||||
|
@ -107,78 +107,78 @@ fd_OSMAND_CONTOURLINES=(fdroid net.osmand.srtmPlugin.paid app OsmAnd_ContourLine
|
||||
###
|
||||
|
||||
file_database=(
|
||||
${appsfolder[3]}/Alarmio/Alarmio.apk.gz
|
||||
${appsfolder[3]}/Amaze/Amaze.apk.gz
|
||||
${appsfolder[3]}/AnysoftKeyboard/AnysoftKeyboard.apk.gz
|
||||
${appsfolder[3]}/AuroraDroid/AuroraDroid.apk.gz
|
||||
${appsfolder[3]}/AuroraStore/AuroraStore.apk.gz
|
||||
${appsfolder[3]}/Blokada/Blokada.apk.gz
|
||||
${appsfolder[3]}/DroidGuard/DroidGuard.apk.gz
|
||||
${appsfolder[3]}/FreeOTPPlus/FreeOTPPlus.apk.gz
|
||||
${appsfolder[3]}/Frost/Frost.apk.gz
|
||||
${appsfolder[3]}/FDroid/FDroid.apk.gz
|
||||
${appsfolder[3]}/HackersKeyboard/HackersKeyboard.apk.gz
|
||||
${appsfolder[3]}/K9Mail/K9Mail.apk.gz
|
||||
${appsfolder[3]}/KeePassDX/KeePassDX.apk.gz
|
||||
${appsfolder[3]}/MPV/MPV.apk.gz
|
||||
${appsfolder[3]}/NewPipe/NewPipe.apk.gz
|
||||
${appsfolder[3]}/nlpBackendApple/nlpBackendApple.apk.gz
|
||||
${appsfolder[3]}/nlpBackendDejavu/nlpBackendDejavu.apk.gz
|
||||
${appsfolder[3]}/nlpBackendIchnaea/nlpBackendIchnaea.apk.gz
|
||||
${appsfolder[3]}/nlpBackendNominatim/nlpBackendNominatim.apk.gz
|
||||
${appsfolder[3]}/nlpBackendRadiocell/nlpBackendRadiocell.apk.gz
|
||||
${appsfolder[3]}/OAndBackupX/OAndBackupX.apk.gz
|
||||
${appsfolder[3]}/Odyssey/Odyssey.apk.gz
|
||||
${appsfolder[3]}/OpenCamera/OpenCamera.apk.gz
|
||||
${appsfolder[3]}/OpenKeyChain/OpenKeyChain.apk.gz
|
||||
${appsfolder[3]}/OpenLauncher/OpenLauncher.apk.gz
|
||||
${appsfolder[3]}/OpenVPN/OpenVPN.apk.gz
|
||||
${appsfolder[3]}/PrivacyBrowser/PrivacyBrowser.apk.gz
|
||||
${appsfolder[3]}/QKSMS/QKSMS.apk.gz
|
||||
${appsfolder[3]}/SimpleCalendar/SimpleCalendar.apk.gz
|
||||
${appsfolder[3]}/SimpleGallery/SimpleGallery.apk.gz
|
||||
${appsfolder[3]}/SmartPackKernelManager/SmartPackKernelManager.apk.gz
|
||||
${appsfolder[3]}/Termux/Termux.apk.gz
|
||||
${appsfolder[3]}/TorBrowser/TorBrowser.apk.gz
|
||||
${appsfolder[3]}/Twidere/Twidere.apk.gz
|
||||
${appsfolder[3]}/Warden/Warden.apk.gz
|
||||
${appsfolder[3]}/XDALabs/XDALabs.apk.gz
|
||||
${appsfolder[3]}/Alarmio/Alarmio.apk.zst
|
||||
${appsfolder[3]}/Amaze/Amaze.apk.zst
|
||||
${appsfolder[3]}/AnysoftKeyboard/AnysoftKeyboard.apk.zst
|
||||
${appsfolder[3]}/AuroraDroid/AuroraDroid.apk.zst
|
||||
${appsfolder[3]}/AuroraStore/AuroraStore.apk.zst
|
||||
${appsfolder[3]}/Blokada/Blokada.apk.zst
|
||||
${appsfolder[3]}/DroidGuard/DroidGuard.apk.zst
|
||||
${appsfolder[3]}/FreeOTPPlus/FreeOTPPlus.apk.zst
|
||||
${appsfolder[3]}/Frost/Frost.apk.zst
|
||||
${appsfolder[3]}/FDroid/FDroid.apk.zst
|
||||
${appsfolder[3]}/HackersKeyboard/HackersKeyboard.apk.zst
|
||||
${appsfolder[3]}/K9Mail/K9Mail.apk.zst
|
||||
${appsfolder[3]}/KeePassDX/KeePassDX.apk.zst
|
||||
${appsfolder[3]}/MPV/MPV.apk.zst
|
||||
${appsfolder[3]}/NewPipe/NewPipe.apk.zst
|
||||
${appsfolder[3]}/nlpBackendApple/nlpBackendApple.apk.zst
|
||||
${appsfolder[3]}/nlpBackendDejavu/nlpBackendDejavu.apk.zst
|
||||
${appsfolder[3]}/nlpBackendIchnaea/nlpBackendIchnaea.apk.zst
|
||||
${appsfolder[3]}/nlpBackendNominatim/nlpBackendNominatim.apk.zst
|
||||
${appsfolder[3]}/nlpBackendRadiocell/nlpBackendRadiocell.apk.zst
|
||||
${appsfolder[3]}/OAndBackupX/OAndBackupX.apk.zst
|
||||
${appsfolder[3]}/Odyssey/Odyssey.apk.zst
|
||||
${appsfolder[3]}/OpenCamera/OpenCamera.apk.zst
|
||||
${appsfolder[3]}/OpenKeyChain/OpenKeyChain.apk.zst
|
||||
${appsfolder[3]}/OpenLauncher/OpenLauncher.apk.zst
|
||||
${appsfolder[3]}/OpenVPN/OpenVPN.apk.zst
|
||||
${appsfolder[3]}/PrivacyBrowser/PrivacyBrowser.apk.zst
|
||||
${appsfolder[3]}/QKSMS/QKSMS.apk.zst
|
||||
${appsfolder[3]}/SimpleCalendar/SimpleCalendar.apk.zst
|
||||
${appsfolder[3]}/SimpleGallery/SimpleGallery.apk.zst
|
||||
${appsfolder[3]}/SmartPackKernelManager/SmartPackKernelManager.apk.zst
|
||||
${appsfolder[3]}/Termux/Termux.apk.zst
|
||||
${appsfolder[3]}/TorBrowser/TorBrowser.apk.zst
|
||||
${appsfolder[3]}/Twidere/Twidere.apk.zst
|
||||
${appsfolder[3]}/Warden/Warden.apk.zst
|
||||
${appsfolder[3]}/XDALabs/XDALabs.apk.zst
|
||||
|
||||
${appsfolder[4]}/AuroraServices/AuroraServices.apk.gz
|
||||
${appsfolder[4]}/FakeStore/FakeStore.apk.gz
|
||||
${appsfolder[4]}/FDroidPrivileged/FDroidPrivileged.apk.gz
|
||||
${appsfolder[4]}/GmsCore/GmsCore.apk.gz
|
||||
${appsfolder[4]}/GsfProxy/GsfProxy.apk.gz
|
||||
${appsfolder[4]}/Phonesky/Phonesky.apk.gz
|
||||
${appsfolder[4]}/AuroraServices/AuroraServices.apk.zst
|
||||
${appsfolder[4]}/FakeStore/FakeStore.apk.zst
|
||||
${appsfolder[4]}/FDroidPrivileged/FDroidPrivileged.apk.zst
|
||||
${appsfolder[4]}/GmsCore/GmsCore.apk.zst
|
||||
${appsfolder[4]}/GsfProxy/GsfProxy.apk.zst
|
||||
${appsfolder[4]}/Phonesky/Phonesky.apk.zst
|
||||
|
||||
${appsfolder[5]}/K/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/K/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/K/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/L/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/L/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/L/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/M/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/M/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/M/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/N/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/N/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/N/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/O/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/O/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/O/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/P/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/P/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/P/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/Q/app/GoogleCalendarSync/GoogleCalendarSync.apk.gz
|
||||
${appsfolder[5]}/Q/app/GoogleContactsSync/GoogleContactsSync.apk.gz
|
||||
${appsfolder[5]}/Q/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.gz
|
||||
${appsfolder[5]}/K/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/K/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/K/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/L/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/L/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/L/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/M/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/M/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/M/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/N/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/N/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/N/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/O/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/O/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/O/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/P/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/P/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/P/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
${appsfolder[5]}/Q/app/GoogleCalendarSync/GoogleCalendarSync.apk.zst
|
||||
${appsfolder[5]}/Q/app/GoogleContactsSync/GoogleContactsSync.apk.zst
|
||||
${appsfolder[5]}/Q/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk.zst
|
||||
|
||||
${appsfolder[11]}/app/BromiteWebView_arm/BromiteWebView_arm.apk.gz
|
||||
${appsfolder[11]}/app/BromiteWebView_arm64/BromiteWebView_arm64.apk.gz
|
||||
${appsfolder[11]}/app/BromiteWebView_x86/BromiteWebView_x86.apk.gz
|
||||
${appsfolder[11]}/app/BromiteWebView_arm/BromiteWebView_arm.apk.zst
|
||||
${appsfolder[11]}/app/BromiteWebView_arm64/BromiteWebView_arm64.apk.zst
|
||||
${appsfolder[11]}/app/BromiteWebView_x86/BromiteWebView_x86.apk.zst
|
||||
|
||||
${appsfolder[9]}/app/OsmAnd/OsmAnd.apk.gz
|
||||
${appsfolder[9]}/app/OsmAnd_ContourLines/OsmAnd_ContourLines.apk.gz
|
||||
${appsfolder[9]}/app/OsmAnd/OsmAnd.apk.zst
|
||||
${appsfolder[9]}/app/OsmAnd_ContourLines/OsmAnd_ContourLines.apk.zst
|
||||
|
||||
${appsfolder[7]}/arm/libjni_keyboarddecoder.so
|
||||
${appsfolder[7]}/arm/libjni_latinimegoogle.so_19
|
||||
|
@ -22,16 +22,16 @@ else
|
||||
fi
|
||||
|
||||
# check dependencies
|
||||
for dep in gawk curl jq gzip grep; do
|
||||
for dep in gawk curl jq zstd grep; do
|
||||
if ! which ${dep} &>/dev/null; then
|
||||
echo "${dep} is not installed!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
gzip_apk () {
|
||||
zstd_apk () {
|
||||
[ -f "${1}" ] && \
|
||||
gzip -f "${1}" || \
|
||||
zstd -1f --rm "${1}" || \
|
||||
echo "error downloading ${1}"
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ msg_no_checksum () {
|
||||
}
|
||||
|
||||
msg_apk_update () {
|
||||
if [ -f "${1}.gz" ]; then
|
||||
if [ -f "${1}.zst" ]; then
|
||||
echo -e "\nUpdating from ${2} : $(basename ${1}) ${3}"
|
||||
else echo -e "\nDownloading from ${2} : $(basename ${1}) ${3}"
|
||||
fi
|
||||
@ -88,7 +88,7 @@ download_apk_common () {
|
||||
debug_download delete "${apk_dest}/${apk_name}.apk" "${apk_url}" "${apk_dest}/${apk_name}.apk"
|
||||
fi
|
||||
|
||||
gzip_apk "${apk_dest}/${apk_name}.apk"
|
||||
zstd_apk "${apk_dest}/${apk_name}.apk"
|
||||
}
|
||||
|
||||
debug_download () {
|
||||
@ -143,8 +143,8 @@ check_sha256sum () {
|
||||
local ex_checksum="${2}"
|
||||
|
||||
case ${input} in
|
||||
*.gz )
|
||||
in_checksum=$(gzip -dc ${input} 2>/dev/null | ${sumsha256} | gawk '{print $1}')
|
||||
*.zst )
|
||||
in_checksum=$(zstd -dcf ${input} 2>/dev/null | ${sumsha256} | gawk '{print $1}')
|
||||
;;
|
||||
|
||||
* )
|
||||
@ -244,20 +244,20 @@ grab_apk_from_repo () {
|
||||
if [ -f "${sideload}/${4}.apk" ]; then
|
||||
echo -e "\nSideloading APK : ${4}.apk"
|
||||
mkdir -p "${apk_dest}"
|
||||
rm -f "${apk_dest}/${4}.apk.gz"
|
||||
rm -f "${apk_dest}/${4}.apk.zst"
|
||||
cp "${sideload}/${4}.apk" "${apk_dest}/${4}.apk"
|
||||
gzip "${apk_dest}/${4}.apk"
|
||||
zstd_apk "${apk_dest}/${4}.apk"
|
||||
else
|
||||
if check_sha256sum "${apk_dest}/${4}.apk.gz" "${sha_sum}"; then
|
||||
if check_sha256sum "${apk_dest}/${4}.apk.zst" "${sha_sum}"; then
|
||||
echo -e "\nUp-to-Date from ${repo_p} : ${4}.apk"
|
||||
else echo -e "\nUpdating from ${repo_p} : ${4}.apk"
|
||||
mkdir -p "${apk_dest}"
|
||||
rm -f "${apk_dest}/${4}.apk.gz"
|
||||
rm -f "${apk_dest}/${4}.apk.zst"
|
||||
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"
|
||||
gzip "${apk_dest}/${4}.apk"
|
||||
zstd_apk "${apk_dest}/${4}.apk"
|
||||
else echo -e " SHA256 hash of ${4}.apk is wrong!\
|
||||
\n expected : ${sha_sum}\
|
||||
\n got : ${in_checksum}"
|
||||
|
Loading…
Reference in New Issue
Block a user