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.
This commit is contained in:
Hans-Christoph Steiner 2014-09-27 23:33:02 -04:00
parent f538e0da8c
commit 9f50a0003c

View File

@ -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)