No description
Find a file
2026-05-02 10:35:00 -05:00
recovery-cli Add recovery CLI with shared root discovery, CI, and docs 2026-05-02 10:35:00 -05:00
.drone.yml Add recovery CLI with shared root discovery, CI, and docs 2026-05-02 10:35:00 -05:00
.gitignore Add recovery CLI with shared root discovery, CI, and docs 2026-05-02 10:35:00 -05:00
README.md Add recovery CLI with shared root discovery, CI, and docs 2026-05-02 10:35:00 -05:00

Recovery Scripts

Shell utilities and a Rust CLI for server recovery: chroot workflows, filesystem checks, GRUB repair, and R1Soft agent reinstall.

Run these tools from an appropriate rescue or maintenance environment and review behavior before use.

Rust CLI (recovery-cli)

The recovery binary replaces the interactive recovery shell menu and mirrors the logic of the legacy shell scripts in legacy/ (fsck.zsh, grub-repair.zsh, chroot-v2.zsh, r1soft-agent-recovery.sh) by shelling out to system tools (lsblk, mount, fsck, chroot, apt-get, etc.).

The legacy/ directory is listed in .gitignore so local copies of the original scripts are not tracked; keep your own snapshot there if you still run the shell versions, or remove the /legacy/ line from .gitignore if you want those files versioned in Git.

Build

cd recovery-cli
cargo build --release
# binary: target/release/recovery

Requires a recent stable Rust toolchain (rustup default stable).

Usage

recovery [SUBCOMMAND]

With no subcommand, the interactive menu runs (same spirit as the legacy recovery script).

Subcommand Description
menu Interactive menu (default)
fsck Select disks/partitions, confirm, run fsck -y on unmounted targets
grub Find root filesystems, mount, reinstall/update GRUB inside chroot
chroot Chroot recovery: optional root password reset; honors MIN_ROOT_SIZE_BYTES, RECOVERY_FS_TYPES
r1soft Debian/Ubuntu R1Soft agent reinstall; alias r1soft-agent

Examples:

sudo ./target/release/recovery
sudo ./target/release/recovery fsck
sudo ./target/release/recovery r1soft --manager-url 'https://backup-manager.example.com'

Environment variables

Variable Used by Notes
MIN_ROOT_SIZE_BYTES chroot, grub Default 5368709120 (5 GiB); skips tiny partitions when scanning for root
RECOVERY_FS_TYPES chroot Comma-separated list; default ext4,ext3,xfs,btrfs,f2fs
R1SOFT_MANAGER_URL r1soft Manager URL for r1soft-setup --get-key
R1SOFT_KEY_URL r1soft Default https://repo.r1soft.com/r1soft.asc
R1SOFT_REPO_URL r1soft Default https://repo.r1soft.com/apt
R1SOFT_REPO_SUITE r1soft Default stable
R1SOFT_REPO_COMPONENT r1soft Default main

CI (Drone)

The repo includes .drone.yml:

  • Push / PR: cargo fmt --check, cargo clippy -D warnings, cargo test in recovery-cli/.
  • Tags v*: Release pipeline builds x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu binaries, writes SHA256SUMS, and produces recovery-$DRONE_TAG-linux-gnu.tar.gz at the repo root. The tag job verifies the tarball lists both binaries and SHA256SUMS. Configure a Drone secret such as gitea_token for your Gitea (or other) release upload; the YAML comments show placeholder wiring only—do not commit tokens.

Releases

Attach the tarball and checksum file from the tag pipeline (or local dist/ after running the same commands) to your forges release page. Prefer the recovery binary for new deployments; original shell sources live under legacy/ (see note above about .gitignore).