Script de reparation GRUB depuis cle USB live
sudo bash fix-grub-live.sh Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
43
scripts/fix-grub-live.sh
Normal file
43
scripts/fix-grub-live.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
# Reparer GRUB depuis une cle USB live
|
||||
# Usage: sudo bash fix-grub-live.sh
|
||||
set -e
|
||||
|
||||
DISK=""
|
||||
for d in /dev/sda /dev/nvme0n1 /dev/sdb /dev/vda; do
|
||||
if [ -b "$d" ] && [ "$(cat /sys/block/$(basename $d)/removable 2>/dev/null)" = "0" ]; then
|
||||
DISK="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ -n "$1" ] && DISK="$1"
|
||||
[ -z "$DISK" ] && { echo "Aucun disque detecte. Usage: $0 /dev/sdX"; exit 1; }
|
||||
|
||||
if [[ "$DISK" == *"nvme"* ]]; then
|
||||
P="${DISK}p"
|
||||
else
|
||||
P="${DISK}"
|
||||
fi
|
||||
|
||||
echo "=== Reparation GRUB sur $DISK ==="
|
||||
|
||||
# Monter
|
||||
mount "${P}2" /mnt
|
||||
mount "${P}1" /mnt/boot/efi
|
||||
for d in dev dev/pts proc sys run; do mount --bind /$d /mnt/$d; done
|
||||
|
||||
# Installer git + fonts, cloner le repo, installer theme + GRUB
|
||||
chroot /mnt bash -c '
|
||||
apt update -qq
|
||||
apt install -y -qq git grub-efi-amd64 fonts-dejavu-core
|
||||
[ -d /home/jules/photobooth ] || git clone https://git.copydev.fr/jules/photobooth.git /home/jules/photobooth
|
||||
cd /home/jules/photobooth && git pull
|
||||
bash scripts/install-grub-theme.sh
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck
|
||||
'
|
||||
|
||||
# Nettoyer
|
||||
umount -R /mnt
|
||||
|
||||
echo ""
|
||||
echo "=== GRUB repare ! Retirer la cle et rebooter ==="
|
||||
Reference in New Issue
Block a user