2022-10-07 11:48:59 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-10-26 18:51:28 +02:00
|
|
|
DESTDIR=$(realpath "${1:-/usr/local}")
|
2022-10-26 18:06:12 +02:00
|
|
|
LIBHEIF_VERSION=${2:-v1.13.0}
|
2022-10-07 11:48:59 +02:00
|
|
|
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
|
|
|
|
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
|
|
|
|
|
|
|
|
. /etc/os-release
|
|
|
|
|
2022-12-12 20:38:44 +01:00
|
|
|
# Abort if not executed as root.
|
2022-10-07 11:48:59 +02:00
|
|
|
if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
|
|
|
|
echo "Error: Run ${0##*/} as root to install in a system directory!" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$DESTDIR"
|
|
|
|
|
|
|
|
ARCHIVE="libheif-${VERSION_CODENAME}-${DESTARCH}-${LIBHEIF_VERSION}.tar.gz"
|
|
|
|
URL="https://dl.photoprism.app/dist/libheif/${ARCHIVE}"
|
|
|
|
|
|
|
|
echo "------------------------------------------------"
|
|
|
|
echo "VERSION: $LIBHEIF_VERSION"
|
|
|
|
echo "ARCHIVE: $ARCHIVE"
|
|
|
|
echo "DESTDIR: $DESTDIR"
|
|
|
|
echo "------------------------------------------------"
|
|
|
|
|
|
|
|
echo "Extracting \"$URL\" to \"$DESTDIR\"."
|
|
|
|
wget --inet4-only -c "$URL" -O - | tar --overwrite --mode=755 -xz -C "$DESTDIR"
|
|
|
|
|
|
|
|
if [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
|
|
|
|
echo "Running \"ldconfig\"."
|
|
|
|
ldconfig
|
|
|
|
else
|
|
|
|
echo "Running \"ldconfig -n $DESTDIR/lib\"."
|
|
|
|
ldconfig -n "$DESTDIR/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Done."
|