Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archlinux/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ package_qubes-vm-dom0-updates() {
qubes-vm-core
qubes-vm-networking
python
dnf
dnf5
)

cd "${_pkgnvr}"
Expand Down
2 changes: 1 addition & 1 deletion archlinux/PKGBUILD.qubes-post-upgrade.hook
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Trigger]
Operation = Upgrade
Type = Path
Type = Package
Target = *

[Action]
Expand Down
10 changes: 7 additions & 3 deletions package-managers/qubes-download-dom0-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ if [ -z "$UPDATE_ACTION" ]; then
UPDATE_ACTION=upgrade
fi

if type dnf >/dev/null 2>&1; then
UPDATE_CMD=dnf
if type dnf >/dev/null 2>&1 || type dnf5 >/dev/null 2>&1; then
if type dnf5 >/dev/null 2>&1; then
UPDATE_CMD=dnf5
else
UPDATE_CMD=dnf
fi
UPDATE_ARGUMENTS+=(--noplugins -y)
CLEAN_OPTS+=(--noplugins -y)
"$UPDATE_CMD" "${OPTS[@]}" "$UPDATE_ACTION" --help | grep -q best && UPDATE_ARGUMENTS+=(--best)
"$UPDATE_CMD" "${OPTS[@]}" "$UPDATE_ACTION" --help | grep -q allowerasing && UPDATE_ARGUMENTS+=(--allowerasing)
if "$UPDATE_CMD" --version | grep -q dnf5 && [ "$CHECK_ONLY" = "1" ]; then
if [ "$UPDATE_CMD" = "dnf5" ] && [ "$CHECK_ONLY" = "1" ]; then
UPDATE_ACTION=check-upgrade
fi
else
Expand Down
24 changes: 12 additions & 12 deletions qubes-rpc/qvm-template-repo-query
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ while read -r line; do
fi
done < "$repodir/template.repo"

if ! DNF=$(command -v dnf5 dnf dnf4 | head -1); then
echo "ERROR: dnf command is missing, please use newer template for your UpdateVM to download templates." >&2
echo "You can choose any Fedora version, Debian 11 (or newer), or any other based on those (like Whonix 16)." >&2
exit 1
fi
DNF5=false
if [ "$(readlink /usr/bin/dnf)" = "dnf5" ]; then
if [[ "$DNF" = *"/dnf5" ]]; then
DNF5=true
fi

Expand All @@ -58,11 +63,6 @@ if ! $DNF5; then
OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins")
fi

if ! command -v dnf >/dev/null; then
echo "ERROR: dnf command is missing, please use newer template for your UpdateVM to download templates." >&2
echo "You can choose any Fedora version, Debian 11 (or newer), or any other based on those (like Whonix 16)." >&2
exit 1
fi

# This creates the hashfile if it doesn't exist, and keep the ctime and mtime
# unchanged otherwise.
Expand All @@ -76,9 +76,9 @@ RET=0

if [ "$1" = "query" ]; then
if $DNF5; then
dnf repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|\n' "$SPEC"
$DNF repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|\n' "$SPEC"
else
dnf repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|' "$SPEC"
$DNF repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{repoid}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|' "$SPEC"
fi
RET="$?"
elif [ "$1" = "download" ]; then
Expand All @@ -88,23 +88,23 @@ elif [ "$1" = "download" ]; then
# downloaded, go to the next one. The intention is to retry on interrupted
# connection, but skip mirrors that are not synchronized yet.
declare -a urls=()
if $DNF5 && dnf download --help | grep -q allmirrors; then
if $DNF5 && $DNF download --help | grep -q allmirrors; then
# The smartest case. DNF5 on Fedora 41 with --allmirrors patch
space_separated_urls="$(dnf download "${OPTS[@]}" --url --allmirrors "$SPEC")"
space_separated_urls="$($DNF download "${OPTS[@]}" --url --allmirrors "$SPEC")"
readarray -d ' ' -t urls <<<"$space_separated_urls"
urls=( $(shuf -e "${urls[@]}") )
elif $DNF5; then
# The middle case. DNF5 on Fedora 41 before --allmirror patch
# TODO: Phase out after DNF5 --allmirrors patch is released
url="$(dnf download "${OPTS[@]}" --url "$SPEC")"
url="$($DNF download "${OPTS[@]}" --url "$SPEC")"
urls=("$url")
else
# The old DNF4 on Fedora 40 and other old templates
# use vendored 'downloadurl' dnf-plugin (fork of 'download' plugin),
# to print all mirrors.
# TODO: Phase out after DNF4 is EOL
OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins")
urls="$(dnf downloadurl "${OPTS[@]}" --url --all-mirrors "$SPEC" | shuf)"
urls="$($DNF downloadurl "${OPTS[@]}" --url --all-mirrors "$SPEC" | shuf)"
readarray -t urls <<<"$urls"
fi
downloaded=0
Expand Down