2022-07-23 13:16:10 +02:00
|
|
|
#!/usr/bin/env bash
|
2022-02-19 15:32:52 +01:00
|
|
|
|
2022-12-12 20:38:44 +01:00
|
|
|
# This installs MariaDB on Linux.
|
2022-07-23 13:55:05 +02:00
|
|
|
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-mariadb.sh)
|
|
|
|
|
2022-07-23 13:08:24 +02:00
|
|
|
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
2022-03-23 08:16:01 +01:00
|
|
|
|
2022-12-12 20:38:44 +01:00
|
|
|
# Abort if not executed as root.
|
2022-02-19 15:32:52 +01:00
|
|
|
if [[ $(id -u) != "0" ]]; then
|
2022-02-25 16:33:46 +01:00
|
|
|
echo "Usage: run ${0##*/} as root" 1>&2
|
2022-02-19 15:32:52 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $1 ]]; then
|
2023-04-06 08:10:54 +02:00
|
|
|
PACKAGES="mariadb-client"
|
|
|
|
else
|
|
|
|
PACKAGES=$1
|
2022-02-19 15:32:52 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-03-27 09:30:17 +02:00
|
|
|
. /etc/os-release
|
|
|
|
|
2023-10-26 11:26:27 +02:00
|
|
|
if [[ $VERSION_CODENAME == "lunar" || $VERSION_CODENAME == "mantic" ]]; then
|
2023-03-27 09:30:17 +02:00
|
|
|
echo "Installing MariaDB distribution packages..."
|
|
|
|
else
|
2023-04-05 08:45:07 +02:00
|
|
|
MARIADB_VERSION="10.11"
|
2023-03-27 09:30:17 +02:00
|
|
|
MARIADB_URL="https://downloads.mariadb.com/MariaDB/mariadb_repo_setup"
|
|
|
|
|
|
|
|
if [ ! -f "/etc/apt/sources.list.d/mariadb.list" ]; then
|
|
|
|
echo "Installing MariaDB $MARIADB_VERSION package sources..."
|
|
|
|
curl -Ls $MARIADB_URL | bash -s -- --mariadb-server-version="mariadb-$MARIADB_VERSION"
|
|
|
|
fi
|
2022-02-19 15:32:52 +01:00
|
|
|
fi
|
|
|
|
|
2023-04-06 08:10:54 +02:00
|
|
|
echo "Installing \"$PACKAGES\"..."
|
2022-02-19 15:32:52 +01:00
|
|
|
|
2022-03-23 08:16:01 +01:00
|
|
|
apt-get update
|
2023-04-06 08:10:54 +02:00
|
|
|
apt-get -qq install $PACKAGES
|
2022-02-19 15:32:52 +01:00
|
|
|
|
|
|
|
echo "Done."
|