Merge branch 'feature/waydroid' into 'main'

Feature/waydroid

See merge request fabinfra/fabaccess/borepin!90
This commit is contained in:
Mario Voigt 2025-03-18 23:54:38 +01:00
commit 2eb90b095f

122
waydroid-installer.sh Executable file
View File

@ -0,0 +1,122 @@
#!/bin/bash
# This script installs FabAccess Borepin client to Linux using waydroid Android Emulator.
# This script must run as normal user, not as root. However, several commands require sudo permissions!
# If waydroid is already installed, it will try to update the image if a newer one is available
#
# Tested on
# - Fedora 41 @ 14.03.2025 (vmario891)
# - TuxedoOS 24.04 LTS (Debian based)/noble @ 14.03.2025 (vmario891)
# - Ubuntu 24.04 LTS noble @ 18.03.2025 (vmario891)
if [ "$EUID" -eq 0 ]
then echo "Please do not run as root"
exit 1
fi
echo -e "Elevating script for sudo permissions (please enter password, if asked) ..."
sudo echo
BOREPIN_RELEASES="https://gitlab.com/api/v4/projects/20862588/releases/"
echo -e "Getting releases ..."
curl --silent ${BOREPIN_RELEASES} | jq -r '.[]|.tag_name' | sed -e 's/v//'
LATEST_RELEASE=$(curl --silent ${BOREPIN_RELEASES} | jq -r '.[0]|.tag_name' | sed -e 's/release\/v//')
echo -e "\nLatest release: ${LATEST_RELEASE}"
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
PACKMAN="apt-get"
PVENV="python3-venv"
curl -s https://repo.waydro.id | sudo bash > /dev/null
fi
# dnf/rpm based
if [ "$(grep -Ei 'fedora|redhat' /etc/*release)" ]; then
PACKMAN="dnf"
PVENV="python3-virtualenv"
fi
if command -v waydroid 2>&1 >/dev/null; then
echo "waydroid is already installed!"
HASWAYDROID="true"
else
HASWAYDROID="false"
fi
echo -e "Cloning github.com/casualsnek/waydroid_script for libhoudini ..."
git clone https://github.com/casualsnek/waydroid_script > /dev/null 2>&1
if [ ! -d waydroid_script ]; then
echo -e "Error cloning ..."
exit 1
fi
echo -e "Downloading Borepin APK ..."
BOREPIN_APK="org.fab_infra.fabaccess-Signed.apk"
wget --quiet https://gitlab.com/api/v4/projects/20862588/packages/generic/borepin/v$LATEST_RELEASE/$BOREPIN_APK
if [ ! -f $BOREPIN_APK ]; then
echo -e "Error downloading ..."
exit 1
fi
echo -e "Updating and installing packages ..."
if [ $PACKMAN == "apt" ]; then
sudo $PACKMAN update > /dev/null && sudo $PACKMAN upgrade -y
fi
#on Fedora installing a package automatically updates ...
sudo $PACKMAN install -y waydroid wl-clipboard python3-pip $PENV
echo -e "Installing pyclip ..."
sudo pip3 install pyclip --quiet --break-system-packages --root-user-action=ignore
if [ $HASWAYDROID == "false" ]; then
echo -e "Initializing waydroid. This may take a while ..."
sudo waydroid init --system_channel https://ota.waydro.id/system --vendor_channel https://ota.waydro.id/vendor --rom_type lineage --system_type VANILLA
elselse
sudo waydroid upgrade
fi
echo -e "Starting waydroid session (if not running yet)..."
waydroid status | grep STOPPED > /dev/null
if [ $? == 0 ]; then
waydroid session start &
fi
sleep 5 #waiting for it a while
waydroid status | grep RUNNING > /dev/null
if [ $? != 0 ]; then
echo -e "Error starting waydroid session..."
exit 1
fi
echo -e "Configuring waydroid ..."
waydroid prop set persist.waydroid.multi_windows true
if [ $? != 0 ]; then
echo -e "Error starting waydroid session..."
exit 1
fi
waydroid session stop
echo -e "Installing libhoudini ..."
python3 -m venv waydroid_script/venv
waydroid_script/venv/bin/pip3 install --upgrade pip --quiet
waydroid_script/venv/bin/pip3 install -r waydroid_script/requirements.txt --quiet
sudo waydroid_script/venv/bin/python3 waydroid_script/main.py --android-version 11 install libhoudini > /dev/null 2>&1
sudo rm -rf waydroid_script/ > /dev/null
sleep 5
echo -e "Installing Borepin ..."
sudo systemctl restart waydroid-container.service
waydroid session start &
sleep 5
waydroid app install $BOREPIN_APK
rm $BOREPIN_APK > /dev/null
sleep 5
echo -e "Starting Borepin ..."
waydroid app launch org.fab_infra.fabaccess &
sleep 5
echo -e "If Borepin does not appear, you can launch it from start menu (entry 'FabAccess') or by commandline: 'waydroid app launch org.fab_infra.fabaccess &'"