CI: Improve dist install scripts and add usage docs

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2022-07-23 13:55:05 +02:00
parent ee0ca41a53
commit 25fb0e0fc1
9 changed files with 148 additions and 72 deletions

View file

@ -52,7 +52,7 @@ apt-get -qq install --no-install-recommends apt-transport-https ca-certificates
# install docker if needed
if ! command -v docker &> /dev/null; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/download.docker.com.gpg
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-get update
apt-get -qq install docker-ce

View file

@ -44,7 +44,7 @@ apt-get -qq install --no-install-recommends apt-transport-https ca-certificates
# install docker if needed
if ! command -v docker &> /dev/null; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/download.docker.com.gpg
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-get update
apt-get -qq install docker-ce

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# 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
@ -8,22 +11,30 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${2:-$SYSTEM_ARCH}
. /etc/os-release
if [[ $DESTARCH != "amd64" ]]; then
echo "Google Chrome (stable) is only available for AMD64."
exit
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
echo "Installing Google Chrome (stable) on ${ID} for ${DESTARCH^^}..."
DESTARCH=${2:-$SYSTEM_ARCH}
set -e
. /etc/os-release
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
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
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: \"$BUILD_ARCH\"" 1>&2
exit 0
;;
esac
echo "Done."

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs Darktable on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-darktable.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
@ -8,39 +11,51 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
set -e
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${2:-$SYSTEM_ARCH}
set -e
. /etc/os-release
echo "Installing Darktable for ${DESTARCH^^}..."
if [[ $DESTARCH == "amd64" || $DESTARCH == "x86_64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
elif [[ $VERSION_CODENAME == "buster" ]]; then
apt-get update
apt-get -qq install -t buster-backports darktable
else
echo "install-darktable: installing standard amd64 (Intel 64-bit) package"
apt-get -qq install darktable
fi
echo "Done."
elif [[ $DESTARCH == "arm64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
elif [[ $VERSION_CODENAME == "buster" ]]; then
apt-get update
apt-get -qq install -t buster-backports darktable
else
echo "install-darktable: installing standard arm64 (ARM 64-bit) package"
apt-get -qq install darktable
fi
echo "Done."
else
echo "Unsupported Machine Architecture: $DESTARCH"
fi
case $DESTARCH in
amd64 | AMD64 | x86_64 | x86-64)
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
elif [[ $VERSION_CODENAME == "buster" ]]; then
apt-get update
apt-get -qq install -t buster-backports darktable
else
echo "install-darktable: installing standard amd64 (Intel 64-bit) package"
apt-get -qq install darktable
fi
;;
arm64 | ARM64 | aarch64)
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
elif [[ $VERSION_CODENAME == "buster" ]]; then
apt-get update
apt-get -qq install -t buster-backports darktable
else
echo "install-darktable: installing standard arm64 (ARM 64-bit) package"
apt-get -qq install darktable
fi
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
exit 0
;;
esac
echo "Done."

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs Go Tools on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go-tools.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:$PATH"
# abort if not executed as root
@ -13,7 +16,12 @@ if [[ -z "$GOPATH" ]] || [[ -z "$GOBIN" ]]; then
exit 1
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
echo "Installing Go Tools for ${DESTARCH^^}..."
@ -24,16 +32,22 @@ mkdir -p "$GOPATH/src" "$GOBIN"
go install github.com/tianon/gosu@latest
# no additional tools on ARMv7 to reduce build time
if [[ $DESTARCH != "arm" ]]; then
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/psampaz/go-mod-outdated@latest
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
go install github.com/mikefarah/yq/v4@latest
case $DESTARCH in
arm | ARM | aarch | armv7l | armhf)
# no additional tools on ARMv7 to reduce build time
echo "Skipping installation of goimports, go-mod-outdated, exif-read-tool and richgo."
;;
go install github.com/kyoh86/richgo@latest
cp "$GOBIN/richgo" /usr/local/bin/richgo
fi
*)
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/psampaz/go-mod-outdated@latest
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
go install github.com/mikefarah/yq/v4@latest
go install github.com/kyoh86/richgo@latest
cp "$GOBIN/richgo" /usr/local/bin/richgo
;;
esac
chmod -R a+rwX "$GOPATH"

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs Go on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
GOLANG_VERSION=1.18.4
@ -15,13 +18,10 @@ echo "Installing Go in \"$DESTDIR\"..."
set -e
if command -v uname &> /dev/null
then
SYSTEM_ARCH=$(uname -m)
elif [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
@ -30,19 +30,27 @@ mkdir -p "$DESTDIR"
set -eux;
if [[ $DESTARCH == "amd64" || $DESTARCH == "x86_64" ]]; then
case $DESTARCH in
amd64 | AMD64 | x86_64 | x86-64)
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"
CHECKSUM="c9b099b68d93f5c5c8a8844a89f8db07eaa58270e3a1e01804f17f4cf8df02f5 *go.tgz"
elif [[ $DESTARCH == "arm64" ]]; then
;;
arm64 | ARM64 | aarch64)
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"
CHECKSUM="35014d92b50d97da41dade965df7ebeb9a715da600206aa59ce1b2d05527421f *go.tgz"
elif [[ $DESTARCH == "arm" ]]; then
;;
arm | ARM | aarch | armv7l | armhf)
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
CHECKSUM="7dfeab572e49638b0f3d9901457f0622c27b73301c2b99db9f5e9568ff40460c *go.tgz"
else
echo "Unsupported Machine Architecture: $DESTARCH" 1>&2
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
exit 1
fi
;;
esac
echo "Downloading Go from \"$URL\". Please wait."

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs GPU drivers on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-gpu.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root
@ -10,15 +13,16 @@ fi
set -e
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
TMPDIR=${TMPDIR:-/tmp}
. /etc/os-release
if [[ $DESTARCH != "amd64" ]]; then
echo "Installing GPU drivers for ${DESTARCH} is not supported yet."
exit
fi
. /etc/os-release
apt-get update
apt-get -qq upgrade
@ -29,6 +33,24 @@ GPU_DETECTED=($(lshw -c display -json 2>/dev/null | jq -r '.[].configuration.dri
echo "GPU detected: ${GPU_DETECTED[*]}"
case $DESTARCH in
amd64 | AMD64 | x86_64 | x86-64)
echo "Installing GPU drivers for ${DESTARCH^^}..."
;;
*)
echo "Installing GPU drivers for ${DESTARCH^^} not supported at this time."
exit 0
;;
esac
# TODO: Install NVIDIA Drivers from https://developer.download.nvidia.com/compute/cuda/repos/
# curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/{DIST}/x86_64/7fa2af80.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/developer.download.nvidia.com.gpg
# add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/{DIST}/x86_64/ /"
# curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/{DIST}/x86_64/cuda-{DIST}.pin > /etc/apt/preferences.d/cuda-repository-pin-600
# apt-get update
# apt-get install libglvnd-dev pkg-config dkms build-essential cuda nvidia-driver-510 nvidia-settings nvidia-utils-510 linux-headers-$(uname -r)
# shellcheck disable=SC2068
for t in ${GPU_DETECTED[@]}; do
case $t in

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs MariaDB on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-mariadb.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Installs NodeJS, NPM and TestCafe on Linux
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nodejs.sh)
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
# abort if not executed as root