Skip to content

Commit 81430ea

Browse files
committed
write GPG key and SSL certs sent though qubes.TemplateSearch and qubes.TemplateDownload
files destination path are replaced by the temp directory to prevent permission issues and conflicts with existing files on the VM.
1 parent 78f51cf commit 81430ea

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

qubes-rpc/qvm-template-repo-query

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ repodir=$(mktemp -d)
2626
trap 'rm -r "$repodir"' EXIT
2727
cat > "$repodir/template.repo"
2828

29+
# extract keys from wrapper in repo file
30+
mkdir "$repodir/keys"
31+
cp /etc/qubes/repo-templates/keys/* "$repodir/keys/"
32+
sed -i "s~/etc/qubes/repo-templates/keys/~$repodir/keys/~" "$repodir/template.repo"
33+
in_wrapper=false
34+
line_is_filename=true
35+
while read -r line; do
36+
[[ "$line" == "###!Q!BEGIN-QUBES-WRAPPER!Q!###" ]] && in_wrapper=true && continue
37+
[[ "$line" == "###!Q!END-QUBES-WRAPPER!Q!###" ]] && in_wrapper=false && continue
38+
$in_wrapper || continue
39+
if $line_is_filename; then
40+
filename="$(echo "$line" | cut -c 2-)"
41+
line_is_filename=false
42+
else
43+
mkdir -p "$(dirname "$filename")"
44+
echo "$line" | cut -c 2- | base64 -d > "$filename"
45+
line_is_filename=true
46+
fi
47+
done < "$repodir/template.repo"
48+
2949
DNF5=false
3050
if [ "$(readlink /usr/bin/dnf)" = "dnf5" ]; then
3151
DNF5=true

0 commit comments

Comments
 (0)