aboutsummaryrefslogtreecommitdiffstats
path: root/dot-backup.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-06 09:42:55 +0200
committerDanilo M. <danix@danix.xyz>2026-05-06 09:42:55 +0200
commit78742f69a5080fe0bdab7dac61400028ee107a37 (patch)
tree40e544b0cf37c25c323b49a6eecec585d977b2ea /dot-backup.sh
parent1076091203f9387385e663ad19c7ea3648650bec (diff)
downloaddots-backup-78742f69a5080fe0bdab7dac61400028ee107a37.tar.gz
dots-backup-78742f69a5080fe0bdab7dac61400028ee107a37.zip
Bootstrap config dirs on first run with setup message
Script now creates ~/.config/dot-backup/ and ~/.local/share/dot-backup/ on first run and prints a summary with next steps. README updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'dot-backup.sh')
-rwxr-xr-xdot-backup.sh19
1 files changed, 18 insertions, 1 deletions
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