Skip to content

Commit b3862a1

Browse files
author
cschweda
committed
chore: gitignore
1 parent 0a0c9d8 commit b3862a1

20 files changed

+3067
-49
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ secrets.sh
4343
*_credentials.json
4444
.api_keys
4545
.secrets/
46+
.env
4647

4748
# Credentials and secrets
4849
.secrets.checksum

backup.sh

+5-15
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
# Source the shared modules
66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
8-
# Use absolute paths to be certain
9-
source "/home/cschw/backup-webdev/src/core/config.sh"
10-
source "/home/cschw/backup-webdev/src/utils/utils.sh"
11-
source "/home/cschw/backup-webdev/src/ui/ui.sh"
12-
source "/home/cschw/backup-webdev/src/core/fs.sh"
13-
source "/home/cschw/backup-webdev/src/reports/reporting.sh"
7+
source "$SCRIPT_DIR/config.sh"
8+
source "$SCRIPT_DIR/utils.sh"
9+
source "$SCRIPT_DIR/ui.sh"
10+
source "$SCRIPT_DIR/fs.sh"
11+
source "$SCRIPT_DIR/reporting.sh"
1412

1513
# Default values
1614
SILENT_MODE=false
@@ -28,9 +26,6 @@ CUSTOM_SOURCE_DIRS=()
2826
DRY_RUN=false
2927
EXTERNAL_BACKUP=false # Track if this is an external (cloud) backup
3028

31-
# Set BACKUP_DIR from DEFAULT_BACKUP_DIR (from config.sh)
32-
BACKUP_DIR="$DEFAULT_BACKUP_DIR"
33-
3429
# Parse command line arguments
3530
while [[ $# -gt 0 ]]; do
3631
case $1 in
@@ -164,11 +159,6 @@ fi
164159
# For backward compatibility
165160
SOURCE_DIR="${SOURCE_DIRS[0]}"
166161

167-
# Set backup directory if custom was provided
168-
if [ -n "$CUSTOM_BACKUP_DIR" ]; then
169-
BACKUP_DIR="$CUSTOM_BACKUP_DIR"
170-
fi
171-
172162
# Verify source directories exist
173163
for dir in "${SOURCE_DIRS[@]}"; do
174164
if [[ ! -d "$dir" ]]; then

check-config.sh

+2-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@
44

55
# Get the script's directory
66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
# Set constants for colors first
8-
CYAN="\033[0;36m"
9-
GREEN="\033[0;32m"
10-
YELLOW="\033[0;33m"
11-
RED="\033[0;31m"
12-
NC="\033[0m" # No Color
13-
14-
# Source paths with absolute paths to be sure
15-
source "/home/cschw/backup-webdev/src/core/config.sh"
16-
source "/home/cschw/backup-webdev/src/utils/utils.sh"
7+
source "$SCRIPT_DIR/config.sh"
8+
source "$SCRIPT_DIR/utils.sh"
179

1810
# Check for required utilities
1911
echo -e "${CYAN}===== WebDev Backup Tool Configuration Check =====${NC}"

cleanup.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
# Source the shared modules
66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
source "$SCRIPT_DIR/../core/config.sh"
8-
source "$SCRIPT_DIR/../utils/utils.sh"
9-
source "$SCRIPT_DIR/../ui/ui.sh"
10-
source "$SCRIPT_DIR/../core/fs.sh"
7+
source "$SCRIPT_DIR/config.sh"
8+
source "$SCRIPT_DIR/utils.sh"
9+
source "$SCRIPT_DIR/ui.sh"
10+
source "$SCRIPT_DIR/fs.sh"
1111

1212
# Log cleaning options
1313
LOGS_BACKUP=false

config.sh

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
# config.sh - Configuration file for WebDev Backup Tool
3+
4+
# Get the script's directory
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
# Default source directories - define as array
8+
DEFAULT_SOURCE_DIRS=()
9+
10+
# Check for ~/webdev directory and add it if exists
11+
if [ -d "$HOME/webdev" ]; then
12+
DEFAULT_SOURCE_DIRS+=("$HOME/webdev")
13+
fi
14+
15+
# Check for ~/inform6 directory and add it if exists
16+
if [ -d "$HOME/inform6" ]; then
17+
DEFAULT_SOURCE_DIRS+=("$HOME/inform6")
18+
fi
19+
20+
# If no default directories found, try to use parent directory of script
21+
if [ ${#DEFAULT_SOURCE_DIRS[@]} -eq 0 ]; then
22+
# Try to use parent directory of script location
23+
parent_dir="$(dirname "$SCRIPT_DIR")"
24+
if [ -d "$parent_dir" ] && [ -r "$parent_dir" ]; then
25+
DEFAULT_SOURCE_DIRS+=("$parent_dir")
26+
else
27+
# Fallback to script directory itself
28+
DEFAULT_SOURCE_DIRS+=("$SCRIPT_DIR")
29+
fi
30+
fi
31+
32+
# For backward compatibility - first directory is the default
33+
DEFAULT_SOURCE_DIR="${DEFAULT_SOURCE_DIRS[0]}"
34+
35+
# Default backup destination - pick a reliable location
36+
DEFAULT_BACKUP_DIR="/mnt/d/backups"
37+
if [ ! -d "$DEFAULT_BACKUP_DIR" ] || [ ! -w "$DEFAULT_BACKUP_DIR" ]; then
38+
# Fallback to script directory if default isn't accessible
39+
DEFAULT_BACKUP_DIR="$SCRIPT_DIR/backups"
40+
# Create it if it doesn't exist
41+
[ ! -d "$DEFAULT_BACKUP_DIR" ] && mkdir -p "$DEFAULT_BACKUP_DIR"
42+
fi
43+
44+
# Default cloud provider
45+
DEFAULT_CLOUD_PROVIDER="do"
46+
47+
# Log and test directories
48+
LOGS_DIR="$SCRIPT_DIR/logs"
49+
TEST_DIR="$SCRIPT_DIR/test"
50+
mkdir -p "$LOGS_DIR" "$TEST_DIR"
51+
52+
# Date format for backup directories and logs
53+
DATE_FORMAT="%Y-%m-%d_%H-%M-%S"
54+
DATE=$(date +$DATE_FORMAT)
55+
56+
# Backup naming convention
57+
BACKUP_PREFIX="webdev_backup"
58+
59+
# Log files
60+
BACKUP_HISTORY_LOG="$LOGS_DIR/backup_history.log"
61+
TEST_HISTORY_LOG="$TEST_DIR/test_history.log"
62+
63+
# Export variables for use in other scripts
64+
export SCRIPT_DIR DEFAULT_SOURCE_DIRS DEFAULT_SOURCE_DIR DEFAULT_BACKUP_DIR DEFAULT_CLOUD_PROVIDER
65+
export LOGS_DIR TEST_DIR DATE_FORMAT DATE BACKUP_PREFIX
66+
export BACKUP_HISTORY_LOG TEST_HISTORY_LOG

dirs-status.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
# Source the shared modules
55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6-
source "$SCRIPT_DIR/../core/config.sh"
7-
source "$SCRIPT_DIR/../utils/utils.sh"
6+
source "$SCRIPT_DIR/config.sh"
7+
source "$SCRIPT_DIR/utils.sh"
88

99
# Header
1010
echo -e "${CYAN}===== WebDev Backup Tool - Source Directories Report =====${NC}"

0 commit comments

Comments
 (0)