From 9f50a0003ccc56da54a40a83e6361db1131dcfd5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 27 Sep 2014 23:33:02 -0400 Subject: [PATCH] zip-build: fix script to work when called from anywhere This now figures out the root of the fdroidclient project and works there, rather than just working in the root on the project. So it can be run like ./tools/zip-build.sh or (cd tools && ./zip-build.sh) or whatever. I also removed the pointless function, since it is only called once in the script. --- F-Droid/tools/zip-build.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/F-Droid/tools/zip-build.sh b/F-Droid/tools/zip-build.sh index 425ccafaf..2fe6a1082 100755 --- a/F-Droid/tools/zip-build.sh +++ b/F-Droid/tools/zip-build.sh @@ -14,24 +14,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -function create-update-zip { - APK_NAME=$1 - rm -rf "bin/zip/${APK_NAME}"* - mkdir -p bin/zip/${APK_NAME} - cp bin/${APK_NAME}.apk bin/zip/${APK_NAME}/FDroid.apk - mkdir -p bin/zip/${APK_NAME}/META-INF/com/google/android - cp tools/zip-installer bin/zip/${APK_NAME}/META-INF/com/google/android/update-binary - (cd bin/zip/${APK_NAME}; zip -r -X ../${APK_NAME}.zip FDroid.apk META-INF/com/google/android/update-binary) -} +# find the real path to the base of fdroidclient +project_dir=$(cd `echo $0 | sed 's|\(.*\)/.*$|\1|'`/.. && pwd) +cd "$project_dir" + +rm -rf "${project_dir}/bin/zip/" for apk in bin/*.apk do apk=${apk##*/} apk=${apk%%\.apk} - create-update-zip $apk + rm -f bin/${apk}.zip + mkdir -p bin/zip/${apk} + cp bin/${apk}.apk bin/zip/${apk}/FDroid.apk + mkdir -p bin/zip/${apk}/META-INF/com/google/android + cp tools/zip-installer bin/zip/${apk}/META-INF/com/google/android/update-binary + (cd "${project_dir}/bin/zip/${apk}" && \ + zip -r -X ../../${apk}.zip FDroid.apk META-INF/com/google/android/update-binary) done -rm -rf bin/zip/F-Droid-remove* +rm -rf "bin/zip/F-Droid-remove*" mkdir -p bin/zip/F-Droid-remove/META-INF/com/google/android cp tools/zip-uninstaller bin/zip/F-Droid-remove/META-INF/com/google/android/update-binary -(cd bin/zip/F-Droid-remove; zip -r -X ../F-Droid-remove.zip FDroid.apk META-INF/com/google/android/update-binary) +(cd "${project_dir}/bin/zip/F-Droid-remove" && \ + zip -r -X ../../F-Droid-remove.zip FDroid.apk META-INF/com/google/android/update-binary)