diff --git a/README.md b/README.md index 3e4bf291..296ef4cc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,31 @@ [![CodeFactor](https://www.codefactor.io/repository/github/thatmg393/udroid-download/badge/main)](https://www.codefactor.io/repository/github/thatmg393/udroid-download/overview/main) # udroid-download +An ( fs-cook & debootstrap ) wrapper to build udroid with cmdline. +## Ubuntu Plucky GNOME X11 image +The `plucky/gnomeRaw` target builds an ARM64 Ubuntu Plucky GNOME desktop +image for Termux:X11. GNOME is launched with Mesa's `llvmpipe` software +renderer and GTK's Cairo renderer by default. The launcher clears conflicting +VirGL/KGSL/Turnip loader overrides before starting GNOME. -An ( fs-cook & debootstrap ) wrapper to build udroid with cmdline +Build it with: + +```sh +sudo bash build.sh -s plucky -v gnomeRaw -a arm64 +``` + +The image is written to +`fs-cook/out/plucky-gnomeRaw-arm64.tar.gz`. After extracting the rootfs and +starting Termux:X11, launch GNOME from the rootfs with: + +```sh +udroid-gnome-x11 +``` + +The `udroid-gnome-x11` launcher starts the system D-Bus when needed, creates a +per-user runtime directory, checks the X11 connection, and starts a fresh +session D-Bus for GNOME. It intentionally uses CPU rendering; it does not +attempt to enable VirGL or direct KGSL acceleration. ## Resolute Plasma image diff --git a/suites/plucky/gnomeRaw/.architectures b/suites/plucky/gnomeRaw/.architectures new file mode 100644 index 00000000..d4000675 --- /dev/null +++ b/suites/plucky/gnomeRaw/.architectures @@ -0,0 +1 @@ +arm64 diff --git a/suites/plucky/gnomeRaw/gnomeRaw-cleanup.sh b/suites/plucky/gnomeRaw/gnomeRaw-cleanup.sh new file mode 100644 index 00000000..2c72298f --- /dev/null +++ b/suites/plucky/gnomeRaw/gnomeRaw-cleanup.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +apt-get clean +rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*.deb diff --git a/suites/plucky/gnomeRaw/gnomeRaw-extras.sh b/suites/plucky/gnomeRaw/gnomeRaw-extras.sh new file mode 100644 index 00000000..2e5f1ba4 --- /dev/null +++ b/suites/plucky/gnomeRaw/gnomeRaw-extras.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +export DEBIAN_FRONTEND=noninteractive + +apt-get install -y \ + gnome-system-monitor gnome-text-editor gnome-calculator gnome-calendar \ + gnome-clocks file-roller evince yaru-theme-icon diff --git a/suites/plucky/gnomeRaw/gnomeRaw-fixes.sh b/suites/plucky/gnomeRaw/gnomeRaw-fixes.sh new file mode 100644 index 00000000..2e03bccc --- /dev/null +++ b/suites/plucky/gnomeRaw/gnomeRaw-fixes.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +# PRoot does not provide systemd/logind. GNOME 48 may detect the installed +# login1 service and ask D-Bus to start it; that activation fails inside +# Android PRoot and aborts GNOME Shell initialization. Keep the service file +# for reference, but move it out of D-Bus's system-services search directory. +login1_service=/usr/share/dbus-1/system-services/org.freedesktop.login1.service +if [[ -e "$login1_service" || -L "$login1_service" ]]; then + mkdir -p /root/login1-disabled + mv -f "$login1_service" /root/login1-disabled/ +fi + +mkdir -p /etc/profile.d /etc/dconf/profile /etc/dconf/db/local.d +cat > /etc/dconf/profile/user <<'PROFILE' +user-db:user +system-db:local +PROFILE + +if command -v dconf >/dev/null 2>&1; then + dconf update || true +fi + +cat > /usr/local/bin/udroid-gnome-x11 <<'LAUNCH' +#!/usr/bin/env bash +set -Eeuo pipefail + +die() { + printf '[udroid-gnome] ERROR: %s\n' "$*" >&2 + exit 1 +} + +# Do not inherit experimental VirGL, KGSL, Turnip, or custom Mesa loader +# settings. Those settings caused Mutter to lose its rendering connection. +unset MESA_LOADER_DRIVER_OVERRIDE +unset FD_FORCE_KGSL +unset TURNIP_KMD +unset VK_ICD_FILENAMES +unset VK_LOADER_LAYERS_DISABLE +unset LD_LIBRARY_PATH +unset LIBGL_DRIVERS_PATH +unset EGL_DRIVERS_PATH +unset __EGL_VENDOR_LIBRARY_FILENAMES +unset DBUS_SESSION_BUS_ADDRESS +unset DBUS_SYSTEM_BUS_ADDRESS + +export DISPLAY="${DISPLAY:-:0}" +export XDG_SESSION_TYPE=x11 +export XDG_CURRENT_DESKTOP=GNOME +export XDG_SESSION_DESKTOP=gnome +export DESKTOP_SESSION=gnome +export LIBGL_ALWAYS_SOFTWARE=1 +export GALLIUM_DRIVER=llvmpipe +export GSK_RENDERER=cairo +export GDK_BACKEND=x11 + +# A private runtime directory is required by modern GNOME. Allow an explicit +# override, otherwise keep each Unix user in a separate directory. +export XDG_RUNTIME_DIR="${UDROID_GNOME_RUNTIME_DIR:-/tmp/gnome-runtime-$(id -u)}" +mkdir -p "$XDG_RUNTIME_DIR" || die "cannot create $XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" || die "cannot secure $XDG_RUNTIME_DIR" + +if ! command -v gnome-shell >/dev/null 2>&1; then + die "gnome-shell is not installed" +fi + +if command -v xdpyinfo >/dev/null 2>&1 && + ! xdpyinfo -display "$DISPLAY" >/dev/null 2>&1; then + die "cannot connect to the X server at DISPLAY=$DISPLAY; start Termux:X11 first" +fi + +# Ensure the machine ID exists before starting a system bus. +if command -v dbus-uuidgen >/dev/null 2>&1; then + dbus-uuidgen --ensure=/etc/machine-id +fi + +# Make sure the system bus is healthy without killing an already-working bus. +if ! dbus-send --system --print-reply \ + --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames \ + >/dev/null 2>&1; then + mkdir -p /run/dbus + rm -f /run/dbus/pid /run/dbus/system_bus_socket + + if command -v service >/dev/null 2>&1; then + service dbus start || true + fi + + if ! dbus-send --system --print-reply \ + --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames \ + >/dev/null 2>&1; then + dbus-daemon --system --fork --nopidfile --nosyslog || + die "could not start the system D-Bus daemon" + fi +fi + +dbus-send --system --print-reply \ + --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames \ + >/dev/null 2>&1 || die "the system D-Bus is not responding" + +exec dbus-run-session -- gnome-shell --x11 --sm-disable +LAUNCH +chmod 0755 /usr/local/bin/udroid-gnome-x11 + +cat > /root/start-gnome.sh <<'LAUNCH' +#!/usr/bin/env bash +exec /usr/local/bin/udroid-gnome-x11 "$@" +LAUNCH +chmod 0755 /root/start-gnome.sh diff --git a/suites/plucky/gnomeRaw/gnomeRaw-setup.sh b/suites/plucky/gnomeRaw/gnomeRaw-setup.sh new file mode 100644 index 00000000..1c916a24 --- /dev/null +++ b/suites/plucky/gnomeRaw/gnomeRaw-setup.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +export DEBIAN_FRONTEND=noninteractive + +# Suppress service startup only while packages are installed in the image. +# Restore any pre-existing policy-rc.d (or remove ours) even if APT fails. +policy_file=/usr/sbin/policy-rc.d +policy_backup=/tmp/udroid-policy-rc.d.backup +had_policy=false +if [[ -e "$policy_file" || -L "$policy_file" ]]; then + cp -a "$policy_file" "$policy_backup" + had_policy=true +else + rm -f "$policy_backup" +fi + +restore_policy_rc_d() { + if [[ "$had_policy" == true ]]; then + rm -f "$policy_file" + mv -f "$policy_backup" "$policy_file" + else + rm -f "$policy_file" "$policy_backup" + fi +} +trap restore_policy_rc_d EXIT + +mkdir -p /usr/sbin +cat > "$policy_file" <<'POLICY' +#!/bin/sh +exit 101 +POLICY +chmod 0755 "$policy_file" + +apt-get update +apt-get install -y \ + gnome-core gnome-shell gnome-control-center nautilus gnome-terminal \ + gnome-shell-extensions gnome-shell-extension-ubuntu-dock \ + dbus dbus-bin dbus-x11 dconf-cli xorg xauth x11-utils x11-xserver-utils \ + mesa-utils libgl1-mesa-dri libglx-mesa0 libegl1 libgles2 libgbm1 libdrm2 \ + locales network-manager sudo nano wget curl git ca-certificates \ + fonts-ubuntu fonts-noto-color-emoji + +restore_policy_rc_d +trap - EXIT + +locale-gen en_US.UTF-8 || true +update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 || true + +mkdir -p /etc/profile.d +cat > /etc/profile.d/gnome-termux-x11.sh <<'PROFILE' +# Defaults for GNOME running against a Termux:X11 display. +export DISPLAY="${DISPLAY:-:0}" +export XDG_CURRENT_DESKTOP=GNOME +export XDG_SESSION_DESKTOP=gnome +export DESKTOP_SESSION=gnome + +# Use Mesa's CPU renderer. VirGL/KGSL overrides are handled by the launcher. +export LIBGL_ALWAYS_SOFTWARE=1 +export GALLIUM_DRIVER=llvmpipe +export GSK_RENDERER=cairo +PROFILE +chmod 0644 /etc/profile.d/gnome-termux-x11.sh diff --git a/suites/plucky/gnomeRaw/gnomeRaw.sh b/suites/plucky/gnomeRaw/gnomeRaw.sh new file mode 100644 index 00000000..2c6b94a4 --- /dev/null +++ b/suites/plucky/gnomeRaw/gnomeRaw.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +set -Ee + +# fs-cook variant entry point for the Plucky GNOME X11 image. +source plugins/envsetup + +SUITE=plucky +VARIENT=gnomeRaw +frn=out/plucky-gnomeRaw +OVERRIDER_COMPRESSION_TYPE=gzip +ENABLE_EXIT=true +ENABLE_USER_SETUP=false + +additional_setup() { + # Plucky is built for ARM64 using the same Ports mirror used by the + # Plucky rootfs. Keep this list aligned with the release's supported pockets. + cat > "$chroot_dir/etc/apt/sources.list" <