visualizations.sh: use cp;rm instead of mv in /tmp

mktemp creates a file with mode 0600 and group wheel (inherited from
/tmp/). The command mv is then not able to set group ownership to wheel
in /var/db/builder-web/ on FreeBSD and emits a warning. Furthermore, the
restrictive permissions are preserved. Copying and then removing the
temporary file avoids these issues.
This commit is contained in:
Reynir Björnsson 2022-08-25 15:48:21 +02:00
parent ac8c31f2ac
commit aa1af6c2bd

View file

@ -155,7 +155,8 @@ if [ -e "${DEPENDENCIES_VIZ_FILENAME}" ]; then
info "Dependency visualization already exists: '${DEPENDENCIES_VIZ_FILENAME}'"
else
if ${OPAM_GRAPH} --output-format=html "${OPAM_SWITCH}" > "${TMPDEPENDENCIES}"; then
mv "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}"
cp "${TMPDEPENDENCIES}" "${DEPENDENCIES_VIZ_FILENAME}"
rm "$TMPDEPENDENCIES"
else
die "opam-graph failed to generate visualization"
fi
@ -201,7 +202,8 @@ if [ -n "${DEBUG_BIN_RELATIVE}" ]; then
"${DEBUG_BIN}" \
> "${TMPTREE}"
then
mv "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}"
cp "${TMPTREE}" "${TREEMAP_VIZ_FILENAME}"
rm "$TMPTREE"
else
die "modulectomy failed to generate visualization"
fi