This commit is contained in:
2026-07-10 15:11:51 +08:00
parent 8bfcf23bc2
commit da17239d7d
148 changed files with 2542 additions and 4873 deletions
+56 -10
View File
@@ -1,14 +1,60 @@
#!/usr/bin/env bash
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
set -eo pipefail
require postgresql postgresql-contrib && \
sudo service postgresql restart && \
{
echo
success "openvpn installed!"
postgres --version
echo
}
installed() { command -v "$1" >/dev/null 2>&1; }
require() {
local missing=()
for pkg in "$@"; do
installed "$pkg" || missing+=("$pkg")
done
if [ ${#missing[@]} -gt 0 ]; then
if [ "$(uname -s)" = "Darwin" ]; then
if installed brew; then
brew install "${missing[@]}"
else
echo "ERROR: Missing: ${missing[*]}. Install manually or use brew." >&2
exit 1
fi
else
sudo apt install -y "${missing[@]}"
fi
fi
}
install() {
if [ "$(uname -s)" = "Darwin" ]; then
if installed brew; then
brew install postgresql
brew services start postgresql
else
echo "ERROR: Install Homebrew first." >&2
exit 1
fi
return
fi
echo
echo "==============================================="
echo "Installing postgresql"
echo "==============================================="
echo
require postgresql postgresql-contrib
sudo service postgresql restart
if installed php; then
sudo apt install -y --autoremove php-pgsql phpmyadmin
fi
echo
echo "Finish!"
postgres --version
echo
}
case "$1" in
*) install ;;
esac