clear out & tidy ready for Omarchy migration

This commit is contained in:
2026-03-07 17:33:00 +00:00
parent 4064561d14
commit f16308e74b
14 changed files with 15 additions and 671 deletions
+15 -15
View File
@@ -5,54 +5,54 @@
# Configuration
BACKUP_DIR="/mnt/nas/Jake/git_backups"
REPO_SOURCE="/mnt/bulk/temp"
REPO_SOURCE="$HOME/source/"
# Function to restore a single project from latest backup
restore_project() {
local project_name="$1"
local latest_backup=$(find "$BACKUP_DIR" -maxdepth 1 -type d -name "*" | sort -r | head -n 1)
if [ -z "$latest_backup" ]; then
echo "Error: No backups found in $BACKUP_DIR"
exit 1
fi
local project_backup_path="${latest_backup}/${project_name}"
if [ ! -d "$project_backup_path" ]; then
echo "Error: Backup for project '$project_name' not found in latest backup"
exit 1
fi
echo "Restoring $project_name from latest backup..."
# Create the project directory if it doesn't exist
mkdir -p "$REPO_SOURCE/$project_name"
# Extract the backup to the source directory
tar -xf "${project_backup_path}/backup.tar" -C "$REPO_SOURCE/$project_name"
echo "Successfully restored $project_name from backup"
}
# Main restore function
main_restore() {
local latest_backup=$(find "$BACKUP_DIR" -maxdepth 1 -type d -name "*" | sort -r | head -n 1)
if [ -z "$latest_backup" ]; then
echo "Error: No backups found in $BACKUP_DIR"
exit 1
fi
echo "Latest backup directory: $latest_backup"
if [ $# -eq 0 ]; then
# Restore all projects from latest backup
echo "Restoring all projects from latest backup..."
# Get list of project directories in the backup
local projects=($(ls "$latest_backup"))
for project in "${projects[@]}"; do
restore_project "$project"
done
@@ -61,9 +61,9 @@ main_restore() {
local target_project="$1"
restore_project "$target_project"
fi
echo "Restore completed successfully!"
}
# Run main restore function
main_restore "$@"
main_restore "$@"