Skip to content

Instantly share code, notes, and snippets.

@cniw
Last active April 18, 2024 15:59
Show Gist options
  • Save cniw/7a0220ce8b75368f7f57aa422d3fea97 to your computer and use it in GitHub Desktop.
Save cniw/7a0220ce8b75368f7f57aa422d3fea97 to your computer and use it in GitHub Desktop.
Install Waydroid on unsupported Debian based distro caused by incompatible python3-gbinder package
#!/bin/bash
# script name: install_waydroid.sh
# description: Install Waydroid on unsupported Debian based distro caused by incompatible python3-gbinder package
# related to : https://github.com/waydroid/waydroid/issues/214#issuecomment-1120926304
# author : Wachid Adi Nugroho <wachidadinugroho.maya@gmail.com>
# date : 2022-07-07
export distro=$(grep -oP '(?<=^NAME=).*' /etc/os-release)
if [[ -f /usr/bin/dpkg ]];
then
export arch=$(dpkg --print-architecture)
if ! ([[ $arch == "amd64" ]] || [[ $arch == "arm64" ]]);
then
echo "You're using $arch machine, currently waydroid repo only provides deb packages for amd64 and arm64 machine."
echo "If you're really want to install waydroid on this $arch machine you should build it with all the dependencies."
echo "Go check this link https://gist.github.com/cniw/98e204d7dbc73a3fa1bf61629b2a2fc1 or just run this command"
echo -e "\n \`curl -s https://gist.githubusercontent.com/cniw/98e204d7dbc73a3fa1bf61629b2a2fc1/raw | bash\`\n"
exit 0
fi
[[ ${distro} =~ Debian ]] && \
export codename=bullseye || \
export codename=focal
[[ ! -f /usr/bin/curl ]] && sudo apt install -y curl
sudo curl https://repo.waydro.id/waydroid.gpg -o /usr/share/keyrings/waydroid.gpg
echo "deb [signed-by=${_}] https://repo.waydro.id/ ${codename} main" | \
sudo tee /etc/apt/sources.list.d/waydroid.list
sudo apt update
sudo apt install -y \
build-essential cdbs devscripts equivs fakeroot \
git git-buildpackage git-lfs \
libgbinder-dev
mkdir ~/build-packages
cd ${_}
git clone https://github.com/waydroid/gbinder-python.git
cd gbinder-python
curl https://raw.githubusercontent.com/MrCyjaneK/waydroid-build/main/build_changelog -o build_changelog
bash ${_} $(git tag -l --sort=authordate | sed 's/[a-z/]//g' | uniq | tail -n1)
sudo mk-build-deps -ir -t "apt -o Debug::pkgProblemResolver=yes -y --no-install-recommends"
sudo debuild -b -uc -us
sudo apt install -f -y ../*.deb
sudo apt remove -y gbinder-python-build-deps libgbinder-dev \
git-buildpackage git-lfs fakeroot equivs devscripts cdbs
echo "You can remove git and build-essential packages too, by run:"
echo -e "\t\`sudo apt remove git build-essential\`"
sudo apt autoremove
sudo apt install -y waydroid
else
echo "Your distro ${distro} is not use dpkg as package manager"
fi
@suoko
Copy link

suoko commented Jun 11, 2022

...
dpkg-buildpackage: info: source package gbinder-python-build-deps
dpkg-buildpackage: info: source version 1.0.0-2+git.202109121608
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Equivs Dummy Package Generator <root@ubu>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules clean
dh clean
   dh_clean
error: Found argument '-r' which wasn't expected, or isn't valid in this context

USAGE:
    fd [FLAGS/OPTIONS] [<pattern>] [<path>...]

For more information try --help
dh_clean: error: find .  \( \( \
                \( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS -o -path .\*/.pc -o -path .\*/_darcs \) -prune -o -type f -a \
                \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
                 -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
                 -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
                 -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
                \) -exec rm -f {} + \) -o \
                \( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \) returned exit code 1
make: *** [debian/rules:3: clean] Error 1
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
Error in the build process: exit status 2
dpkg: error: cannot access archive 'gbinder-python-build-deps_1.0.0-2+git.202109121608_all.deb': No such file or directory
mk-build-deps: dpkg --unpack failed
 dpkg-buildpackage -us -uc -ui -b

@cniw
Copy link
Author

cniw commented Jun 11, 2022

error: Found argument '-r' which wasn't expected, or isn't valid in this context

USAGE:
fd [FLAGS/OPTIONS] [] [...]

For more information try --help
dh_clean: error: find . ( ( \

@suoko I guess it's because you're using the fd command instead of ordinary find maybe use alias or something like that but the -r option doesn't provided in the fd command, so please try to unset their alias.

@whipplej5
Copy link

how to run this script:

curl -s https://gist.githubusercontent.com/cniw/7a0220ce8b75368f7f57aa422d3fea97/raw | bash

copy this line, paste in your terminal then press enter to run

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

I thought maybe I did something wrong so reflashed the SD and tried again..... same results. I guess it needs more than 128 G to run this script? Or am I doing something wrong?

@cniw
Copy link
Author

cniw commented Jun 26, 2022

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

check disk usage with df

df -h | grep -E "Filesystem|^/dev"

or for more details use apps like ncdu or gdu

sudo apt install -y gdu
sudo gdu -d  # to select the partition, use keyboard arrow key to navigate and `q` key to quit
sudo gdu /   # to scan all

I guess it needs more than 128 G to run this script?

no, i think it just need couple KB for gbinder-python source and still less than 250MB for all build deps package and build disk space requirement

Or am I doing something wrong?

i don't know

@whipplej5 btw does the script running or stuck on which step?

@whipplej5
Copy link

whipplej5 commented Jun 26, 2022

I tried running this on a fresh Mobian bookworm install on a 128G SD card on a Pinephone Pro. It filled the whole card and then the system crashed due to no disk space.

check disk usage with df

df -h | grep -E "Filesystem|^/dev"

or for more details use apps like ncdu or gdu

sudo apt install -y gdu
sudo gdu -d  # to select the partition, use keyboard arrow key to navigate and `q` key to quit
sudo gdu /   # to scan all

I guess it needs more than 128 G to run this script?

no, i think it just need couple KB for gbinder-python source and still less than 250MB for all build deps package and build disk space requirement

Or am I doing something wrong?

i don't know

@whipplej5 btw does the script running or stuck on which step?

My apologies. I failed to expand the partitions after I flashed the SD card so was not utilizing the whole card. I should have looked into this further before requesting help. Thanks so much for your time.

@SoulInfernoDE
Copy link

Hey thanks for the script. Unfortunately it didn't work on linux mint 21.1 (ubuntu 22.04) so i tried to fix some errors which now seems to work for me at least.

🔗 install_waydroid.sh : fixed

@38github
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment