2018-01-23 20:11:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
NANODROID_MISSING_FILES=0
|
2019-03-09 20:55:24 +00:00
|
|
|
NANODROID_BROKEN_FILES=0
|
2018-01-23 20:11:52 +00:00
|
|
|
missing_database=""
|
|
|
|
|
|
|
|
check_nanodroid () {
|
|
|
|
for file in ${files_database[@]}; do
|
|
|
|
if [[ ! -f ${CWD}/${file} ]]; then
|
|
|
|
NANODROID_MISSING_FILES=1
|
2018-11-30 17:22:58 +00:00
|
|
|
missing_database=(${missing_database[@]} ${file})
|
2019-03-09 20:55:24 +00:00
|
|
|
else
|
|
|
|
mimetype=$(file -b --mime-type ${file})
|
|
|
|
case ${mimetype} in
|
|
|
|
application/x-sharedlib )
|
|
|
|
# library
|
|
|
|
;;
|
|
|
|
|
2019-07-07 20:26:14 +00:00
|
|
|
application/java-archive | application/zip | application/x-bzip2)
|
2019-03-09 20:55:24 +00:00
|
|
|
# APK
|
|
|
|
;;
|
|
|
|
|
|
|
|
* )
|
|
|
|
NANODROID_BROKEN_FILES=1
|
|
|
|
broken_database=(${broken_database[@]} ${file})
|
|
|
|
;;
|
|
|
|
esac
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ${NANODROID_MISSING_FILES} -ne 0 ]]; then
|
|
|
|
echo -e "\nThe following files are missing:\n"
|
|
|
|
printf '%s\n' ${missing_database[@]}
|
2019-03-09 20:55:24 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${NANODROID_BROKEN_FILES} -ne 0 ]]; then
|
|
|
|
echo -e "\nThe following files are broken:\n"
|
|
|
|
printf '%s\n' ${broken_database[@]}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${NANODROID_MISSING_FILES} -eq 0 && ${NANODROID_BROKEN_FILES} -eq 0 ]]; then
|
2018-09-14 16:57:52 +00:00
|
|
|
echo -e "\nNanoDroid correctly populated\n"
|
|
|
|
return 0
|
2019-03-09 20:55:24 +00:00
|
|
|
else return 1
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-03-01 13:23:44 +00:00
|
|
|
update_patches () {
|
|
|
|
grab_patches sigspoof-core/services.jar.dex core_services.jar.dex
|
|
|
|
grab_patches sigspoof-hook-4.1-6.0/services.jar.dex hook_4.1-6.0_services.jar.dex
|
|
|
|
grab_patches sigspoof-hook-7.0-9.0/services.jar.dex hook_7.0-9.0_services.jar.dex
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
progress () {
|
|
|
|
sleep 0.5
|
|
|
|
while [ -d "/proc/${1}" ];do
|
|
|
|
echo -ne '/\x08' ; sleep 0.05
|
|
|
|
echo -ne '-\x08' ; sleep 0.05
|
|
|
|
echo -ne '\\\x08' ; sleep 0.05
|
|
|
|
echo -ne '|\x08' ; sleep 0.05
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Done"
|
|
|
|
}
|
|
|
|
|
|
|
|
zip_add () {
|
2019-06-26 18:31:52 +00:00
|
|
|
FILE_PATH="${CWD}/${1}"
|
|
|
|
FILE_MASK="${2}"
|
|
|
|
ZIP_PATH="${CWD}/${ZIP}"
|
|
|
|
|
|
|
|
cd "${FILE_PATH}"
|
|
|
|
|
|
|
|
if [ -z "${FILE_MASK}" ]; then
|
|
|
|
zip -qr "${ZIP_PATH}" * || exit 1
|
|
|
|
elif [ -d "${FILE_MASK}" ]; then
|
|
|
|
zip -qr "${ZIP_PATH}" "${FILE_MASK}" || exit 1
|
|
|
|
else
|
|
|
|
zip -q "${ZIP_PATH}" ${FILE_MASK} || exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "${CWD}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zip_add_config () {
|
|
|
|
if [ -f "${CWD}/data/${1}" ]; then
|
|
|
|
cd "${CWD}/data"
|
|
|
|
else cd "${CWD}/doc"
|
|
|
|
fi
|
|
|
|
|
2019-06-26 18:31:52 +00:00
|
|
|
ZIP_PATH="${CWD}/${ZIP}"
|
|
|
|
|
|
|
|
case ${2} in
|
|
|
|
1 )
|
|
|
|
sed -e 's/nanodroid_overlay=1/nanodroid_overlay=0/' -i "${1}"
|
|
|
|
zip -q "${ZIP_PATH}" "${1}" || exit 1
|
|
|
|
sed -e 's/nanodroid_overlay=0/nanodroid_overlay=1/' -i "${1}"
|
|
|
|
;;
|
|
|
|
|
|
|
|
* )
|
|
|
|
zip -q "${ZIP_PATH}" "${1}" || exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
cd "${CWD}"
|
|
|
|
}
|
|
|
|
|
|
|
|
zip_add_base () {
|
|
|
|
ZIP_PATH="${CWD}/${ZIP}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
cd "${CWD}"
|
2019-06-26 18:31:52 +00:00
|
|
|
|
|
|
|
for file in CommonAddon CommonInstaller README.md ChangeLog.md; do
|
|
|
|
zip -q "${ZIP_PATH}" ${file} || exit 1
|
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2019-06-26 18:51:40 +00:00
|
|
|
zip_add_doc () {
|
|
|
|
ZIP_PATH="${CWD}/${ZIP}"
|
|
|
|
|
|
|
|
cd "${CWD}"
|
|
|
|
|
|
|
|
zip -q "${ZIP_PATH}" README.md || exit 1
|
|
|
|
zip -q "${ZIP_PATH}" ChangeLog.md || exit 1
|
|
|
|
}
|
|
|
|
|
2019-06-26 18:31:52 +00:00
|
|
|
zip_add_tool () {
|
|
|
|
cd "${CWD}/tools"
|
|
|
|
|
|
|
|
zip -q "${ZIP_PATH}" ${1}.* || exit 1
|
|
|
|
|
|
|
|
cd "${CWD}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2019-06-26 18:31:52 +00:00
|
|
|
increase_version_number () {
|
2018-01-23 20:11:52 +00:00
|
|
|
if [ -z ${3} ]; then
|
|
|
|
ver=99999999
|
|
|
|
else ver=${3}
|
|
|
|
fi
|
|
|
|
|
2019-06-09 20:12:18 +00:00
|
|
|
for file in "build-package" "CommonInstaller" \
|
|
|
|
"systest/SysTest" "patcher/CommonPatcher" \
|
2019-07-03 16:44:45 +00:00
|
|
|
"setup-wizard/nanodroid-setup" "CommonAddon" \
|
2019-06-09 20:12:18 +00:00
|
|
|
"uninstaller/META-INF/com/google/android/update-binary"; do
|
|
|
|
sed -e "s/^VERSION=.*/VERSION=${2}.${ver}/" -i "${CWD}/${file}"
|
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-23 20:04:36 +00:00
|
|
|
for module in Full microG F-Droid BromiteWebView OsmAnd; do
|
2018-01-23 20:11:52 +00:00
|
|
|
sed -e "s/version=.*/version=v${2}.${ver}/" -i \
|
|
|
|
"${CWD}/${module}/module.prop"
|
|
|
|
done
|
|
|
|
|
|
|
|
sed -e "s/rom_version\",.*/rom_version\", \"${2}\")\;/" -i \
|
|
|
|
"${CWD}/setup-wizard/META-INF/com/google/android/aroma-config"
|
|
|
|
sed -e "s/rom_date\",.*/rom_date\", \"${ver}\")\;/" -i \
|
|
|
|
"${CWD}/setup-wizard/META-INF/com/google/android/aroma-config"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
increase_module_version () {
|
2018-12-08 13:54:31 +00:00
|
|
|
for module in Full microG F-Droid BromiteWebView OsmAnd; do
|
2018-01-23 20:11:52 +00:00
|
|
|
eval $(grep versionCode "${PWD}"/"${module}"/module.prop)
|
|
|
|
versionCode=$((versionCode+1))
|
|
|
|
sed -e "s/versionCode.*/versionCode=${versionCode}/" \
|
|
|
|
-i "${CWD}/${module}/module.prop"
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
dalvikize_jar () {
|
|
|
|
if [[ -f ${1} ]]; then
|
2018-08-24 19:27:15 +00:00
|
|
|
${ANDROID_HOME}/build-tools/27.0.3/dx --dex \
|
2018-01-23 20:11:52 +00:00
|
|
|
--output="$(basename "${1}" .jar).dex" \
|
|
|
|
"${1}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
show_help () {
|
|
|
|
echo -e "
|
|
|
|
** NanoDroid ${VERSION} helper script **
|
|
|
|
|
|
|
|
usage: build-package [opt] [arg]
|
|
|
|
|
|
|
|
setup NanoDroid [! do this first !]:
|
|
|
|
pull | download all required apks for NanoDroid
|
|
|
|
|
|
|
|
update contents:
|
|
|
|
u-microg | update microG and companions
|
|
|
|
u-fdroid | update F-Droid and Extension
|
2018-11-23 22:51:10 +00:00
|
|
|
u-osmand | update OsmAnd and Plugins
|
2018-01-23 20:11:52 +00:00
|
|
|
u-apps | update applications
|
|
|
|
u-swipe | update swipe libraries
|
|
|
|
u-gsync | update Google Sync Adapters
|
|
|
|
|
|
|
|
create zip files:
|
|
|
|
full | create full package zip from repo
|
|
|
|
microg | create microG package zip from repo
|
|
|
|
fdroid | create F-Droid package zip from repo
|
|
|
|
patcher | create framework patcher zip from repo
|
|
|
|
uninstaller | create uninstaller zip from repo
|
|
|
|
setupwizard | create setup-wizard zip from repo
|
2018-11-08 17:27:34 +00:00
|
|
|
bromitewebview | create Bromite WebView zip from repo
|
2018-11-23 23:45:05 +00:00
|
|
|
osmand | create OsmAnd package zip from repo
|
2018-01-23 20:11:52 +00:00
|
|
|
all | create all zips from repo
|
|
|
|
|
|
|
|
misc. stuff:
|
|
|
|
check | check if all files were properly downloaded
|
|
|
|
clean | remove any untracked files from the repo
|
|
|
|
dalvik [jar] | prepare a jar file for dalvikvm usage
|
|
|
|
ver [ver] [date] | bump version
|
|
|
|
bump | bump versionCode in Magisk Modules
|
2019-03-01 19:36:33 +00:00
|
|
|
u-patch | download Haystack patches
|
2018-01-23 20:11:52 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
print_package () {
|
|
|
|
echo "
|
|
|
|
Creating Package
|
|
|
|
|
|
|
|
Type ${1}
|
2019-06-26 18:51:40 +00:00
|
|
|
Name ${ZIP}
|
2019-06-26 18:31:52 +00:00
|
|
|
Directory ${CWD}
|
2018-01-23 20:11:52 +00:00
|
|
|
"
|
2019-06-26 18:51:40 +00:00
|
|
|
|
|
|
|
rm -f "${CWD}/${ZIP}"*
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error () {
|
|
|
|
echo -e "${@}"
|
|
|
|
exit 1
|
|
|
|
}
|
2018-09-23 19:52:47 +00:00
|
|
|
|
|
|
|
sum_sign_package () {
|
2019-06-26 17:55:36 +00:00
|
|
|
cd "${CWD}"
|
2019-07-05 16:02:32 +00:00
|
|
|
cd "$(dirname "${ZIP}")"
|
|
|
|
sha256sum "$(filename "${ZIP}")" > "${ZIP}.sha256"
|
|
|
|
cd "${CWD}"
|
2019-06-26 18:31:52 +00:00
|
|
|
gpg --sign --detach-sign "${ZIP}.sha256"
|
2018-09-23 19:52:47 +00:00
|
|
|
}
|