Orion/2. Areas/Home Personal/knowledge/Backup Omarchy.md
Avi a66996ac10 Orion vault — clean initial history
Knowledge vault (Orion/PARA) migrated from the pre-Orion 484vault on
2026-10-01. Deliberately orphaned: prior history contained a plaintext
password and stays local-only on branch archive/pre-boilerplate-history.
Secrets and live Hermes state are gitignored.
2026-10-02 08:34:48 -05:00

3.9 KiB

ei#backupomarchy

The follow script backs up

- `~/.config/`
- `~/.bashrc`
- `~/.bash_profile`
- `~/.zshrc`
- `~/.XCompose`
- `~/.local/bin/`
- `~/.config/systemd/user/`
- Official Pacman package list
- AUR package list
- Flatpak application list
- Enabled user-systemd services list
- Backup date, hostname, and kernel version in `README.txt`

This Bash script asks where to save the backup, then copies your Omarchy-related configuration, custom scripts, user services, and package lists.

In terminal:

nano backup-omarchy.sh

#!/usr/bin/env bash

set -u

echo "Omarchy configuration backup"
echo

read -r -e -p "Where should the backup be saved? " DEST

if [[ -z "$DEST" ]]; then
    echo "No destination entered. Exiting."
    exit 1
fi

# Expand ~/ if used
DEST="${DEST/#\~/$HOME}"

TIMESTAMP="$(date +%Y-%m-%d_%H-%M-%S)"
BACKUP_DIR="$DEST/omarchy-backup-$TIMESTAMP"

mkdir -p "$BACKUP_DIR"

echo
echo "Creating backup in:"
echo "  $BACKUP_DIR"
echo

copy_item() {
    local source="$1"
    local destination="$BACKUP_DIR/$2"

    if [[ -e "$source" ]]; then
        mkdir -p "$(dirname "$destination")"
        cp -a "$source" "$destination"
        echo "Backed up: $source"
    else
        echo "Skipped, not found: $source"
    fi
}

# User configuration
copy_item "$HOME/.config" ".config"
copy_item "$HOME/.bashrc" ".bashrc"
copy_item "$HOME/.bash_profile" ".bash_profile"
copy_item "$HOME/.zshrc" ".zshrc"
copy_item "$HOME/.XCompose" ".XCompose"

# Custom user scripts
copy_item "$HOME/.local/bin" ".local/bin"

# User-level systemd services
copy_item "$HOME/.config/systemd/user" ".config/systemd/user"

# Package lists
if command -v pacman >/dev/null 2>&1; then
    pacman -Qqe > "$BACKUP_DIR/packages-official.txt"
    pacman -Qqm > "$BACKUP_DIR/packages-aur.txt"
    echo "Saved Pacman package lists"
fi

# Flatpak applications, if Flatpak is installed
if command -v flatpak >/dev/null 2>&1; then
    flatpak list --app --columns=application > "$BACKUP_DIR/flatpak-apps.txt"
    echo "Saved Flatpak application list"
fi

# Enabled user services
if command -v systemctl >/dev/null 2>&1; then
    systemctl --user list-unit-files --state=enabled \
        > "$BACKUP_DIR/enabled-user-services.txt" 2>/dev/null || true
    echo "Saved enabled user services"
fi

# Basic system information for reference
{
    echo "Backup created: $(date)"
    echo "Hostname: $(hostname)"
    echo "Kernel: $(uname -r)"
    echo
    echo "This backup contains user configuration and package lists."
    echo "Omarchy's own system files were intentionally not copied."
} > "$BACKUP_DIR/README.txt"

echo
echo "Backup complete."
echo "Location: $BACKUP_DIR"
echo

# Optional archive
read -r -p "Create a compressed archive too? [y/N] " MAKE_ARCHIVE

if [[ "$MAKE_ARCHIVE" =~ ^[Yy]$ ]]; then
    ARCHIVE="${BACKUP_DIR}.tar.gz"
    tar -czf "$ARCHIVE" -C "$(dirname "$BACKUP_DIR")" "$(basename "$BACKUP_DIR")"
    echo "Archive created:"
    echo "  $ARCHIVE"
fi

Make it executable

chmod +x backup-omarchy.sh && ./backup-omarchy.sh

Run it:

./backup-omarchy.sh

It will ask:

Where should the backup be saved?

In another terminal:

Location of drive

lsblk

Example: !

My external drive is

/dev/sda1

To see complete folder path

findmnt -no TARGET /dev/sda1

When the script asks where to save the backup, enter the mount path followed by the folder name:

Example:

/run/media/avi/samsung_xh/omarchy configuration backup

Backup[ Personal Files

Books                          /home/avi/Books
DCIM                           /home/avi/DCIM
Documents                      /home/avi/Documents
Downloads                      /home/avi/Downloads
Folio-Recovery                 /home/avi/Folio-Recovery
Moivault                       /home/avi/Moivault
Movies                         /home/avi/Movies
Music                          /home/avi/Music
Projects                       /home/avi/Projects