Skip to content

Add automated rollback script for dotfiles installation #61

@maxrantil

Description

@maxrantil

Context

install.sh creates timestamped backup directories (.dotfiles_backup_YYYYMMDD_HHMMSS) when conflicting files exist, but there's no automated way to restore from these backups.

Problem

Manual rollback required: If installation fails or causes issues, users must manually:

  1. Identify the latest backup directory
  2. Remove current symlinks
  3. Restore files from backup
  4. Verify restoration

Risk: Manual process is error-prone and time-consuming.

Recommended Solution

Create rollback.sh script:

#\!/bin/bash
# rollback.sh - Automated dotfiles rollback

set -e

# Find latest backup
LATEST_BACKUP=$(find "$HOME" -maxdepth 1 -name ".dotfiles_backup_*" -type d | sort -r | head -1)

if [ -z "$LATEST_BACKUP" ]; then
    echo "ERROR: No backup found"
    exit 1
fi

echo "Rolling back to: $LATEST_BACKUP"
ls -lh "$LATEST_BACKUP"

read -p "Restore these files? (y/N): " -n 1 -r
if [[ \! $REPLY =~ ^[Yy]$ ]]; then
    exit 0
fi

# Remove current symlinks
# Restore files from backup
# Clean up empty backup directory

Benefits

  • One-command rollback: ./rollback.sh
  • Safe with confirmation prompt
  • Preserves user data
  • Enables confident experimentation

Testing Requirements

  • Verify symlink removal
  • Validate file restoration
  • Test permission preservation
  • Ensure cleanup of empty backup dir

Estimated Effort

45-60 minutes (implementation + testing)

Priority

High - Critical for production confidence

References

  • Agent: devops-deployment-agent (recommended for deployment safety)
  • Agent: security-validator (noted missing rollback capability)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions