From 0de970239ffa1e877d9b4419d8904260a1156ff8 Mon Sep 17 00:00:00 2001 From: nocode Date: Tue, 23 Jun 2026 11:02:41 +0200 Subject: [PATCH] feat(build): refactor build script with interactive version and variant selection Replace automatic version reading from VERSION file with interactive prompts for version (major.minor.build) and ISO variant name (e.g., cli, gnome, kde). Changes: - Remove automatic VERSION file reading; now serves as default with prompt - Add interactive prompts for version and variant name with validation - Simplify ISO naming from FWS-v{major}-{minor}-{build}-{date}-x86_64.iso to fws-{version}-{variant}.iso - Update hostname from 'archiso' to 'fws' - Add custom FWS logo for fastfetch with color configuration - Improve error messages and user feedback This enables flexible build variants and streamlines the build process. --- VERSION | 2 +- build-offi.sh | 58 +++++++++++++------ configs/releng/airootfs/etc/hostname | 2 +- .../airootfs/etc/profile.d/fastfetch.sh | 11 +++- .../airootfs/usr/local/share/fws/logo.txt | 9 +++ 5 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 configs/releng/airootfs/usr/local/share/fws/logo.txt diff --git a/VERSION b/VERSION index be14282..7d85683 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.3 +0.5.4 diff --git a/build-offi.sh b/build-offi.sh index fe38a2a..6346bc6 100755 --- a/build-offi.sh +++ b/build-offi.sh @@ -193,29 +193,49 @@ WORK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "==> Dossier de travail : $WORK_DIR" # ============================================================ -# Lecture et validation de la version (fichier VERSION) +# Version (major.minor.build) + nom de la variante. +# La version est DEMANDÉE ; le fichier VERSION sert de DÉFAUT (taper Entrée = +# reprendre sa valeur). Produit fws--.iso +# (ex. fws-1.5.0-cli.iso). Nécessite un terminal (read). # ============================================================ +# Défaut éventuel lu dans le fichier VERSION (doit être major.minor.build). VERSION_FILE="$WORK_DIR/VERSION" -[ -f "$VERSION_FILE" ] \ - || { echo -e "\e[31mFichier VERSION introuvable : $VERSION_FILE\e[0m"; exit 1; } - -# Trim espaces / tabulations / CR / LF -VERSION="$(tr -d ' \t\r\n' < "$VERSION_FILE")" - -if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo -e "\e[31mVERSION invalide : '$VERSION' (attendu Major.Minor.Build, ex. 1.2.3)\e[0m" - exit 1 +VERSION_DEFAULT="" +if [ -f "$VERSION_FILE" ]; then + VERSION_DEFAULT="$(tr -d ' \t\r\n' < "$VERSION_FILE")" + [[ "$VERSION_DEFAULT" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || VERSION_DEFAULT="" fi -IFS='.' read -r MAJOR MINOR BUILD <<< "$VERSION" -BUILD_DATE="$(date +%Y.%m.%d)" -ISO_VERSION="v${MAJOR}-${MINOR}-${BUILD}-${BUILD_DATE}" -OUT_DIR="$WORK_DIR/out/v${MAJOR}/v${MAJOR}.${MINOR}" -ISO_FILE="$OUT_DIR/FWS-${ISO_VERSION}-x86_64.iso" +while :; do + if [ -n "$VERSION_DEFAULT" ]; then + read -rp "==> Version (major.minor.build) [Entrée = $VERSION_DEFAULT] : " VERSION \ + || { echo -e "\e[31mEntrée requise — lance le script en interactif.\e[0m" >&2; exit 1; } + [ -n "$VERSION" ] || VERSION="$VERSION_DEFAULT" # vide → on reprend le fichier VERSION + else + read -rp "==> Version (major.minor.build, ex. 1.5.0) : " VERSION \ + || { echo -e "\e[31mEntrée requise — lance le script en interactif.\e[0m" >&2; exit 1; } + fi + [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && break + echo -e "\e[31m Format attendu : major.minor.build (ex. 1.5.0)\e[0m" >&2 +done +while :; do + read -rp "==> Nom de la variante (ex. cli, gnome, kde) : " ISO_TAG \ + || { echo -e "\e[31mEntrée requise — lance le script en interactif.\e[0m" >&2; exit 1; } + # normalise : minuscules, lettres / chiffres / tirets uniquement + ISO_TAG="$(printf '%s' "$ISO_TAG" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9-')" + [ -n "$ISO_TAG" ] && break + echo -e "\e[31m Nom requis (lettres, chiffres, tirets)\e[0m" >&2 +done -echo "==> Version officielle : ${MAJOR}.${MINOR}.${BUILD}" -echo "==> Dossier de sortie : $OUT_DIR" -echo "==> ISO finale : FWS-${ISO_VERSION}-x86_64.iso" +IFS='.' read -r MAJOR MINOR BUILD <<< "$VERSION" +# iso_version interne (passé à mkarchiso) ; l'ISO finale est renommée plus bas. +ISO_VERSION="${VERSION}-${ISO_TAG}" +OUT_DIR="$WORK_DIR/out/v${MAJOR}/v${MAJOR}.${MINOR}" +ISO_FILE="$OUT_DIR/fws-${VERSION}-${ISO_TAG}.iso" + +echo "==> Version : ${VERSION} · variante : ${ISO_TAG}" +echo "==> ISO finale : fws-${VERSION}-${ISO_TAG}.iso" +echo "==> Dossier : $OUT_DIR" # pacman ≥ 7 sandboxe les ops FS via landlock, non supporté par le kernel # WSL ni (selon le noyau) par le conteneur → désactivation. Idempotent, @@ -324,4 +344,4 @@ echo "==> Nettoyage..." rm -rf /tmp/fws-build/work echo "==> Build officiel terminé ! ISO : $FINAL" -echo -e "\e[32mScript de build officiel (v${MAJOR}.${MINOR}.${BUILD}) terminé avec succès.\e[0m" +echo -e "\e[32mScript de build officiel (fws-${VERSION}-${ISO_TAG}) terminé avec succès.\e[0m" diff --git a/configs/releng/airootfs/etc/hostname b/configs/releng/airootfs/etc/hostname index 2dbe21e..3372134 100644 --- a/configs/releng/airootfs/etc/hostname +++ b/configs/releng/airootfs/etc/hostname @@ -1 +1 @@ -archiso +fws diff --git a/configs/releng/airootfs/etc/profile.d/fastfetch.sh b/configs/releng/airootfs/etc/profile.d/fastfetch.sh index c058a2e..c18008c 100644 --- a/configs/releng/airootfs/etc/profile.d/fastfetch.sh +++ b/configs/releng/airootfs/etc/profile.d/fastfetch.sh @@ -5,5 +5,14 @@ # On utilise donc un autre nom. _fastfetch_rc=$? if [ "${_fastfetch_rc}" -eq 0 ]; then - fastfetch + # Logo FWS maison (4 carrés + Tux) au lieu du logo Arch détecté par défaut. + fastfetch \ + --logo-type file \ + --logo /usr/local/share/fws/logo.txt \ + --logo-color-1 '38;2;30;160;100' \ + --logo-color-2 '38;2;45;125;210' \ + --logo-color-3 '38;2;240;180;40' \ + --logo-color-4 '38;2;25;85;145' \ + --logo-color-5 '38;2;28;28;34' \ + --logo-color-6 '38;2;245;165;35' fi diff --git a/configs/releng/airootfs/usr/local/share/fws/logo.txt b/configs/releng/airootfs/usr/local/share/fws/logo.txt new file mode 100644 index 0000000..bc237b9 --- /dev/null +++ b/configs/releng/airootfs/usr/local/share/fws/logo.txt @@ -0,0 +1,9 @@ +$1████████ $2██$5████$2██ +$1████████ $2█$5██$2██$5██$2█ +$1████████ $2█$5██████$2█ +$1████████ $2██$6█$2██$6█$2██ + +$3████████ $4████████ +$3████████ $4████████ +$3████████ $4████████ +$3████████ $4████████