-
Notifications
You must be signed in to change notification settings - Fork 9
/
update-binary
37 lines (26 loc) · 1.26 KB
/
update-binary
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
#!/sbin/sh
# Exit immediately if a command fails
set -e
# Extract the package to a temporary location
unzip -oq ${3} -d "/tmp/BromiteWebViewInstaller"
# Create faux mountpoints
mkdir /picodroid_system
# Mount the neccesary partitions
mount -o rw $(readlink -f $(cd /dev && find /dev/block -type l -name system$(getprop ro.boot.slot_suffix) | head -n 1 )) /picodroid_system
# Copy the overlay to the appropriate location
cp /tmp/BromiteWebViewInstaller/system/product/overlay/treble-overlay-bromite-webview.apk /picodroid_system/system/product/overlay
# Copy the OTA survival script to the appropriate location
if [ -d /picodroid_system/system/addon.d ]
then cp /tmp/BromiteWebViewInstaller/system/addon.d/39-bromite-webview.sh /picodroid_system/system/addon.d
fi
# Make the script executable
chmod 755 /picodroid_system/system/addon.d/39-bromite-webview.sh
# Unmount the previously mounted partitions
umount -l /picodroid_system
# Delete the faux mountpoints
rmdir /picodroid_system
# Clean up the installation files
rm -rf /tmp/BromiteWebViewInstaller
# Inform the user that the update has been successful
echo -e "ui_print Update successfully installed!" >> /proc/self/fd/${2}
echo -e "ui_print You can now install Bromite SystemWebView as a regular app!" >> /proc/self/fd/${2}