Created
December 28, 2022 21:42
-
-
Save taikedz/8f519a36897514eb9290f9ac728f2f59 to your computer and use it in GitHub Desktop.
Anbox installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bbrun | |
# Steps obtained from: | |
# https://ubuntuhandbook.org/index.php/2021/10/anbox-run-android-apps-ubuntu/ | |
#%include std/out.sh | |
#%include std/askuser.sh | |
set -euo pipefail | |
load_modules() { | |
sudo kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der /lib/modules/`uname -r`/kernel/drivers/staging/android/ashmem_linux.ko || out:fail $? "Could not sign module" | |
sudo modprobe ashmem_linux || out:fail $? "Could not load ashmem_linux module" | |
sudo modprobe binder_linux || out:fail $? "Could not load binder_linux module" | |
lsmod | grep ashmem_linux || out:fail $? "No ashmem_linux module" | |
lsmod | grep binder_linux || out:fail $? "No binder_linux module" | |
} | |
install_anbox_package() { | |
snap install anbox --beta --devmode | |
} | |
get_playstore_script() { | |
if [[ ! -e install-playstore.sh ]]; then | |
wget https://raw.githubusercontent.com/geeks-r-us/anbox-playstore-installer/master/install-playstore.sh | |
fi | |
} | |
install_playstore() { | |
# Install Google playstore inside anobx | |
sudo apt-get update | |
sudo apt-get install -y wget curl lzip tar unzip squashfs-tools | |
get_playstore_script | |
bash install-playstore.sh | |
} | |
full_install() { | |
askuser:confirm "Install anbox with Google Playstore ?" || out:fail Abort. | |
load_modules | |
install_anbox_package | |
install_playstore | |
out:info "Done." | |
} | |
# ============ | |
main() { | |
if [[ -z "$*" ]]; then | |
full_install | |
fi | |
case "$1" in | |
modules) | |
load_modules ;; | |
snap) | |
install_anbox_package ;; | |
playstore) | |
get_playstore_script | |
if askuser:confirm "Run script ?" ; then | |
install_playstore | |
else | |
out:warn "Skip" | |
return | |
fi | |
;; | |
*) | |
out:error "Unknown operation." | |
out:info "Operations: modules, snap, playstore . Or, run without arguments for full install" | |
;; | |
esac | |
} | |
main "$@" | |
# Uninstall with | |
# snap remove --purge anbox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Transcribed from an article I found online. Untested as of yet. Will some point spin up a VM to do so....