Create zips to install and remove F-Droid as system app
Adds a script zip-build.sh which creates CWM-flashable zips to install/update and remove F-Droid as system/privileged app.
This commit is contained in:
parent
77419183ec
commit
3e5f3d45a6
37
tools/zip-build.sh
Executable file
37
tools/zip-build.sh
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
# Copyright 2014 Ron Rieve
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
for apk in bin/*.apk
|
||||||
|
do
|
||||||
|
apk=${apk##*/}
|
||||||
|
apk=${apk%%\.apk}
|
||||||
|
create-update-zip $apk
|
||||||
|
done
|
||||||
|
|
||||||
|
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)
|
56
tools/zip-installer
Executable file
56
tools/zip-installer
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
|
||||||
|
# Copyright 2013 Koushik Dutta, 2014 Ron Rieve
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# arg 1 is recovery api version, generally 3.
|
||||||
|
# arg 2 is the pipe fd, to the recovery binary.
|
||||||
|
# communicate with it using the recovery api.
|
||||||
|
# arg 3 is the zip file
|
||||||
|
|
||||||
|
echo -n -e 'ui_print Installing F-Droid...\n' > /proc/self/fd/$2
|
||||||
|
echo -n -e 'ui_print\n' > /proc/self/fd/$2
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
mkdir fdroid
|
||||||
|
cd fdroid
|
||||||
|
unzip -o "$3"
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
cp /cache/FDroid.apk .
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount /system
|
||||||
|
rm -f /system/app/FDroid.*
|
||||||
|
rm -f /system/priv-app/FDroid.*
|
||||||
|
|
||||||
|
|
||||||
|
# if the system is < 4.4, a system app has to be in /system/app
|
||||||
|
# if the system is >= 4.4, a privileged (new name for system) app has to be in /system/priv-app
|
||||||
|
BUILD_RELEASE_VERSION="$(grep 'ro\.build\.version\.release' /system/build.prop)"
|
||||||
|
VERSION="${BUILD_RELEASE_VERSION##*=}"
|
||||||
|
MAJ=${VERSION%%.*}
|
||||||
|
MIN=${VERSION#*.}
|
||||||
|
MIN=${MIN//.*}
|
||||||
|
|
||||||
|
if [ "${MAJ}${MIN}" -ge 44 ]
|
||||||
|
then
|
||||||
|
INSTDIR="/system/priv-app"
|
||||||
|
else
|
||||||
|
INSTDIR="/system/app"
|
||||||
|
fi
|
||||||
|
cp FDroid.apk ${INSTDIR}
|
||||||
|
chmod 644 ${INSTDIR}/FDroid.apk
|
||||||
|
|
||||||
|
umount /system
|
38
tools/zip-uninstaller
Executable file
38
tools/zip-uninstaller
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
|
||||||
|
# Copyright 2013 Koushik Dutta, 2014 Ron Rieve
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# arg 1 is recovery api version, generally 3.
|
||||||
|
# arg 2 is the pipe fd, to the recovery binary.
|
||||||
|
# communicate with it using the recovery api.
|
||||||
|
# arg 3 is the zip file
|
||||||
|
|
||||||
|
echo -n -e 'ui_print Removing system instances of F-Droid...\n' > /proc/self/fd/$2
|
||||||
|
echo -n -e 'ui_print\n' > /proc/self/fd/$2
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
mkdir fdroid
|
||||||
|
cd fdroid
|
||||||
|
unzip -o "$3"
|
||||||
|
if [ "$?" -ne "0" ]
|
||||||
|
then
|
||||||
|
cp /cache/FDroid.apk .
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount /system
|
||||||
|
rm -f /system/app/FDroid.*
|
||||||
|
rm -f /system/priv-app/FDroid.*
|
||||||
|
|
||||||
|
umount /system
|
Loading…
x
Reference in New Issue
Block a user