[4.2] qubes-vm-core: add alpine update availability check #235

Merged
forge merged 1 commit from qubes-vm-core/add-status-check into r4.2 2025-07-11 03:59:07 +00:00
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,68 @@
From fa6694b8a53fac8be0424279676155441c48eb4b Mon Sep 17 00:00:00 2001
From: Ali Mirjamali <ali@mirjamali.com>
Date: Sat, 31 May 2025 22:21:05 +0330
Subject: [PATCH] Add Alpine (APK) Updates availability check
related: https://github.com/QubesOS/qubes-issues/issues/7323
---
network/update-proxy-configs | 25 +++++++++++++++++++++++
package-managers/upgrades-installed-check | 10 +++++++++
2 files changed, 35 insertions(+)
diff --git a/network/update-proxy-configs b/network/update-proxy-configs
index 7c38d557..f0ee5344 100755
--- a/network/update-proxy-configs
+++ b/network/update-proxy-configs
@@ -139,6 +139,31 @@ EOF
fi
+# APK (Aplinelinux) also
+if [ -e /etc/alpine-release ]; then
+ if [ -n "$PROXY_ADDR" ]; then
+ mkdir -p /run/qubes/bin
+ cat > /run/qubes/bin/apk <<EOF
+#!/bin/bash
+### This file is automatically generated by Qubes ($0 script).
+### All modifications here will be lost.
+http_proxy="$PROXY_ADDR" \\
+https_proxy="$PROXY_ADDR" \\
+/sbin/apk "\$@"
+EOF
+ chmod +x /run/qubes/bin/apk
+ cat > /etc/profile.d/qubes-proxy.sh << EOF
+### This file is automatically generated by Qubes ($0 script).
+### All modifications here will be lost.
+export PATH=/run/qubes/bin:\$PATH
+EOF
+ else
+ rm -f /run/qubes/bin/apk
+ rm -f /etc/profile.d/qubes-proxy.sh
+ fi
+fi
+
+
# DNF configuration doesn't support including other files
# https://bugzilla.redhat.com/show_bug.cgi?id=1352234
if [ -e /etc/dnf/dnf.conf ]; then
diff --git a/package-managers/upgrades-installed-check b/package-managers/upgrades-installed-check
index 028d9633..8bf87dd2 100755
--- a/package-managers/upgrades-installed-check
+++ b/package-managers/upgrades-installed-check
@@ -52,6 +52,16 @@ elif [ -e /etc/gentoo-release ]; then
emerge_output="$(emerge -puDv @world 2>&1)"
exit_code="$?"
echo "$emerge_output" | grep -qF -- '[ebuild' && echo "false" || echo "true"
+elif [ -e /etc/alpine-release ]; then
+ ## Alpine and APK based distros
+ set -e
+ set -o pipefail
+ if ! $skip_refresh; then
+ sudo apk update -q >&2
+ fi
+ upgrades="$(apk list --upgradable)"
+ exit_code="$?"
+ [ -n "${upgrades}" ] && echo "false" || echo "true"
else
echo "Check not implemented for this distribution" >&2
exit 1

View file

@ -67,6 +67,7 @@ makedepends="
options="suid"
source="
$pkgname-$_gittag.tar.gz::https://github.com/QubesOS/qubes-core-agent-linux/archive/refs/tags/$_gittag.tar.gz
577-add-alpine-updates-availability-check.patch
qubes-core-early.openrc
qubes-core-netvm.openrc
qubes-core.openrc
@ -121,6 +122,10 @@ package() {
install -dm755 "$pkgdir"/etc/bash
ln -s /etc/profile.d/apk-proxy.sh "$pkgdir"/etc/bash/apk-proxy.sh
# Install upgrade check scripts
install -m 0755 "package-managers/upgrades-installed-check" "$pkgdir"/usr/lib/qubes/
install -m 0755 "package-managers/upgrades-status-notify" "$pkgdir"/usr/lib/qubes/
for i in $source; do
case $i in
*.openrc) install -Dm755 "$srcdir"/$i \
@ -168,6 +173,7 @@ root() {
}
sha512sums="
a93bc095c98680fdfa632c02e5c87630ac731ab2de441ae6affc6ad18865075f4937412c937453c83092af16825e60a1191991cc26f1bbf6b05b1a07709e7c58 qubes-vm-core-v4.2.42.tar.gz
ab656c3262c7c006c40fa2007e765e1dade6fae87553afd6b85873cfaa9a75f4748a164a7168d14f8041799f9dbd0074e079e7f7a70c634f77eef25a61b8b938 577-add-alpine-updates-availability-check.patch
95c080a593ca1cd457ffafc0cdd6ee28999c72f67191a3955b6081a4a7d287cae4cd0c626139562e5e1eb55516c25402a174e3599daf7d4cb259d6b4bbdff155 qubes-core-early.openrc
61529413a16b7fa0df691c24adc41b90477c01ea70d572921ecec89df23932e5a2e60c4e73b9a84181dc30424e2e6af4ad1c7dcf6c42689c3cc346a9923d6e07 qubes-core-netvm.openrc
da8e293520f5fce29ce76d7586e8ce1a4164798a1214079fb554c690264da1d774fdad3f45825aac52c2c3a0b0cfd39df73eb33394dedd7c043fe0f2344b90ca qubes-core.openrc