photoprism/scripts/dist/install-chrome.sh
Michael Mayer b45b20aa53 CI: Improve system architecture detection in build scripts
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-10-05 23:18:54 +02:00

41 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# This installs Google Chrome on Linux.
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-chrome.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# Abort if not executed as root.
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
. /etc/os-release
case $DESTARCH in
amd64 | AMD64 | x86_64 | x86-64)
echo "Installing Google Chrome (stable) on ${ID} for ${DESTARCH^^}..."
set -e
curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/dl-ssl.google.com.gpg
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
apt-get -qq install google-chrome-stable
;;
*)
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
exit 0
;;
esac
echo "Done."