build-package: Darwin compat

merge-requests/33/head
Christopher Roy Bratusek 4 years ago
parent 5bb7a21548
commit bd25ad73c0

@ -9,6 +9,11 @@ VERSION=${version_code}.${build_date}
CWD=$(readlink -m "${BASH_SOURCE[0]}")
CWD=$(dirname "${CWD}")
case $(uname -s) in
*Darwin*) export sumsha256="shasum -a 256" ;;
* ) export sumsha256="sha256sum" ;;
esac
# DIRS
datafolder="${CWD}/data"
repofolder="$datafolder/repo"

@ -258,7 +258,7 @@ error () {
sum_sign_package () {
cd "${CWD}"
cd "$(dirname "${1}")"
sha256sum "$(basename "${1}")" > "${1}.sha256"
${sumsha256} "$(basename "${1}")" > "${1}.sha256"
cd "${CWD}"
gpg --sign --detach-sign "${1}.sha256"
}

@ -12,7 +12,7 @@ repo_bromite="https://fdroid.bromite.org/fdroid/repo"
repo_ogapps="https://gitlab.opengapps.org/opengapps"
# check dependencies
for dep in gawk curl sha256sum jq gzip; do
for dep in gawk curl jq gzip; do
if ! which ${dep} &>/dev/null; then
echo "${dep} is not installed!"
exit 1
@ -72,11 +72,11 @@ check_sha256sum () {
case ${input} in
*.gz )
in_checksum=$(gzip -dc ${input} 2>/dev/null | sha256sum | gawk '{print $1}')
in_checksum=$(gzip -dc ${input} 2>/dev/null | ${sumsha256} | gawk '{print $1}')
;;
* )
in_checksum=$(sha256sum ${input} 2>/dev/null | gawk '{print $1}')
in_checksum=$(${sumsha256} ${input} 2>/dev/null | gawk '{print $1}')
;;
esac
@ -173,14 +173,14 @@ grab_apk_from_repo () {
local apk_url="${repo}/${apk_name}"
if check_sha256sum "${apk_dest}/${4}.apk.gz" "${sha_sum}"; then
if check_${sumsha256} "${apk_dest}/${4}.apk.gz" "${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"
debug_download no_delete "${apk_dest}/${4}.apk" "${apk_url}"
if check_sha256sum "${apk_dest}/${4}.apk" "${sha_sum}"; then
if check_${sumsha256} "${apk_dest}/${4}.apk" "${sha_sum}"; then
echo " SHA256 hash of ${4}.apk is correct"
gzip "${apk_dest}/${4}.apk"
else echo -e " SHA256 hash of ${4}.apk is wrong!\

@ -62,8 +62,8 @@ get_apk_info () {
apk_version=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^package: name/{print $6}')
apk_code=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^package: name/{print $4}')
apk_perm=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^uses-permission:/{print $2}' | sort)
apk_sha=$(sha256sum ${APK} | gawk '{print $1}')
gzip_sha=$(sha256sum ${1} | gawk '{print $1}')
apk_sha=$(${sumsha256} ${APK} | gawk '{print $1}')
gzip_sha=$(${sumsha256} ${1} | gawk '{print $1}')
case ${1} in
*gsync/K* ) APK_TYPE="Google Sync Adapters [KitKat]" ;;
@ -121,7 +121,7 @@ get_lib_info () {
local lib_arch=$(file -b ${1} | gawk -F, '{print $2 " [ " $1 " ] [" $3 " ]"}')
local lib_specs=$(file -b ${1} | gawk -F, '{print $4 " [" $5 " ]"}')
lib_sha=$(sha256sum ${1} | gawk '{print $1}')
lib_sha=$(${sumsha256} ${1} | gawk '{print $1}')
echo "Android Library: ${LIB_NAME}
| Filename: ${lib_file}
@ -148,7 +148,7 @@ get_bin_info () {
local bin_arch=$(file -b ${1} | gawk -F, '{print $2 " [ " $1 " ] [" $3 " ]"}')
local bin_specs=$(file -b ${1} | gawk -F, '{print $4 " [" $7 " ] [" $6 " ]"}')
local bin_sha=$(sha256sum ${1} | gawk '{print $1}')
local bin_sha=$(${sumsha256} ${1} | gawk '{print $1}')
echo "${bin_type}: ${bin_name}
| Filename: ${bin_file}
@ -181,7 +181,7 @@ get_etc_info () {
*etc/org.fdroid.fdroid* ) local etc_type="F-Droid Configuration" ;;
esac
local etc_sha=$(sha256sum ${1} | gawk '{print $1}')
local etc_sha=$(${sumsha256} ${1} | gawk '{print $1}')
echo "${etc_type}: ${etc_file}
| Filename: ${etc_file}
@ -214,7 +214,7 @@ get_dex_info () {
esac
dex_ver=$(file -b ${1} | gawk '{print $5}')
dex_sha=$(sha256sum ${1} | gawk '{print $1}')
dex_sha=$(${sumsha256} ${1} | gawk '{print $1}')
echo "${dex_type}: ${dex_name}
| Filename: ${dex_file}
@ -296,7 +296,7 @@ get_msc_info () {
unknown ) echo "No report template for file: ${1}" ;;
* ) local msc_file=$(basename ${1})
local msc_path=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
local msc_sha=$(sha256sum ${1} | gawk '{print $1}')
local msc_sha=$(${sumsha256} ${1} | gawk '{print $1}')
[ -z "${msc_name}" ] && local msc_name=$(basename ${1} | sed -e 's/\.[^.]*$//')
@ -337,7 +337,7 @@ get_dst_info () {
*.sig ) local dst_type="Flashable Package (GPG Signature)" ;;
esac
dst_sha=$(sha256sum ${1} | gawk '{print $1}')
dst_sha=$(${sumsha256} ${1} | gawk '{print $1}')
echo "${dst_type}: ${dst_name}
| Filename: ${dst_file}

Loading…
Cancel
Save