Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FEATURE (installation): Allow to launch installation script only under the root

Rostislav Duginec5ae24d3d17
diff --git a/README.md b/README.md
index 4975e3de..8e14f839 100644
--- a/README.md
+++ b/README.md
@@ -64,8 +64,9 @@ The installation script will:
- ✅ Set up automatic startup on system reboot via cron
```bash
-apt-get install -y curl && \
-curl -sSL https://raw.githubusercontent.com/RostislavDugin/postgresus/refs/heads/main/install-postgresus.sh | bash
+sudo apt-get install -y curl && \
+sudo curl -sSL https://raw.githubusercontent.com/RostislavDugin/postgresus/refs/heads/main/install-postgresus.sh \
+| sudo bash
```
### Option 2: Manual Docker Compose Setup
diff --git a/install-postgresus.sh b/install-postgresus.sh
index b46cc2b5..bc777a40 100644
--- a/install-postgresus.sh
+++ b/install-postgresus.sh
@@ -1,5 +1,11 @@
#!/bin/bash
+# Check if script is run as root
+if [ "$(id -u)" -ne 0 ]; then
+ echo "Error: This script must be run as root (sudo ./install-postgresus.sh)" >&2
+ exit 1
+fi
+
# Set up logging
LOG_FILE="/var/log/postgresus-install.log"
INSTALL_DIR="/opt/postgresus"