Amélioration des messages d'état et gestion des erreurs dans le script d'installation

This commit is contained in:
Puechberty Arthur
2026-07-30 01:47:40 +02:00
parent 0e24ac4b34
commit 153d904755
+260 -46
View File
@@ -30,13 +30,13 @@ fi
# 2. Vérification d'internet
if ! ping -c 1 archlinux.org &> /dev/null; then
echo "❌ Erreur : Pas de connexion internet. Connecte-toi avec iwctl d'abord."
echo "[ERROR] Pas de connexion internet. Connecte-toi avec iwctl d'abord."
exit 1
fi
echo " Connexion internet établie."
echo "[OK] Connexion internet établie."
# 3. Synchronisation horloge et dépôts
echo " Préparation du système..."
echo "[INFO] Préparation du système..."
timedatectl set-ntp true
pacman -Syy --noconfirm
@@ -49,7 +49,7 @@ else
PART_ROOT="${DISK}2"
fi
echo " Nettoyage nucléaire de $DISK (suppression des anciennes partitions)..."
echo "[INFO] Nettoyage nucléaire de $DISK..."
umount -R /mnt 2>/dev/null || true
swapoff -a 2>/dev/null || true
dmsetup remove_all 2>/dev/null || true
@@ -66,7 +66,7 @@ blockdev --rereadpt "$DISK" 2>/dev/null || true
udevadm settle
sleep 3
echo " Création des nouvelles partitions sur $DISK..."
echo "[INFO] Création des nouvelles partitions sur $DISK..."
sgdisk -o "$DISK"
sgdisk -n 1:0:+300M -t 1:ef00 "$DISK"
sgdisk -n 2:0:0 -t 2:8300 "$DISK"
@@ -77,14 +77,14 @@ udevadm settle
sleep 3
if [ ! -b "$PART_EFI" ] || [ ! -b "$PART_ROOT" ]; then
echo "❌ Erreur critique : Les partitions $PART_EFI ou $PART_ROOT n'existent pas."
echo "[ERROR] Les partitions $PART_EFI ou $PART_ROOT n'existent pas."
lsblk
exit 1
fi
echo " Partitions créées et détectées : EFI=$PART_EFI, ROOT=$PART_ROOT"
echo "[OK] Partitions créées et détectées : EFI=$PART_EFI, ROOT=$PART_ROOT"
# 5. Formatage et Montage BTRFS optimisé
echo " Formatage BTRFS avec compression ZSTD..."
echo "[INFO] Formatage BTRFS avec compression ZSTD..."
mkfs.fat -F32 "$PART_EFI"
mkfs.btrfs -f "$PART_ROOT"
@@ -93,20 +93,20 @@ mkdir -p /mnt/boot
mount "$PART_EFI" /mnt/boot
# 6. Installation du système strict minimum et optimisé
echo " Installation des paquets (Noyau ZEN, Hyprland, Wayland, Opti Laptop)..."
echo "[INFO] Installation des paquets (Noyau ZEN, Hyprland, Wayland, Opti Laptop)..."
pacstrap /mnt base base-devel linux-zen linux-zen-headers linux-firmware btrfs-progs \
networkmanager sudo git neovim \
$MICROCODE power-profiles-daemon thermald acpi acpid brightnessctl \
pipewire pipewire-pulse pipewire-alsa pipewire-jack wireplumber \
mesa wayland xdg-desktop-portal xdg-desktop-portal-hyprland \
hyprland kitty wofi waybar hyprpaper ttf-jetbrains-mono-nerd
hyprland wofi waybar swaybg ttf-jetbrains-mono-nerd
# 7. Génération fstab optimisée
echo " Génération du fstab..."
echo "[INFO] Génération du fstab..."
genfstab -U /mnt >> /mnt/etc/fstab
# 8. Configuration système dans le chroot
echo " Configuration du système..."
echo "[INFO] Configuration du système..."
cat > /mnt/setup.sh << EOF
#!/bin/bash
set -e
@@ -154,17 +154,17 @@ cat << ARCHCONF > /boot/loader/entries/arch.conf
title Arch Linux (Zen)
linux /vmlinuz-linux-zen
initrd /initramfs-linux-zen.img
EOF
ARCHCONF
if [ -n "$MICROCODE_IMG" ]; then
cat << EOF >> /mnt/setup.sh
cat << ARCHCONF2 >> /boot/loader/entries/arch.conf
initrd /$MICROCODE_IMG
EOF
ARCHCONF2
fi
cat >> /mnt/setup.sh << EOF
cat << ARCHOPTS >> /boot/loader/entries/arch.conf
options root=UUID=\$ROOT_UUID rw rootflags=compress=zstd:1 quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3 nvme_core.default_ps_max_latency_us=0 pcie_aspm=power_save
ARCHCONF
ARCHOPTS
bootctl update
# Services modernes pour laptop
@@ -173,46 +173,260 @@ systemctl enable power-profiles-daemon
systemctl enable thermald
systemctl enable acpid
# Installation de Ghostty via AUR (yay)
echo "[INFO] Installation de yay et ghostty..."
sudo -u $USERNAME bash -c "cd /tmp && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm"
sudo -u $USERNAME bash -c "yay -S --noconfirm ghostty-git || yay -S --noconfirm ghostty || true"
# Configuration Hyprland & Login TTY
USER_HOME="/home/$USERNAME"
mkdir -p \$USER_HOME/.config/hypr
mkdir -p \$USER_HOME/.config/waybar
# Copier la config waybar par défaut si elle existe
cp -r /etc/xdg/waybar/* \$USER_HOME/.config/waybar/ 2>/dev/null || true
# Création directe du fichier de configuration Hyprland (infaillible)
cat << HYPRLAND > \$USER_HOME/.config/hypr/hyprland.conf
# Configuration de base Hyprland
monitor=,preferred,auto,1
# Création de la configuration Hyprland (Format Lua)
cat << 'HYPRCONF' > \$USER_HOME/.config/hypr/hyprland.lua
-- This is an example Hyprland Lua config file.
-- Refer to the wiki for more information.
-- https://wiki.hypr.land/Configuring/Start/
input {
kb_layout = fr
touchpad {
natural_scroll = true
tap-to-click = true
}
}
------------------
---- MONITORS ----
------------------
gestures {
workspace_swipe = true
}
hl.monitor({
output = "",
mode = "preferred",
position = "auto",
scale = "auto",
})
# Raccourcis basiques
bind = SUPER, Q, exec, kitty
bind = SUPER, Return, exec, wofi --show drun
bind = SUPER, M, exit,
bind = SUPER, V, togglefloating,
---------------------
---- MY PROGRAMS ----
---------------------
# Autostart
exec-once = waybar
local terminal = "ghostty"
local fileManager = "thunar"
local menu = "wofi --show drun"
# Gestion des fenêtres
dwindle {
pseudotile = yes
preserve_split = yes
}
HYPRLAND
-------------------
---- AUTOSTART ----
-------------------
hl.on("hyprland.start", function ()
hl.exec_cmd("waybar")
hl.exec_cmd("swaybg -c '#000000'")
end)
-------------------------------
---- ENVIRONMENT VARIABLES ----
-------------------------------
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_SIZE", "24")
-----------------------
----- PERMISSIONS -----
-----------------------
-----------------------
---- LOOK AND FEEL ----
-----------------------
hl.config({
general = {
gaps_in = 5,
gaps_out = 20,
border_size = 2,
col = {
active_border = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45 },
inactive_border = "rgba(595959aa)",
},
resize_on_border = false,
allow_tearing = false,
layout = "dwindle",
},
decoration = {
rounding = 10,
rounding_power = 2,
active_opacity = 1.0,
inactive_opacity = 1.0,
shadow = {
enabled = true,
range = 4,
render_power = 3,
color = 0xee1a1a1a,
},
blur = {
enabled = true,
size = 3,
passes = 1,
vibrancy = 0.1696,
},
},
animations = {
enabled = true,
},
})
hl.curve("easeOutQuint", { type = "bezier", points = { {0.23, 1}, {0.32, 1} } })
hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.36, 1} } })
hl.curve("linear", { type = "bezier", points = { {0, 0}, {1, 1} } })
hl.curve("almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1} } })
hl.curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
hl.curve("easy", { type = "spring", mass = 1, stiffness = 238.1191, dampening = 24.21279333 })
hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" })
hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" })
hl.animation({ leaf = "windows", enabled = true, speed = 4.79, spring = "easy" })
hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, spring = "easy", style = "popin 87%" })
hl.animation({ leaf = "windowsOut", enabled = true, speed = 1.49, bezier = "linear", style = "popin 87%" })
hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" })
hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, bezier = "almostLinear" })
hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" })
hl.animation({ leaf = "layers", enabled = true, speed = 3.81, bezier = "easeOutQuint" })
hl.animation({ leaf = "layersIn", enabled = true, speed = 4, bezier = "easeOutQuint", style = "fade" })
hl.animation({ leaf = "layersOut", enabled = true, speed = 1.5, bezier = "linear", style = "fade" })
hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = 1.79, bezier = "almostLinear" })
hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1.39, bezier = "almostLinear" })
hl.animation({ leaf = "workspaces", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 1.21, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "zoomFactor", enabled = true, speed = 7, bezier = "quick" })
hl.config({
dwindle = {
preserve_split = true,
},
})
hl.config({
master = {
new_status = "master",
},
})
hl.config({
scrolling = {
fullscreen_on_one_column = true,
},
})
----------------
---- MISC ----
----------------
hl.config({
misc = {
force_default_wallpaper = -1,
disable_hyprland_logo = true,
},
})
---------------
---- INPUT ----
---------------
hl.config({
input = {
kb_layout = "fr",
kb_variant = "",
kb_model = "",
kb_options = "",
kb_rules = "",
follow_mouse = 1,
sensitivity = 0,
touchpad = {
natural_scroll = true,
tap-to-click = true,
},
},
})
hl.gesture({
fingers = 3,
direction = "horizontal",
action = "workspace"
})
---------------------
---- KEYBINDINGS ----
---------------------
local mainMod = "SUPER"
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
local closeWindowBind = hl.bind(mainMod .. " + W", hl.dsp.window.close())
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("hyprctl dispatch exit"))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(menu))
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit"))
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
for i = 1, 10 do
local key = i % 10
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i}))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic"))
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true })
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
--------------------------------
---- WINDOWS AND WORKSPACES ----
--------------------------------
hl.window_rule({
name = "suppress-maximize-events",
match = { class = ".*" },
suppress_event = "maximize",
})
hl.window_rule({
name = "fix-xwayland-drags",
match = {
class = "^$",
title = "^$",
xwayland = true,
float = true,
fullscreen = false,
pin = false,
},
no_focus = true,
})
hl.window_rule({
name = "move-hyprland-run",
match = { class = "hyprland-run" },
move = "20 monitor_h-120",
float = true,
})
HYPRCONF
# Lancement auto de Hyprland sur TTY1
cat << BASHPROFILE > \$USER_HOME/.bash_profile
@@ -233,7 +447,7 @@ rm /mnt/setup.sh
umount -R /mnt
echo "=================================================="
echo " INSTALLATION TERMINÉE AVEC SUCCÈS !"
echo " INSTALLATION TERMINEE AVEC SUCCES !"
echo "=================================================="
echo "Redémarrage dans 3 secondes..."
sleep 3