Merge remote-tracking branch 'origin/pr/236'

* origin/pr/236:
  qvm-template: Add qubes.Template{Search,Download} files to the package.
  qubes.Template*: Add --refresh option and allow DNF cache to be used.
  qubes.Template*: Invoke curl with --silent.
  qubes.Template*: Change separator from : to | and include additional metadata.
  Fix shell quoting.
  Remove repofrompath.
  New qrexec calls for interacting with template repos.
This commit is contained in:
Marek Marczykowski-Górecki 2020-09-17 03:08:56 +02:00
commit e9466dd04f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 65 additions and 2 deletions

View File

@ -37,6 +37,8 @@ etc/qubes-rpc/qubes.VMExec
etc/qubes-rpc/qubes.VMExecGUI
etc/qubes-rpc/qubes.WaitForSession
etc/qubes-rpc/qubes.GetDate
etc/qubes-rpc/qubes.TemplateSearch
etc/qubes-rpc/qubes.TemplateDownload
etc/qubes-suspend-module-blacklist
etc/qubes/autostart/*
etc/qubes/applications/*
@ -150,6 +152,7 @@ usr/lib/qubes/upgrades-status-notify
usr/lib/qubes/vm-file-editor
usr/lib/qubes/xdg-icon
usr/lib/qubes/tinyproxy-wrapper
usr/lib/qubes/qvm-template-repo-query
usr/lib/systemd/user/pulseaudio.service.d/30_qubes.conf
usr/lib/systemd/user/pulseaudio.socket.d/30_qubes.conf
usr/share/glib-2.0/schemas/*

View File

@ -44,7 +44,7 @@ install:
install -t $(DESTDIR)$(QUBESLIBDIR) \
prepare-suspend resize-rootfs \
qfile-agent qopen-in-vm qrun-in-vm qubes-sync-clock \
tar2qfile vm-file-editor xdg-icon
tar2qfile vm-file-editor xdg-icon qvm-template-repo-query
# Install qfile-unpacker as SUID, because it will fail to receive
# files from other vm.
install -t $(DESTDIR)$(QUBESLIBDIR) -m 4755 qfile-unpacker
@ -71,7 +71,9 @@ install:
qubes.PostInstall \
qubes.GetDate \
qubes.ShowInTerminal \
qubes.ConnectTCP
qubes.ConnectTCP \
qubes.TemplateSearch \
qubes.TemplateDownload
ln -s qubes.VMExec $(DESTDIR)$(QUBESRPCCMDDIR)/qubes.VMExecGUI
for config in *.config; do \
install -D -m 0644 "$$config" "$(DESTDIR)$(QUBESRPCCONFDIR)/$${config%.config}"; \

View File

@ -0,0 +1,3 @@
#!/usr/bin/bash
exec /usr/lib/qubes/qvm-template-repo-query download

3
qubes-rpc/qubes.TemplateSearch Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/bash
exec /usr/lib/qubes/qvm-template-repo-query query

View File

@ -0,0 +1,49 @@
#!/usr/bin/bash
OPTS=()
SPEC=
while IFS= read -r line; do
if [ "$line" = "---" ]; then
break
fi
case "$line" in
--enablerepo=*|\
--disablerepo=*|\
--repoid=*|\
--releasever=*|\
--refresh)
OPTS+=("$line")
;;
*)
SPEC="$line"
;;
esac
done
repodir=$(mktemp -d)
cat > "$repodir/template.repo"
OPTS+=("--setopt=reposdir=${repodir}")
OPTS+=("--quiet")
# This creates the hashfile if it doesn't exist, and keep the ctime and mtime
# unchanged otherwise.
# We then copy the {c,m}time to the repo config.
# This allows DNF caching to work properly.
hashfile="/tmp/qvm-template-$(b2sum "$repodir/template.repo" | cut -f1 -d' ')"
touch -a "$hashfile"
touch -r "$hashfile" "$repodir/template.repo"
RET=0
if [ "$1" = "query" ]; then
dnf repoquery "${OPTS[@]}" --qf='%{name}|%{epoch}|%{version}|%{release}|%{reponame}|%{downloadsize}|%{buildtime}|%{license}|%{url}|%{summary}|%{description}|' "$SPEC"
RET="$?"
elif [ "$1" = "download" ]; then
url="$(dnf download "${OPTS[@]}" --url "$SPEC" | shuf -n 1)"
curl --silent -L "$url" -o -
RET="$?"
fi
rm -r "$repodir"
exit "$RET"

View File

@ -612,6 +612,8 @@ rm -f %{name}-%{version}
%config(noreplace) /etc/qubes-rpc/qubes.StartApp
%config(noreplace) /etc/qubes-rpc/qubes.PostInstall
%config(noreplace) /etc/qubes-rpc/qubes.GetDate
%config(noreplace) /etc/qubes-rpc/qubes.TemplateSearch
%config(noreplace) /etc/qubes-rpc/qubes.TemplateDownload
%config(noreplace) /etc/qubes/rpc-config/qubes.OpenInVM
%config(noreplace) /etc/qubes/rpc-config/qubes.OpenURL
%config(noreplace) /etc/qubes/rpc-config/qubes.SelectFile
@ -686,6 +688,7 @@ rm -f %{name}-%{version}
/usr/lib/qubes/qubes-sync-clock
/usr/lib/qubes/resize-rootfs
/usr/lib/qubes/tinyproxy-wrapper
/usr/lib/qubes/qvm-template-repo-query
/usr/lib/dracut/dracut.conf.d/30-qubes.conf
%dir /usr/lib/qubes/init
/usr/lib/qubes/init/bind-dirs.sh