aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md16
-rwxr-xr-xdot-backup.sh19
2 files changed, 32 insertions, 3 deletions
diff --git a/README.md b/README.md
index 1550e51..fa59028 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,20 @@ cd dots-backup
./dot-backup.sh
```
-On first run the script creates `~/Programming/GIT/my-dotfiles` and initializes a git repo inside it. Add a remote so you can push:
+On first run the script:
+
+1. Creates `~/.config/dot-backup/` and `~/.local/share/dot-backup/` and prints a short setup summary
+2. Creates `~/Programming/GIT/my-dotfiles/{home,system}` and initializes a git repo inside it
+3. Runs the backup immediately using built-in defaults
+
+Optionally set up a config file and custom files list (script will tell you the exact paths):
+
+```bash
+cp config.example ~/.config/dot-backup/config
+touch ~/.config/dot-backup/files.list
+```
+
+Add a remote to the backup repo so you can push:
```bash
cd ~/Programming/GIT/my-dotfiles
@@ -96,7 +109,6 @@ System files (absolute paths like `/etc/bash_completion.d`) may need `sudo`.
Copy `config.example` to `~/.config/dot-backup/config` and edit:
```bash
-mkdir -p ~/.config/dot-backup
cp config.example ~/.config/dot-backup/config
```
diff --git a/dot-backup.sh b/dot-backup.sh
index 6813b14..dd40f25 100755
--- a/dot-backup.sh
+++ b/dot-backup.sh
@@ -30,6 +30,14 @@ LOG_FILE="${HOME}/.local/share/dot-backup/backup.log"
DOTFILES_LIST="${HOME}/.config/dot-backup/files.list"
CONFIG_FILE="${HOME}/.config/dot-backup/config"
+# Bootstrap config and log directories on first run
+FIRST_RUN=false
+if [[ ! -d "$(dirname "$CONFIG_FILE")" ]]; then
+ FIRST_RUN=true
+fi
+mkdir -p "$(dirname "$CONFIG_FILE")"
+mkdir -p "$(dirname "$LOG_FILE")"
+
# Load config file if present
if [[ -f "$CONFIG_FILE" ]]; then
# shellcheck source=/dev/null
@@ -64,7 +72,6 @@ for arg in "$@"; do
done
if [[ "$QUIET" == true ]]; then
- mkdir -p "$(dirname "$LOG_FILE")"
# save original stdout so we can notify user after redirect
exec 3>&1
# strip color codes and write to log
@@ -264,6 +271,16 @@ do_restore() {
clear
+if [[ "$FIRST_RUN" == true ]]; then
+ echo -e "${GREEN}First run — config directories created:${NC}"
+ echo -e " ${BLUE}$(dirname "$CONFIG_FILE")${NC} — drop config and files.list here"
+ echo -e " ${BLUE}$(dirname "$LOG_FILE")${NC} — logs written here when using -q"
+ echo -e "\nOptional next steps:"
+ echo -e " cp config.example ${CONFIG_FILE}"
+ echo -e " touch ${DOTFILES_LIST}"
+ echo -e "\nProceeding with backup using built-in defaults...\n"
+fi
+
if [[ "$DRY_RUN" == true ]]; then
echo -e "${YELLOW}*** DRY RUN — no files will be copied ***${NC}\n"
fi