- Fond sombre avec degradé - Icônes 96x96 pour chaque projet (PB, PS, ?) - Grosses polices DejaVu pour ecran tactile - Highlight de selection bleu - GRUB_TIMEOUT=-1 : attend la selection (pas de timeout) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
344 lines
10 KiB
Bash
344 lines
10 KiB
Bash
#!/bin/bash
|
|
# Triple Boot Debian 13 (Trixie) - Installation automatisee
|
|
# A executer depuis une cle USB live Debian/Ubuntu
|
|
set -e
|
|
|
|
# === CONFIGURATION ===
|
|
# Detecter automatiquement le disque principal (exclut USB/removable)
|
|
DISK=""
|
|
for d in /dev/nvme0n1 /dev/sda /dev/sdb /dev/vda; do
|
|
if [ -b "$d" ] && [ "$(cat /sys/block/$(basename $d)/removable 2>/dev/null)" = "0" ]; then
|
|
DISK="$d"
|
|
break
|
|
fi
|
|
done
|
|
# Si pas detecte, permettre de le passer en argument
|
|
[ -n "$1" ] && DISK="$1"
|
|
[ -z "$DISK" ] && { echo "Aucun disque detecte. Usage: $0 /dev/sdX"; exit 1; }
|
|
|
|
USER="jules"
|
|
PASSWORD="jules" # A changer apres installation
|
|
MIRROR="http://deb.debian.org/debian"
|
|
SUITE="trixie"
|
|
|
|
PARTITIONS=("photobooth" "photostation" "autre")
|
|
PART_SIZES=("155G" "155G" "155G")
|
|
SWAP_SIZE="8G"
|
|
EFI_SIZE="512M"
|
|
|
|
# === COULEURS ===
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
|
|
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
error() { echo -e "${RED}[ERREUR]${NC} $1"; exit 1; }
|
|
|
|
# === VERIFICATIONS ===
|
|
if [ "$EUID" -ne 0 ]; then
|
|
error "Ce script doit etre execute en root (sudo)"
|
|
fi
|
|
|
|
if [ ! -b "$DISK" ]; then
|
|
error "Disque $DISK non trouve. Verifier avec 'lsblk'"
|
|
fi
|
|
|
|
# Detecter le suffixe de partition (nvme = p1, sda = 1)
|
|
if [[ "$DISK" == *"nvme"* ]]; then
|
|
PART_PREFIX="${DISK}p"
|
|
else
|
|
PART_PREFIX="${DISK}"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo " TRIPLE BOOT DEBIAN 13 - TERRA"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Disque cible : $DISK"
|
|
echo "Partitions : ${PARTITIONS[*]}"
|
|
echo ""
|
|
warn "TOUTES LES DONNEES SUR $DISK SERONT EFFACEES !"
|
|
echo ""
|
|
read -p "Continuer ? (oui/non) : " CONFIRM
|
|
if [ "$CONFIRM" != "oui" ]; then
|
|
echo "Annule."
|
|
exit 0
|
|
fi
|
|
|
|
# === INSTALLATION DES OUTILS ===
|
|
info "Installation des outils necessaires..."
|
|
apt-get update -qq
|
|
apt-get install -y -qq debootstrap parted dosfstools arch-install-scripts > /dev/null 2>&1 || {
|
|
# arch-install-scripts fournit genfstab, sinon on s'en passe
|
|
apt-get install -y -qq debootstrap parted dosfstools > /dev/null 2>&1
|
|
}
|
|
|
|
# === PARTITIONNEMENT ===
|
|
info "Partitionnement de $DISK..."
|
|
|
|
# Effacer la table de partition
|
|
wipefs -a "$DISK" > /dev/null 2>&1
|
|
sgdisk --zap-all "$DISK" > /dev/null 2>&1 || true
|
|
|
|
# Creer la table GPT et les partitions
|
|
parted -s "$DISK" mklabel gpt
|
|
parted -s "$DISK" mkpart "EFI" fat32 1MiB 513MiB
|
|
parted -s "$DISK" set 1 esp on
|
|
parted -s "$DISK" mkpart "photobooth" ext4 513MiB 159233MiB # ~155 Go
|
|
parted -s "$DISK" mkpart "photostation" ext4 159233MiB 318465MiB # ~155 Go
|
|
parted -s "$DISK" mkpart "autre" ext4 318465MiB 477697MiB # ~155 Go
|
|
parted -s "$DISK" mkpart "swap" linux-swap 477697MiB 485889MiB # ~8 Go
|
|
|
|
# Attendre que les partitions apparaissent
|
|
sleep 2
|
|
partprobe "$DISK"
|
|
sleep 2
|
|
|
|
# Formater
|
|
info "Formatage des partitions..."
|
|
mkfs.fat -F32 "${PART_PREFIX}1"
|
|
mkfs.ext4 -q -L "photobooth" "${PART_PREFIX}2"
|
|
mkfs.ext4 -q -L "photostation" "${PART_PREFIX}3"
|
|
mkfs.ext4 -q -L "autre" "${PART_PREFIX}4"
|
|
mkswap -L "swap" "${PART_PREFIX}5"
|
|
|
|
# Recuperer les UUID
|
|
UUID_EFI=$(blkid -s UUID -o value "${PART_PREFIX}1")
|
|
UUID_1=$(blkid -s UUID -o value "${PART_PREFIX}2")
|
|
UUID_2=$(blkid -s UUID -o value "${PART_PREFIX}3")
|
|
UUID_3=$(blkid -s UUID -o value "${PART_PREFIX}4")
|
|
UUID_SWAP=$(blkid -s UUID -o value "${PART_PREFIX}5")
|
|
|
|
UUIDS=("$UUID_1" "$UUID_2" "$UUID_3")
|
|
|
|
info "Partitionnement termine."
|
|
lsblk "$DISK"
|
|
|
|
# === INSTALLATION DES 3 SYSTEMES ===
|
|
install_system() {
|
|
local INDEX=$1
|
|
local NAME="${PARTITIONS[$INDEX]}"
|
|
local PART="${PART_PREFIX}$((INDEX + 2))"
|
|
local UUID="${UUIDS[$INDEX]}"
|
|
local MNT="/mnt/${NAME}"
|
|
|
|
info "=== Installation de ${NAME} ($PART) ==="
|
|
|
|
# Monter
|
|
mkdir -p "$MNT"
|
|
mount "$PART" "$MNT"
|
|
mkdir -p "$MNT/boot/efi"
|
|
mount "${PART_PREFIX}1" "$MNT/boot/efi"
|
|
|
|
# Debootstrap
|
|
info " debootstrap ${NAME}..."
|
|
debootstrap --arch=amd64 "$SUITE" "$MNT" "$MIRROR"
|
|
|
|
# fstab
|
|
cat > "$MNT/etc/fstab" <<FSTAB
|
|
UUID=$UUID / ext4 errors=remount-ro 0 1
|
|
UUID=$UUID_EFI /boot/efi vfat umask=0077 0 1
|
|
UUID=$UUID_SWAP none swap sw 0 0
|
|
FSTAB
|
|
|
|
# Hostname
|
|
echo "$NAME" > "$MNT/etc/hostname"
|
|
cat > "$MNT/etc/hosts" <<HOSTS
|
|
127.0.0.1 localhost
|
|
127.0.1.1 $NAME
|
|
HOSTS
|
|
|
|
# Sources APT
|
|
cat > "$MNT/etc/apt/sources.list" <<SOURCES
|
|
deb $MIRROR $SUITE main contrib non-free non-free-firmware
|
|
deb $MIRROR ${SUITE}-updates main contrib non-free non-free-firmware
|
|
deb http://security.debian.org/debian-security ${SUITE}-security main contrib non-free non-free-firmware
|
|
SOURCES
|
|
|
|
# Chroot pour configurer
|
|
mount --bind /dev "$MNT/dev"
|
|
mount --bind /dev/pts "$MNT/dev/pts"
|
|
mount --bind /proc "$MNT/proc"
|
|
mount --bind /sys "$MNT/sys"
|
|
mount --bind /run "$MNT/run"
|
|
|
|
# Script de configuration dans le chroot
|
|
cat > "$MNT/tmp/setup.sh" <<SETUP
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
# Locale et timezone
|
|
echo "Europe/Paris" > /etc/timezone
|
|
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
|
|
apt-get update -qq
|
|
apt-get install -y -qq locales
|
|
sed -i 's/# fr_FR.UTF-8/fr_FR.UTF-8/' /etc/locale.gen
|
|
locale-gen
|
|
update-locale LANG=fr_FR.UTF-8
|
|
|
|
# Installer le noyau, GRUB, firmware et outils de base
|
|
apt-get install -y -qq \
|
|
linux-image-amd64 \
|
|
grub-efi-amd64 \
|
|
firmware-linux \
|
|
sudo \
|
|
network-manager \
|
|
openssh-server \
|
|
bash-completion \
|
|
console-setup \
|
|
keyboard-configuration
|
|
|
|
# Creer l'utilisateur
|
|
useradd -m -s /bin/bash -G sudo,video,input,audio $USER
|
|
echo "$USER:$PASSWORD" | chpasswd
|
|
echo "root:$PASSWORD" | chpasswd
|
|
|
|
# Sudo sans mot de passe (optionnel, pratique pour le kiosk)
|
|
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER
|
|
|
|
# Activer NetworkManager
|
|
systemctl enable NetworkManager
|
|
|
|
# Configurer le clavier FR
|
|
cat > /etc/default/keyboard <<KBD
|
|
XKBMODEL="pc105"
|
|
XKBLAYOUT="fr"
|
|
XKBVARIANT=""
|
|
XKBOPTIONS=""
|
|
BACKSPACE="guess"
|
|
KBD
|
|
|
|
SETUP
|
|
|
|
chmod +x "$MNT/tmp/setup.sh"
|
|
chroot "$MNT" /tmp/setup.sh
|
|
|
|
# GRUB : installer seulement depuis le premier systeme
|
|
if [ "$INDEX" -eq 0 ]; then
|
|
chroot "$MNT" grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck
|
|
fi
|
|
|
|
# Nettoyer
|
|
rm -f "$MNT/tmp/setup.sh"
|
|
umount "$MNT/run" "$MNT/sys" "$MNT/proc" "$MNT/dev/pts" "$MNT/dev"
|
|
umount "$MNT/boot/efi"
|
|
umount "$MNT"
|
|
|
|
info " ${NAME} installe."
|
|
}
|
|
|
|
# Installer les 3 systemes
|
|
for i in 0 1 2; do
|
|
install_system "$i"
|
|
done
|
|
|
|
# === CONFIGURATION GRUB FINALE ===
|
|
info "Configuration de GRUB..."
|
|
|
|
MNT="/mnt/photobooth"
|
|
mkdir -p "$MNT"
|
|
mount "${PART_PREFIX}2" "$MNT"
|
|
mount "${PART_PREFIX}1" "$MNT/boot/efi"
|
|
mount --bind /dev "$MNT/dev"
|
|
mount --bind /dev/pts "$MNT/dev/pts"
|
|
mount --bind /proc "$MNT/proc"
|
|
mount --bind /sys "$MNT/sys"
|
|
mount --bind /run "$MNT/run"
|
|
|
|
# === THEME GRUB TACTILE ===
|
|
info "Installation du theme GRUB tactile..."
|
|
|
|
THEME_DEST="$MNT/boot/grub/themes/terra"
|
|
mkdir -p "$THEME_DEST/icons"
|
|
|
|
# Copier le theme depuis le repo clone
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
if [ -d "$SCRIPT_DIR/grub-theme" ]; then
|
|
cp "$SCRIPT_DIR/grub-theme/theme.txt" "$THEME_DEST/"
|
|
cp "$SCRIPT_DIR/grub-theme/background.png" "$THEME_DEST/"
|
|
cp "$SCRIPT_DIR/grub-theme/select_"*.png "$THEME_DEST/"
|
|
cp "$SCRIPT_DIR/grub-theme/icons/"*.png "$THEME_DEST/icons/"
|
|
else
|
|
warn "Theme GRUB non trouve dans $SCRIPT_DIR/grub-theme, theme par defaut"
|
|
fi
|
|
|
|
# Installer les polices GRUB
|
|
chroot "$MNT" bash -c 'grub-mkfont -s 36 -o /boot/grub/fonts/DejaVuSansBold36.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf 2>/dev/null || true'
|
|
chroot "$MNT" bash -c 'grub-mkfont -s 42 -o /boot/grub/fonts/DejaVuSansBold42.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf 2>/dev/null || true'
|
|
chroot "$MNT" bash -c 'grub-mkfont -s 18 -o /boot/grub/fonts/DejaVuSans18.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf 2>/dev/null || true'
|
|
chroot "$MNT" bash -c 'grub-mkfont -s 24 -o /boot/grub/fonts/DejaVuSansBold24.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf 2>/dev/null || true'
|
|
|
|
# Creer les entrees GRUB personnalisees avec icones
|
|
cat > "$MNT/etc/grub.d/40_custom" <<GRUB
|
|
#!/bin/sh
|
|
exec tail -n +3 \$0
|
|
|
|
menuentry "Photobooth" --class photobooth {
|
|
search --no-floppy --fs-uuid --set=root $UUID_1
|
|
linux /boot/vmlinuz-\$(ls /mnt/photobooth/boot/ | grep vmlinuz | head -1 | sed 's/vmlinuz-//') root=UUID=$UUID_1 ro quiet splash
|
|
initrd /boot/initrd.img-\$(ls /mnt/photobooth/boot/ | grep initrd | head -1 | sed 's/initrd.img-//')
|
|
}
|
|
|
|
menuentry "Photostation" --class photostation {
|
|
search --no-floppy --fs-uuid --set=root $UUID_2
|
|
linux /boot/vmlinuz-\$(ls /mnt/photostation/boot/ | grep vmlinuz | head -1 | sed 's/vmlinuz-//') root=UUID=$UUID_2 ro quiet splash
|
|
initrd /boot/initrd.img-\$(ls /mnt/photostation/boot/ | grep initrd | head -1 | sed 's/initrd.img-//')
|
|
}
|
|
|
|
menuentry "Autre" --class autre {
|
|
search --no-floppy --fs-uuid --set=root $UUID_3
|
|
linux /boot/vmlinuz-\$(ls /mnt/autre/boot/ | grep vmlinuz | head -1 | sed 's/vmlinuz-//') root=UUID=$UUID_3 ro quiet splash
|
|
initrd /boot/initrd.img-\$(ls /mnt/autre/boot/ | grep initrd | head -1 | sed 's/initrd.img-//')
|
|
}
|
|
GRUB
|
|
chmod +x "$MNT/etc/grub.d/40_custom"
|
|
|
|
# Desactiver os-prober, activer le theme graphique
|
|
cat > "$MNT/etc/default/grub" <<GRUBCFG
|
|
GRUB_DEFAULT=0
|
|
GRUB_TIMEOUT=-1
|
|
GRUB_DISTRIBUTOR="Triple Boot Terra"
|
|
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
|
|
GRUB_CMDLINE_LINUX=""
|
|
GRUB_DISABLE_OS_PROBER=true
|
|
GRUB_DISABLE_RECOVERY=true
|
|
GRUB_THEME=/boot/grub/themes/terra/theme.txt
|
|
GRUB_GFXMODE=1920x1080,auto
|
|
GRUB_GFXPAYLOAD_LINUX=keep
|
|
GRUBCFG
|
|
|
|
# Installer les polices DejaVu pour le theme
|
|
chroot "$MNT" apt-get install -y -qq fonts-dejavu-core 2>/dev/null || true
|
|
|
|
chroot "$MNT" update-grub
|
|
|
|
# Nettoyer
|
|
umount "$MNT/run" "$MNT/sys" "$MNT/proc" "$MNT/dev/pts" "$MNT/dev"
|
|
umount "$MNT/boot/efi"
|
|
umount "$MNT"
|
|
|
|
# === TERMINE ===
|
|
echo ""
|
|
echo "=========================================="
|
|
echo -e "${GREEN} TRIPLE BOOT INSTALLE AVEC SUCCES${NC}"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo " 1. Photobooth (${PART_PREFIX}2)"
|
|
echo " 2. Photostation (${PART_PREFIX}3)"
|
|
echo " 3. Autre (${PART_PREFIX}4)"
|
|
echo ""
|
|
echo " Utilisateur : $USER"
|
|
echo " Mot de passe : $PASSWORD (a changer !)"
|
|
echo ""
|
|
echo " Retirer la cle USB et redemarrer."
|
|
echo " Au boot, GRUB affichera les 3 choix."
|
|
echo ""
|
|
echo " Pour installer le photobooth :"
|
|
echo " sudo apt install git"
|
|
echo " git clone https://git.copydev.fr/jules/photobooth.git ~/photobooth"
|
|
echo " cd ~/photobooth && sudo bash scripts/install-x86.sh"
|
|
echo ""
|