Initial commit from template
This commit is contained in:
72
.claude/skills/postgres-connect/install-psql.sh
Executable file
72
.claude/skills/postgres-connect/install-psql.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Installiert PostgreSQL CLI basierend auf dem Betriebssystem
|
||||
|
||||
set -e
|
||||
|
||||
# OS erkennen
|
||||
OS_TYPE=$(uname -s)
|
||||
|
||||
# Pruefen ob psql bereits installiert ist
|
||||
if command -v psql &> /dev/null; then
|
||||
echo "psql ist bereits installiert: $(psql --version)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "psql nicht gefunden. Starte Installation..."
|
||||
|
||||
case "$OS_TYPE" in
|
||||
"Darwin")
|
||||
# macOS - mit Homebrew
|
||||
if ! command -v brew &> /dev/null; then
|
||||
echo "Homebrew nicht gefunden. Bitte installiere Homebrew zuerst:"
|
||||
echo '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
|
||||
exit 1
|
||||
fi
|
||||
echo "Installiere PostgreSQL via Homebrew..."
|
||||
brew install postgresql
|
||||
;;
|
||||
|
||||
"Linux")
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
# Alpine Linux
|
||||
echo "Installiere PostgreSQL Client auf Alpine..."
|
||||
apk add --no-cache postgresql-client
|
||||
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Debian/Ubuntu
|
||||
echo "Installiere PostgreSQL Client auf Debian/Ubuntu..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y postgresql-client
|
||||
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# RHEL/CentOS/Fedora
|
||||
echo "Installiere PostgreSQL Client auf RHEL/CentOS..."
|
||||
sudo yum install -y postgresql
|
||||
|
||||
else
|
||||
echo "Unbekannte Linux-Distribution. Bitte installiere postgresql-client manuell."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
"MINGW"*|"MSYS"*|"CYGWIN"*)
|
||||
# Windows
|
||||
echo "Windows erkannt."
|
||||
echo "Bitte installiere PostgreSQL von: https://www.postgresql.org/download/windows/"
|
||||
echo "Oder nutze: winget install PostgreSQL.PostgreSQL"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unbekanntes Betriebssystem: $OS_TYPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Verifizieren
|
||||
if command -v psql &> /dev/null; then
|
||||
echo "Installation erfolgreich: $(psql --version)"
|
||||
else
|
||||
echo "Installation fehlgeschlagen."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user