-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathupdate.sh
141 lines (120 loc) · 4.51 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
set -e
repo="https://f-droid.org/repo/"
addCopy() {
addition=""
if [ "$2" == org.mozilla.fennec_fdroid ];then
unzip bin/$1 lib/*
addition="
LOCAL_PREBUILT_JNI_LIBS := \\
$(unzip -lv bin/$1 |grep -v Stored |sed -nE 's;.*(lib/arm64-v8a/.*);\t\1 \\;p')
"
fi
if [ "$2" == com.google.android.gms ] || [ "$2" == com.android.vending ] ;then
addition="LOCAL_PRIVILEGED_MODULE := true"
fi
cat >> Android.mk <<EOF
include \$(CLEAR_VARS)
LOCAL_MODULE := $2
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := bin/$1
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_OVERRIDES_PACKAGES := $3
$addition
$(aapt d badging "bin/$1" |sed -nE "s/uses-library-not-required:'(.*)'/LOCAL_OPTIONAL_USES_LIBRARIES += \1/p")
$(aapt d badging "bin/$1" |sed -nE "s/uses-library:'(.*)'/LOCAL_USES_LIBRARIES += \1/p")
include \$(BUILD_PREBUILT)
EOF
echo -e "\t$2 \\" >> apps.mk
}
addMultiarch() {
cat >> Android.mk <<EOF
include \$(CLEAR_VARS)
LOCAL_MODULE := $1
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_OVERRIDES_PACKAGES := $3
LOCAL_SRC_FILES := bin/\$(LOCAL_MODULE)_$2_\$(my_src_arch).apk
$addition
$(aapt d badging "bin/$1_$2_arm64.apk" |sed -nE "s/uses-library-not-required:'(.*)'/LOCAL_OPTIONAL_USES_LIBRARIES += \1/p")
$(aapt d badging "bin/$1_$2_arm64.apk" |sed -nE "s/uses-library:'(.*)'/LOCAL_USES_LIBRARIES += \1/p")
include \$(BUILD_PREBUILT)
EOF
echo -e "\t$1 \\" >> apps.mk
}
rm -Rf apps.mk lib
cat > Android.mk <<EOF
LOCAL_PATH := \$(my-dir)
my_archs := arm arm64 x86 x86_64
my_src_arch := \$(call get-prebuilt-src-arch, \$(my_archs))
EOF
echo -e 'PRODUCT_PACKAGES += \\' > apps.mk
mkdir -p bin
#downloadFromFdroid packageName overrides
downloadFromFdroid() {
mkdir -p tmp
[ "$oldRepo" != "$repo" ] && rm -f tmp/index.xml
oldRepo="$repo"
if [ ! -f tmp/index.xml ];then
#TODO: Check security keys
wget --connect-timeout=10 $repo/index.jar -O tmp/index.jar
unzip -p tmp/index.jar index.xml > tmp/index.xml
fi
marketversion="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]' -v ./marketversion tmp/index.xml || true)"
nativecodes="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[version="'"$marketversion"'"]' -v nativecode -o ' ' tmp/index.xml || true)"
# If packages have separate nativecodes
if echo "$nativecodes" |grep -q arm && ! echo "$nativecodes" |grep -q ',' ;then
for native in $nativecodes;do
newNative="$(echo $native |sed -e s/arm64-v8a/arm64/g -e s/armeabi-v7a/arm/g)"
apk="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[version="'"$marketversion"'" and nativecode="'"$native"'"]' -v ./apkname tmp/index.xml)"
localName="${1}_${marketversion}_${newNative}.apk"
if [ ! -f bin/$localName ];then
while ! wget --connect-timeout=10 $repo/$apk -O bin/$localName;do sleep 1;done
fi
done
addMultiarch $1 $marketversion "$2"
else
apk="$(xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[version="'"$marketversion"'"]' -v ./apkname tmp/index.xml || xmlstarlet sel -t -m '//application[id="'"$1"'"]/package[1]' -v ./apkname tmp/index.xml)"
if [ ! -f bin/$apk ];then
while ! wget --connect-timeout=10 $repo/$apk -O bin/$apk;do sleep 1;done
fi
addCopy $apk $1 "$2"
fi
}
#phh's Superuser
downloadFromFdroid me.phh.superuser
#Navigation
downloadFromFdroid net.osmand.plus
#Web browser
# downloadFromFdroid org.mozilla.fennec_fdroid "Browser2 QuickSearchBox"
#Calendar
downloadFromFdroid ws.xsoh.etar Calendar
#Pdf viewer
downloadFromFdroid com.artifex.mupdf.viewer.app
#Play Store download
downloadFromFdroid com.aurora.store
#Mail client
downloadFromFdroid com.fsck.k9 "Email"
#Ciphered Instant Messaging
#downloadFromFdroid im.vector.alpha
#Calendar/Contacts sync
downloadFromFdroid com.etesync.syncadapter
#Nextcloud client
downloadFromFdroid com.nextcloud.client
downloadFromFdroid com.simplemobiletools.gallery.pro "Photos Gallery Gallery2"
downloadFromFdroid com.aurora.adroid
downloadFromFdroid org.openbmap
repo=https://microg.org/fdroid/repo/
downloadFromFdroid com.google.android.gms
downloadFromFdroid com.google.android.gsf
downloadFromFdroid com.android.vending
repo=https://archive.newpipe.net/fdroid/repo/
#YouTube viewer
downloadFromFdroid org.schabi.newpipe
repo=https://fdroid.bromite.org/fdroid/repo/
downloadFromFdroid org.bromite.bromite "Browser2 QuickSearchBox"
downloadFromFdroid org.bromite.webview "WebView webview"
echo >> apps.mk
rm -Rf tmp