qubes-vm-gui: new aport

This commit is contained in:
Antoine Martin 2023-03-07 20:57:46 -05:00 committed by Antoine Martin
parent 287f772cfb
commit 54d2ed4a71
6 changed files with 190 additions and 0 deletions

View file

@ -0,0 +1,22 @@
From 7f7914fc2d0957012f1c4b130b0e442d43110c7d Mon Sep 17 00:00:00 2001
From: "build@apk-groulx" <build@apk-groulx.praxis>
Date: Sat, 5 Mar 2022 00:59:30 +0000
Subject: [PATCH 1/1] initd fix
---
appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh b/appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh
index dc0a578..4c9623a 100755
--- a/appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh
+++ b/appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh
@@ -23,4 +23,4 @@ if [ -n "$debug_mode" ] && [ "$debug_mode" -gt 0 ]; then
gui_opts="$gui_opts -vv"
fi
-echo "GUI_OPTS=$gui_opts" >> /var/run/qubes-service-environment
+echo "GUI_OPTS=\"$gui_opts\"" >> /var/run/qubes-service-environment
--
2.34.1

View file

@ -0,0 +1,24 @@
From 5713c7f16d2634947804a7d7bd4882cba93a21f1 Mon Sep 17 00:00:00 2001
From: "build@apk-groulx" <build@apk-groulx.praxis>
Date: Wed, 2 Mar 2022 17:07:20 +0000
Subject: [PATCH 1/1] musl build
---
gui-agent/vmside.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gui-agent/vmside.c b/gui-agent/vmside.c
index fd76f4d..89a41c8 100644
--- a/gui-agent/vmside.c
+++ b/gui-agent/vmside.c
@@ -50,6 +50,7 @@
#include "list.h"
#include "error.h"
#include "encoding.h"
+#include <string.h>
#include <libvchan.h>
/* Get the size of an array. Error out on pointers. */
--
2.35.1

105
user/qubes-vm-gui/APKBUILD Normal file
View file

@ -0,0 +1,105 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=qubes-vm-gui
subpackages="qubes-vm-pulseaudio $pkgname-openrc"
pkgver=4.1.27
pkgrel=0
_gittag="v$pkgver"
pkgdesc="The Qubes GUI Agent for AppVMs"
arch="x86_64"
url="https://github.com/QubesOS/qubes-gui-agent-linux"
license="GPL"
options="!check" # No testsuite
depends="
libxcomposite
py3-xcffib
xinit
zenity
"
makedepends="
autoconf
automake
gcc
git
libtool
libxcomposite-dev
libxt
linux-pam-dev
make
patch
pixman
pkgconf
pulseaudio-dev
qubes-db-vm
qubes-db-vm-dev
qubes-libvchan-xen-dev
qubes-vm-gui-dev
xen-dev
util-macros
xorg-server-dev
"
source="
$pkgname-$_gittag.tar.gz::https://github.com/QubesOS/qubes-gui-agent-linux/archive/refs/tags/$_gittag.tar.gz
0001-musl-build.patch
0001-initd-fix.patch
qubes-gui-agent.openrc
qubes-sessions.sh
qubes-gui-agent.pam
"
builddir="$srcdir"/qubes-gui-agent-linux-${_gittag/v}
_qubes_backend_vmm=xen
build() {
local pa_ver=$(pkg-config --modversion libpulse 2>/dev/null | cut -f 1 -d "-")
rm -f pulse/pulsecore
ln -s pulsecore-$pa_ver pulse/pulsecore
# Bug fixes : /var/run/console depends on pam_console, which is fedora specific
# As a consequece, /var/run/console does not exists and qubes-gui-agent will always fail
sed 's:ExecStartPre=/bin/touch:#ExecStartPre=/bin/touch:' -i appvm-scripts/qubes-gui-agent.service
# Ensure that qubes-gui-agent starts after user autologin
sed 's/After=\(.*\)qubes-misc-post.service/After=\1qubes-misc-post.service getty.target/' -i appvm-scripts/qubes-gui-agent.service
# Starts qubes-session after X11 start
install -Dm 755 "$srcdir"/qubes-sessions.sh "$pkgdir"/etc/X11/xinit/xinitrc.d/90-qubes-sessions.sh
# Remove broken pam and replace with adequate
install -Dm 644 "$srcdir"/qubes-gui-agent.pam "$pkgdir"/etc/pam.d/qubes-gui-agent
make BACKEND_VMM="$_qubes_backend_vmm" appvm
make appvm
# replace all shebangs with /bin/sh as qubes expects bash
# shellcheck disable=SC2013
for i in $(grep '/bin/sh' -Rl .); do
sed -i 's|/bin/sh|/bin/bash|' "$i"
done
}
package() {
make install-rh-agent DESTDIR="$pkgdir" LIBDIR=/usr/lib USRLIBDIR=/usr/lib SYSLIBDIR=/lib
install -Dm 755 "$srcdir"/qubes-gui-agent.openrc "$pkgdir"/etc/init.d/qubes-gui-agent
}
pulseaudio() {
pkgdesc="Pulseaudio support for Qubes VM"
depends="
alsa-lib
alsa-utils
pulseaudio
pulseaudio-alsa
"
local pa_ver=$(pkg-config --modversion libpulse 2>/dev/null | cut -f 1 -d "-")
cd "$builddir"
make install-pulseaudio DESTDIR=$subpkgdir PA_VER=$pa_ver LIBDIR=/usr/lib USRLIBDIR=/usr/lib SYSLIBDIR=/lib
}
sha512sums="
118f5e94562a04f2f3322708dcf7e21c35e8f8fe8dec8a3cb5fc7c7b8c8948a04e4d26b7ddea1e283dbab13508d2a91792df8c9edb661047e68ce4b2004357e7 qubes-vm-gui-v4.1.27.tar.gz
f0bbb936e14689d0cbced2f564b8911f9287c0217616f02f3bd0c3060e516d080ad538219f089f5841c2b9d18bb4ad8efb63516ddfd46c18b038218378996a7d 0001-musl-build.patch
262b93b4ea172926dc18b7af372168ff3f645a02db1529cb73af3d5aa6252a75500bfbd95344a835bbf646e753018d0e27885e41a03f06247226a485edb5e028 0001-initd-fix.patch
26ea836194332357cdc96744959fa1e0c2064d9194124dac6c140b1cf0f0a79714bff3167ac2284538e8569a4d5a3588978d0050fb005a5a36958092707b6156 qubes-gui-agent.openrc
bd707f7956f58c2bb24ccb9adad1381c069e70820fcb1b01b09dc88570d9df00e0dc92a9ac3b242f828314568d5487257566a6fc61e75e62e010b7e4871f9ea0 qubes-sessions.sh
b512d691f2a6b11fc329bf91dd05ca9c589bbd444308b27d3c87c75262dedf6afc68a9739229249a4bd3d0c43cb1f871eecbb93c4fe559e0f38bdabbffd06ad7 qubes-gui-agent.pam
"

View file

@ -0,0 +1,26 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
cfgfile="/etc/qubes/$RC_SVCNAME.conf"
command="/usr/bin/qubes-gui"
pidfile="/run/qubes/$RC_SVCNAME.pid"
command_background="yes"
output_log="/var/log/qubes/$RC_SVCNAME.log"
error_log="/var/log/qubes/$RC_SVCNAME.err"
depend() {
need qubes-db
}
start_pre() {
checkpath --directory --owner $command_user:qubes --mode 0775 \
/run/qubes /var/log/qubes /var/run/console/user
# start console-kit-daemon
/usr/bin/ck-list-sessions > /dev/null 2>&1
# pretend tha user is at local console
touch /var/run/console/user
/bin/sh -c /usr/lib/qubes/qubes-gui-agent-pre.sh
. /var/run/qubes-service-environment
command_args="$command_args $GUI_OPTS"
export DISPLAY=:0
}

View file

@ -0,0 +1,6 @@
# basic PAM configuration for Alpine.
auth sufficient pam_rootok.so
auth include base-auth
account include base-account
password include base-password
session include base-session-noninteractive

View file

@ -0,0 +1,7 @@
#!/bin/bash
echo "qubes-session initializing..."
exec /usr/bin/qubes-session
echo "qubes-session initialized"