New qrexec calls for interacting with template repos.
See <https://gist.github.com/WillyPillow/b8a643ddbd9235a97bc187e6e44b16e4> for details.
This commit is contained in:
parent
940b0f3646
commit
d1f27749a9
3
qubes-rpc/qubes.TemplateDownload
Executable file
3
qubes-rpc/qubes.TemplateDownload
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
exec /usr/lib/qubes/qvm-template-repo-query download
|
3
qubes-rpc/qubes.TemplateSearch
Executable file
3
qubes-rpc/qubes.TemplateSearch
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
exec /usr/lib/qubes/qvm-template-repo-query query
|
42
qubes-rpc/qvm-template-repo-query
Executable file
42
qubes-rpc/qvm-template-repo-query
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
OPTS=()
|
||||
SPEC=
|
||||
while IFS= read -r line; do
|
||||
if [ "$line" = "---" ]; then
|
||||
break
|
||||
fi
|
||||
case "$line" in
|
||||
--enablerepo=*|\
|
||||
--disablerepo=*|\
|
||||
--repoid=*|\
|
||||
--repofrompath=*|\
|
||||
--releasever=*)
|
||||
OPTS+=("$line")
|
||||
;;
|
||||
*)
|
||||
SPEC="$line"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
repodir=$(mktemp -d)
|
||||
cat > "$repodir/template.repo"
|
||||
|
||||
OPTS+=("--setopt=reposdir=${repodir}")
|
||||
OPTS+=("--quiet")
|
||||
|
||||
RET=0
|
||||
|
||||
if [ "$1" = "query" ]; then
|
||||
# shellcheck disable=SC2068
|
||||
dnf repoquery ${OPTS[@]} --qf='%{name}:%{epoch}:%{version}:%{release}:%{reponame}:%{downloadsize}:%{summary}' "$SPEC"
|
||||
RET="$?"
|
||||
elif [ "$1" = "download" ]; then
|
||||
# shellcheck disable=SC2068
|
||||
curl -L "$(dnf download ${OPTS[@]} --url "$SPEC" | shuf -n 1)" -o -
|
||||
RET="$?"
|
||||
fi
|
||||
|
||||
rm -r "$repodir"
|
||||
exit "$RET"
|
Loading…
Reference in New Issue
Block a user