add waydroid (#585)

Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
Nyx 2024-09-22 12:03:43 -04:00 committed by GitHub
parent cca2660c3b
commit e82fd82850
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 86 additions and 0 deletions

View File

@ -107,6 +107,16 @@ name = "Rofi"
description = "Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that started as a clone of simpleswitcher, written by Sean Pringle and later expanded by Dave Davenport.\nThis command installs and configures rofi with configuration from CTT's DWM repo.\nhttps://github.com/ChrisTitusTech/dwm-titus"
script = "rofi-setup.sh"
[[data]]
name = "Waydroid"
description = "Waydroid is an emulator that allows you to run Android apps and games on Linux."
script = "waydroid-setup.sh"
[[data.preconditions]]
matches = true
data = { environment = "XDG_SESSION_TYPE" }
values = [ "wayland", "Wayland" ]
[[data]]
name = "ZSH Prompt"
description = "The Z shell is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.\nThis command installs ZSH prompt and provides basic configuration."

View File

@ -0,0 +1,76 @@
#!/bin/sh -e
. ../common-script.sh
checkGpu() {
if lspci | grep -i nvidia > /dev/null; then
printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}"
exit 1
fi
}
installWaydroid() {
if ! command_exists waydroid; then
printf "%b\n" "${YELLOW}Installing Waydroid...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm waydroid
if command_exists dkms; then
"$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
"$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
fi
;;
apt-get|nala)
curl https://repo.waydro.id | "$ESCALATION_TOOL" sh
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
if command_exists dkms; then
"$ESCALATION_TOOL" "$PACKAGER" install -y git
mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
cd "$HOME/.local/share/anbox-modules"
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
"$ESCALATION_TOOL" cp 99-anbox.rules /lib/udev/rules.d/
"$ESCALATION_TOOL" cp -rT ashmem /usr/src/anbox-ashmem-1
"$ESCALATION_TOOL" cp -rT binder /usr/src/anbox-binder-1
"$ESCALATION_TOOL" dkms install anbox-ashmem/1
"$ESCALATION_TOOL" dkms install anbox-binder/1
fi
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
if command_exists dkms; then
"$ESCALATION_TOOL" "$PACKAGER" install -y git
mkdir -p "$HOME/.local/share/" # only create it if it doesnt exist
git clone https://github.com/choff/anbox-modules.git "$HOME/.local/share/anbox-modules"
cd "$HOME/.local/share/anbox-modules"
"$ESCALATION_TOOL" cp anbox.conf /etc/modules-load.d/
"$ESCALATION_TOOL" cp 99-anbox.rules /lib/udev/rules.d/
"$ESCALATION_TOOL" cp -rT ashmem /usr/src/anbox-ashmem-1
"$ESCALATION_TOOL" cp -rT binder /usr/src/anbox-binder-1
"$ESCALATION_TOOL" dkms install anbox-ashmem/1
"$ESCALATION_TOOL" dkms install anbox-binder/1
fi
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
exit 1
;;
esac
else
printf "%b\n" "${GREEN}Waydroid is already installed.${RC}"
fi
}
setupWaydroid() {
printf "%b\n" "${YELLOW}Setting up Waydroid...${RC}"
"$ESCALATION_TOOL" systemctl enable --now waydroid-container
"$ESCALATION_TOOL" waydroid init
printf "%b\n" "${GREEN}Waydroid setup complete.${RC}"
}
checkEnv
checkEscalationTool
checkAURHelper
checkGpu
installWaydroid
setupWaydroid