-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·88 lines (79 loc) · 2.75 KB
/
install.sh
File metadata and controls
executable file
·88 lines (79 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Docker Stack 3-Stage Backup System - Installation Script
# Sets up the backup system with proper configuration
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "========================================"
echo "Docker Stack 3-Stage Backup System"
echo "Installation Script"
echo "========================================"
echo ""
# Create necessary directories
echo "[1/4] Creating directory structure..."
mkdir -p "$SCRIPT_DIR/logs"
mkdir -p "$SCRIPT_DIR/locks"
mkdir -p "$SCRIPT_DIR/config"
echo " Created: logs/, locks/, config/"
# Set up configuration
echo ""
echo "[2/4] Setting up configuration..."
if [[ ! -f "$SCRIPT_DIR/config/backup.conf" ]]; then
if [[ -f "$SCRIPT_DIR/config/backup.conf.template" ]]; then
cp "$SCRIPT_DIR/config/backup.conf.template" "$SCRIPT_DIR/config/backup.conf"
chmod 600 "$SCRIPT_DIR/config/backup.conf"
echo " Created backup.conf from template"
echo " IMPORTANT: Edit config/backup.conf with your settings!"
else
echo " WARNING: backup.conf.template not found"
fi
else
echo " backup.conf already exists"
fi
# Make binary executable
echo ""
echo "[3/4] Setting permissions..."
if [[ -f "$SCRIPT_DIR/bin/backup-tui-go" ]]; then
chmod +x "$SCRIPT_DIR/bin/backup-tui-go"
echo " bin/backup-tui-go - executable"
else
echo " WARNING: bin/backup-tui-go not found"
echo " Build with: go build -o bin/backup-tui-go ./cmd/backup-tui/"
fi
# Create empty dirlist if it doesn't exist
echo ""
echo "[4/4] Initializing dirlist..."
if [[ ! -f "$SCRIPT_DIR/dirlist" ]]; then
cat > "$SCRIPT_DIR/dirlist" << 'EOF'
# Directory list for selective backup
# Format: directory_name=true|false
# true = backup enabled, false = skip backup
#
# This file will be populated when you run the TUI
# and select directories for backup.
EOF
echo " Created empty dirlist file"
else
echo " dirlist already exists"
fi
echo ""
echo "========================================"
echo "Installation complete!"
echo "========================================"
echo ""
echo "REQUIRED: Configure before first use"
echo "----------------------------------------"
echo "1. Edit config/backup.conf:"
echo " - Set DOCKER_STACKS_DIR to your Docker stacks location"
echo " - Set RESTIC_REPOSITORY path"
echo " - Set RESTIC_PASSWORD"
echo ""
echo "2. (Optional) Configure cloud storage:"
echo " rclone config"
echo " Then set RCLONE_REMOTE in backup.conf"
echo ""
echo "3. Run the backup utility:"
echo " ./bin/backup-tui-go # Interactive TUI"
echo " ./bin/backup-tui-go backup # Run backup"
echo " ./bin/backup-tui-go --help # Show all commands"
echo ""
echo "========================================"