diff options
Diffstat (limited to 'dot-backup.sh')
| -rwxr-xr-x | dot-backup.sh | 19 |
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 |
