#!/bin/bash set -euo pipefail PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)" CPIF="/usr/local/directadmin/data/admin/custom_package_items.conf" SUDOERS_FILE="/etc/sudoers.d/directadmin-postgresql-plugin" if [ "$(id -u)" -eq 0 ]; then if [ -f "$CPIF" ]; then sed -i '/^postgresql_enabled=/d' "$CPIF" || true sed -i '/^postgresql=/d' "$CPIF" || true sed -i '/^upostgresql=/d' "$CPIF" || true sed -i '/^postgresql_max_databases=/d' "$CPIF" || true sed -i '/^postgresql_unlimited=/d' "$CPIF" || true sed -i '/^upostgresql_max_databases=/d' "$CPIF" || true chown diradmin:diradmin "$CPIF" 2>/dev/null || true chmod 640 "$CPIF" 2>/dev/null || true fi rm -f "$SUDOERS_FILE" || true else echo "postgresql: warning: uruchom jako root, aby usunąć wpisy z custom_package_items i sudoers" >&2 fi if [ -f "$PLUGIN_DIR/plugin.conf" ]; then sed -i 's/^active=.*/active=no/' "$PLUGIN_DIR/plugin.conf" || true sed -i 's/^installed=.*/installed=no/' "$PLUGIN_DIR/plugin.conf" || true fi echo "da-postgresql: deaktywowany."