Skip to content

Commit 6868158

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 6868158

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

qubes-rpc/qvm-template-repo-query

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ 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+
sed -i "s~/etc/qubes/repo-templates/keys/~$repodir/keys/~" "$repodir/template.repo"
32+
in_wrapper=false
33+
line_is_filename=true
34+
while read -r line; do
35+
[[ "$line" == "###!Q!BEGIN-QUBES-WRAPPER!Q!###" ]] && in_wrapper=true && continue
36+
[[ "$line" == "###!Q!END-QUBES-WRAPPER!Q!###" ]] && in_wrapper=false && continue
37+
$in_wrapper || continue
38+
if $line_is_filename; then
39+
filename="${line:1}"
40+
line_is_filename=false
41+
else
42+
mkdir -p "$(dirname "$filename")"
43+
echo "${line:1}" | base64 -d > "$filename"
44+
line_is_filename=true
45+
fi
46+
done < "$repodir/template.repo"
47+
2948
DNF5=false
3049
if [ "$(readlink /usr/bin/dnf)" = "dnf5" ]; then
3150
DNF5=true

0 commit comments

Comments
 (0)