Guide - Installing Shizuku

Since we cant actually get root permissions in appsupport, the next best thing would be Shizuku. I thought some of the users here would be interested, especially after the 4.6.0.12 update. Since I mainly use Shizuku for aurora store to automatically install apps without the need to confirm install/update for each and every app over and over (not to be confused with automatic updates). I also use it (with FreezeYou! from F-droid) to freeze some apps that stay active in the background and never respect the setting to be disabled in the background.
I have found this list of apps utilizing Shizuku if anyone’s interested. Many of them are cosmetic and related to Android UI, but, few others we can use in Appsupport.
Normally, (if an android device is not rooted) Shizuku needs to be started after every reboot with adb. Luckily for us we have a system.img that could be easily unpacked.

So,
1-Install Shizuku (available in Aurora store)
From my experience, one should open the app once for the rest to work.

A script then could be found: /home/defaultuser/android_storage/Android/data/moe.shizuku.privileged.api/start.sh

This script activates shiziku - If you’re satisfied with manually activating it after every appsupport reboot/start :
devel-su
appsupport-attach /system/bin/sh /storage/emulated/0/Android/data/moe.shizuku.privileged.api/start.sh
(most probably chmod +x is needed, can’t remember ).

2- To make it permanent, I have created a service(shizuku.rc) that activates the Shiziku start.sh script whenever appsupport is started:

service runapp /system/bin/start.sh class main 
         seclabel u:r:su:s0 user root group root 
         oneshot
 
 on property:dev.bootcomplete=1
         start runapp

3- Unpacked system.img:

  • placed shizuku.rc in /system/etc/init

  • placed start.sh in /system/bin . Not sure if granting it executable permissions is necessary, but thats what I did anyway.

Since this process has to be repeated each time Appsupport gets updated, I’ve made a simple script. It unpacks system.img and repacks it keeping the original one as backup. I put the 2 files needed (start.sh & shizuku.rc) in my working directory and execute as root. Note that squashfs-tools together with lzip should be aleady installed.

11 Likes

Posting @babo’s script here, because files at Mega are much less persistent than Jolla’s forum (in my experience):

#!/bin/sh

set -e

WORK_DIR="/home/defaultuser/work"

echo "Stoping appsupport..."
systemctl stop aliendalvik
sleep 4

echo "Checking if system.img exists..."
if [ ! -f "$WORK_DIR/origsystem.img" ]; then
   echo "copying system.img..."
   cp /opt/appsupport/system.img "$WORK_DIR/origsystem.img"
   echo "system.img copied"
else
   echo "system.img already exists, skipping copy"
fi

echo "extracting system.img..."
  unsquashfs "$WORK_DIR/origsystem.img"

  cp "$WORK_DIR/start.sh" squashfs-root/system/bin/
echo "start.sh copied"

  chmod +x "$WORK_DIR/squashfs-root/system/bin/start.sh"
echo "executable permissions set"

  cp "$WORK_DIR/shizuku.rc" squashfs-root/system/etc/init
echo "shizuku.rc copied"

echo "building new system.img..."
  mksquashfs "$WORK_DIR/squashfs-root" "$WORK_DIR/system.img" -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments

echo "Cleaning up..."
  rm -r -f "$WORK_DIR/squashfs-root"
echo "new system.img built"

while true; do
   read -p "Do you wish to replace the old system.img in /opt/appsupport with the new one? (yes/no): " yn
   case $yn in
   [Yy]* )
     echo "Replacing old system.img in /opt/appsupport..."
     mv "$WORK_DIR/system.img" /opt/appsupport
      break;;
   [Nn]* )
     echo "Operation cancelled. The new system.img will not be moved."
      break;;
   * )
     echo "Please answer yes or no.";;
esac
done
4 Likes

Thanks. Yes that makes sense

Just tried to get it to work using your script, but it unfortunately results in an error:

Stoping appsupport...
Checking if system.img exists...
system.img already exists, skipping copy
extracting system.img...
Filesystem uses lz4 compression, this is unsupported by this version
Decompressors available:
	gzip
	lzo
	xz
	lzma
1 Like