qubes.Template*: Add --refresh option and allow DNF cache to be used.
This commit is contained in:
parent
9bedf50786
commit
b0edd5f209
@ -10,7 +10,8 @@ while IFS= read -r line; do
|
||||
--enablerepo=*|\
|
||||
--disablerepo=*|\
|
||||
--repoid=*|\
|
||||
--releasever=*)
|
||||
--releasever=*|\
|
||||
--refresh)
|
||||
OPTS+=("$line")
|
||||
;;
|
||||
*)
|
||||
@ -25,13 +26,22 @@ 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
|
||||
curl --silent -L "$(dnf download "${OPTS[@]}" --url "$SPEC" | shuf -n 1)" -o -
|
||||
url="$(dnf download "${OPTS[@]}" --url "$SPEC" | shuf -n 1)"
|
||||
curl --silent -L "$url" -o -
|
||||
RET="$?"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user