Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
20 lines
481 B
Bash
Executable File
20 lines
481 B
Bash
Executable File
#!/bin/bash
|
|
# omarchy:summary=Restore the most recent mirrorlist backup
|
|
# omarchy:examples=omarchycn mirror restore
|
|
# omarchy:requires-sudo=true
|
|
|
|
set -euo pipefail
|
|
|
|
source "$OMARCHY_PATH/cn/lib/mirror.sh"
|
|
|
|
backups=("$CN_MIRRORLIST".omarchycn-bak-*)
|
|
if [[ ! -e ${backups[0]} ]]; then
|
|
echo "No OmarchyCN mirrorlist backups found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
latest="${backups[-1]}"
|
|
sudo cp "$latest" "$CN_MIRRORLIST"
|
|
rm -f "$CN_PROFILE_FILE"
|
|
echo "Restored $CN_MIRRORLIST from ${latest##*/}"
|