packaging/visualizations.sh: Made compatible with Linux too

pull/99/head
rand00 11 months ago
parent 7356950897
commit 140d661254
  1. 25
      packaging/visualizations.sh

@ -78,8 +78,17 @@ FILENAME="${1}"
CACHE_DIR="${CACHE}/${UUID}"
BUILDER_VIZ="builder-viz"
TMPTREE=$(mktemp -t treevis)
TMPOPAM=$(mktemp -t opamvis)
mktemp_aux () {
if [ "$(uname)" = "Linux" ]; then
mktemp -t "$1.XXX"
elif [ "$(uname)" = "FreeBSD" ]; then
mktemp -t "$1"
else
mktemp -t "$1.XXX" #< todo what to choose here
fi
}
TMPTREE=$(mktemp_aux treeviz)
TMPOPAM=$(mktemp_aux opamviz)
cleanup () {
rm -rf "${TMPTREE}" "${TMPOPAM}"
}
@ -94,7 +103,17 @@ else
fi
fi
SIZE="$(stat -f "%z" ${FILENAME})"
stat_aux () {
if [ "$(uname)" = "Linux" ]; then
stat -c "%s" "$1"
elif [ "$(uname)" = "FreeBSD" ]; then
stat -f "%z" "$1"
else
stat -c "%s" "$1" #< todo what to choose here
fi
}
SIZE="$(stat_aux ${FILENAME})"
if [ ! -z "${DEBUG}" ]; then
if [ -e "${CACHE_DIR}.treemap.html" ]; then

Loading…
Cancel
Save