From b30cba7c2bea6add1984f5dc44ec59aeeafa0324 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Fri, 25 Sep 2020 09:44:01 +0200 Subject: [PATCH] build-package: simplify --- data/build-package.download | 47 +++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/data/build-package.download b/data/build-package.download index d5fee95..4c6895f 100644 --- a/data/build-package.download +++ b/data/build-package.download @@ -35,43 +35,38 @@ gzip_apk () { echo "error downloading ${1}" } +msg_no_checksum () { + echo " Checking SHA256 hash not supported" +} + +msg_apk_update () { + if [ -f "${1}.gz" ]; then + echo -e "\nUpdating from ${2} : $(basename ${1}) ${3}" + else echo -e "\nDownloading from ${2} : $(basename ${1}) ${3}" + fi +} + msg_download_info () { case ${1} in sideload) - echo -e "\nSideloading APK : ${2} ${3}" - echo " Checking SHA256 hash not supported" + echo -e "\nSideloading APK : ${2} ${3}" + msg_no_checksum ;; - github) - if [ -f "${2}.gz" ]; then - echo -e "\nUpdating from GitHub : $(basename ${2})" - else echo -e "\nDownloading from GitHub : $(basename ${2})" - fi - echo " Checking SHA256 hash not supported" + msg_apk_update "${2}" "GitHub" + msg_no_checksum ;; - gitlab) - if [ -f "${2}.gz" ]; then - echo -e "\nUpdating from GitLab : $(basename ${2})" - else echo -e "\nDownloading from GitLab : $(basename ${2})" - fi - echo " Checking SHA256 hash not supported" + msg_apk_update "${2}" "GitLab" + msg_no_checksum ;; - opengapps) - if [ -f "${2}.gz" ]; then - echo -e "\nUpdating from OpenGApps : $(basename ${2}) ${3}" - else echo -e "\nDownloading from OpenGApps: $(basename ${2}) ${3}" - fi - echo " Checking SHA256 hash not supported" + msg_apk_update "${2}" "OpenGApps" "${3}" + msg_no_checksum ;; - url) - if [ -f "${2}.gz" ]; then - echo -e "\nUpdating from URL : $(basename ${2})" - else echo -e "\nDownloading from URL : $(basename ${2})" - fi - echo " Checking SHA256 hash not supported" + msg_apk_update "${2}" "URL" + msg_no_checksum ;; esac }