- Rust 100%
| recovery-cli | ||
| .drone.yml | ||
| .gitignore | ||
| README.md | ||
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 testinrecovery-cli/. - Tags
v*: Release pipeline buildsx86_64-unknown-linux-gnuandaarch64-unknown-linux-gnubinaries, writesSHA256SUMS, and producesrecovery-$DRONE_TAG-linux-gnu.tar.gzat the repo root. The tag job verifies the tarball lists both binaries andSHA256SUMS. Configure a Drone secret such asgitea_tokenfor 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 forge’s release page. Prefer the recovery binary for new deployments; original shell sources live under legacy/ (see note above about .gitignore).