Skip to content

Instantly share code, notes, and snippets.

@mirkobrombin
Last active August 1, 2024 20:16
Show Gist options
  • Save mirkobrombin/69d49deac0a56e6083f99d3cf33ea921 to your computer and use it in GitHub Desktop.
Save mirkobrombin/69d49deac0a56e6083f99d3cf33ea921 to your computer and use it in GitHub Desktop.
vos-recovery
#!/bin/bash
mkdir -p /mnt/boot /mnt/init
mount LABEL=vos-init /mnt/init
mount LABEL=vos-boot /mnt/boot
first_line=$(head -n 1 /mnt/boot/grub/grub.cfg)
if echo "$first_line" | grep -q "set default=0"; then
X="a"
elif echo "$first_line" | grep -q "set default=1"; then
X="b"
else
echo "Error: Unexpected content in grub.cfg"
exit 1
fi
echo "your GRUB is in: /mnt/init/vos-$X/abroot.cfg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment