Compare commits
66
Commits
47fd8340a0
...
Main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c233440b77
|
||
|
|
c704a72d3e
|
||
|
|
32af9aad8f
|
||
|
|
382fc3ba03
|
||
|
|
d4cd948b8c
|
||
|
|
cda6c61adc
|
||
|
|
beca881276
|
||
|
|
07a581a80b
|
||
|
|
386633b092
|
||
|
|
d99f489fd8
|
||
|
|
5f12530d7f
|
||
|
|
f69ebd2f4b
|
||
|
|
5b3b54f257
|
||
|
|
766292a1c3
|
||
|
|
5ddcfe20e0
|
||
|
|
9b7a1b4b10
|
||
|
|
b5435fdce0
|
||
|
|
252d7b8484
|
||
|
|
ea3cd5a28d
|
||
|
|
e2634dca71
|
||
|
|
13b2558548
|
||
|
|
a11ebaef00
|
||
|
|
f3ab275a00
|
||
|
|
5a03a9306a
|
||
|
|
7fe5443620
|
||
|
|
a93488bd42
|
||
|
|
8f7b4cbeb7
|
||
|
|
ffe3061015
|
||
|
|
6cbe4e6606
|
||
|
|
e7bca58dae
|
||
|
|
8d2bf2525c
|
||
|
|
43a7daefd4
|
||
|
|
f894b67233
|
||
|
|
2a35886bc5
|
||
|
|
6c78bb456b
|
||
|
|
07827c3dbd
|
||
|
|
ccc94aad3d
|
||
|
|
02141f8cf4
|
||
|
|
365d134df7
|
||
|
|
83833a28d7
|
||
|
|
ce6d8fa66e
|
||
|
|
d02eec6024
|
||
|
|
74eeddae5f
|
||
|
|
1606ccf07e
|
||
|
|
0867d3cc30
|
||
|
|
07f5a4d781
|
||
|
|
dcf94f024a
|
||
|
|
2167322bb5
|
||
|
|
4bce5e08a2
|
||
|
|
a0cca090a2
|
||
|
|
19852487b0
|
||
|
|
c2ff2d4360
|
||
|
|
0a2cbb8485
|
||
|
|
768277b0ce
|
||
|
|
66cefed513
|
||
|
|
dfe8d4a16f
|
||
|
|
4db22a5974
|
||
|
|
9407f0d9d6
|
||
|
|
9b11dd980b
|
||
|
|
e13f92c80c
|
||
|
|
57efcd6972
|
||
|
|
902b03ecbc
|
||
|
|
0bd81a28a9
|
||
|
|
6e0eb8f6fc
|
||
|
|
c465593078
|
||
|
|
9722d03e82
|
No files matched your search
@@ -0,0 +1,30 @@
|
|||||||
|
name: Probe runner
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
probe:
|
||||||
|
runs-on: arch-host
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Probe
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
echo "PWD=$PWD"
|
||||||
|
ls | head
|
||||||
|
sudo pacman -Sy --needed --noconfirm --quiet docker
|
||||||
|
docker run --rm --privileged -v "$PWD:$PWD" -w "$PWD" archlinux:latest sh -c '
|
||||||
|
ls | head
|
||||||
|
test -f release.sh && echo REPO_VISIBLE
|
||||||
|
'
|
||||||
|
echo marker > from-job.txt
|
||||||
|
docker run --rm --privileged -v "$PWD:$PWD" -w "$PWD" archlinux:latest sh -c '
|
||||||
|
cat from-job.txt && echo READ_BACK_OK
|
||||||
|
echo from-container > from-container.txt
|
||||||
|
'
|
||||||
|
echo "--- back in job"
|
||||||
|
cat from-container.txt
|
||||||
|
rm -f from-job.txt from-container.txt
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
# Publishes a new version line: official build, then the release on Gitea and
|
||||||
|
# on GitHub with the ISO attached.
|
||||||
|
#
|
||||||
|
# Triggered when VERSION changes on Main (any push that touches VERSION fires
|
||||||
|
# it, even alongside other files: the path filter is an OR), and manually from
|
||||||
|
# the Actions tab.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [Main]
|
||||||
|
paths:
|
||||||
|
- VERSION
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
variant:
|
||||||
|
description: "Étiquette de l'ISO (multi = tous les bureaux, le choix se fait à l'installation)"
|
||||||
|
required: false
|
||||||
|
default: multi
|
||||||
|
force:
|
||||||
|
description: "Publier même sans changement de ligne de version"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
dry_run:
|
||||||
|
description: "Vérifier la chaîne sans builder ni publier"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
build_only:
|
||||||
|
description: "Builder l'ISO sans publier (valide mkarchiso sur le runner)"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
# One release at a time: a build holds root, loop devices and ~20 min.
|
||||||
|
concurrency:
|
||||||
|
group: release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
# Organisation runners: labels arch-host, ubuntu-latest, debian, alpine.
|
||||||
|
# Jobs run in an unprivileged Arch container (mount denied, no user
|
||||||
|
# namespaces), so build-offi.sh builds in a privileged archlinux container
|
||||||
|
# through the host's Docker socket.
|
||||||
|
runs-on: arch-host
|
||||||
|
timeout-minutes: 180
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Récupérer le dépôt avec ses tags
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# The version-line rule reads the released tags.
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Git — accepter le dépôt monté par le runner
|
||||||
|
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" || true
|
||||||
|
|
||||||
|
- name: Faut-il publier ?
|
||||||
|
id: check
|
||||||
|
env:
|
||||||
|
FORCE: ${{ inputs.force }}
|
||||||
|
run: |
|
||||||
|
# The version-line rule reads the released tags: a checkout without
|
||||||
|
# them (fetch-depth: 0 dropped) would see every VERSION as a new line
|
||||||
|
# and publish a patch release.
|
||||||
|
[ -n "$(git tag -l)" ] \
|
||||||
|
|| { echo "::error::aucun tag dans le checkout — fetch-depth: 0 est requis"; exit 1; }
|
||||||
|
if [ "${FORCE}" = "true" ]; then
|
||||||
|
./release.sh --check --force
|
||||||
|
else
|
||||||
|
./release.sh --check
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Outils du runner (docker)
|
||||||
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
||||||
|
run: |
|
||||||
|
# The job runs in an unprivileged container: mount() is denied and
|
||||||
|
# user namespaces are off. build-offi.sh detects that and runs
|
||||||
|
# mkarchiso in a privileged archlinux container through the host
|
||||||
|
# Docker socket, so only the Docker CLI is needed here.
|
||||||
|
SUDO=(); [ "$(id -u)" -eq 0 ] || SUDO=(sudo)
|
||||||
|
"${SUDO[@]}" pacman -S --needed --noconfirm --quiet docker
|
||||||
|
|
||||||
|
- name: Pré-vol du runner
|
||||||
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
||||||
|
run: |
|
||||||
|
for c in bash curl jq git pacman docker; do
|
||||||
|
command -v "${c}" >/dev/null 2>&1 \
|
||||||
|
|| { echo "::error::${c} absent du runner"; exit 1; }
|
||||||
|
done
|
||||||
|
# build-offi.sh elevates itself once, to install packages and drive
|
||||||
|
# Docker; the build itself runs as root in the privileged container.
|
||||||
|
[ "$(id -u)" -eq 0 ] || sudo -n true 2>/dev/null \
|
||||||
|
|| { echo "::error::sudo sans mot de passe requis (installation des paquets) "; exit 1; }
|
||||||
|
|
||||||
|
# The privileged container is the only place where mount() works:
|
||||||
|
# prove the socket and a mount now, not after 20 minutes of build.
|
||||||
|
[ -S /var/run/docker.sock ] \
|
||||||
|
|| { echo "::error::/var/run/docker.sock absent : impossible de lancer le conteneur de build"; exit 1; }
|
||||||
|
if ! MOUNT_ERR="$(docker run --rm --privileged archlinux:latest \
|
||||||
|
sh -c 'mount -t tmpfs tmpfs /mnt && umount /mnt' 2>&1)"; then
|
||||||
|
echo "::error::le conteneur de build ne peut pas monter : ${MOUNT_ERR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build officiel et publication
|
||||||
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.FWS_GITEA_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.FWS_GITHUB_TOKEN }}
|
||||||
|
VARIANT: ${{ inputs.variant || 'multi' }}
|
||||||
|
DRY_RUN: ${{ inputs.dry_run }}
|
||||||
|
BUILD_ONLY: ${{ inputs.build_only }}
|
||||||
|
run: |
|
||||||
|
if [ "${DRY_RUN}" = "true" ]; then
|
||||||
|
# Same preflight and notes as a real run, without the build or any
|
||||||
|
# publication: how the chain is validated after a change.
|
||||||
|
./release.sh --dry-run --variant "${VARIANT}"
|
||||||
|
elif [ "${BUILD_ONLY}" = "true" ]; then
|
||||||
|
# Proves the official build works on this runner and touches
|
||||||
|
# neither forge. The ISO itself is thrown away with the workspace.
|
||||||
|
FWS_ISO_VERSION="$(cat VERSION)" FWS_ISO_TAG="${VARIANT}" ./build-offi.sh
|
||||||
|
else
|
||||||
|
./release.sh --variant "${VARIANT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Résumé
|
||||||
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
||||||
|
run: |
|
||||||
|
[ -n "${GITHUB_STEP_SUMMARY:-}" ] || exit 0
|
||||||
|
{
|
||||||
|
echo "### FWS $(cat VERSION)"
|
||||||
|
echo ""
|
||||||
|
echo "ISO : $(ls -1t out/v*/v*/*.iso 2>/dev/null | head -1)"
|
||||||
|
} >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
|
||||||
|
- name: Rendre le workspace au runner
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
# The build runs as root: its artifacts stay root-owned in the
|
||||||
|
# workspace, and act_runner then fails to clean it up and cannot check
|
||||||
|
# the repository out for the next run. Hand them back unconditionally.
|
||||||
|
SUDO=(); [ "$(id -u)" -eq 0 ] || SUDO=(sudo)
|
||||||
|
"${SUDO[@]}" chown -R "$(id -u):$(id -g)" . 2>/dev/null || true
|
||||||
|
rm -rf out
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
# AGENTS.md — Instructions pour les agents IA
|
# AGENTS.md — Instructions pour les agents IA
|
||||||
|
|
||||||
> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.md` détaille les conventions de collaboration.
|
> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.rst` détaille les conventions de collaboration.
|
||||||
|
|
||||||
## Contexte
|
## Contexte
|
||||||
|
|
||||||
- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage).
|
- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage).
|
||||||
- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien.
|
- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien.
|
||||||
- Conventions détaillées : `CONTRIBUTING.md` (FR) / `CONTRIBUTING.en.md` (EN).
|
- Conventions détaillées : `CONTRIBUTING.rst`.
|
||||||
|
|
||||||
## Règles à respecter
|
## Règles à respecter
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
## Bonnes pratiques pour un agent
|
## Bonnes pratiques pour un agent
|
||||||
|
|
||||||
- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.md` avant d'éditer du code.
|
- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.rst` avant d'éditer du code.
|
||||||
- Les commits doivent être signés.
|
- Les commits doivent être signés.
|
||||||
- Faire les changements les plus petits possibles qui répondent à la demande.
|
- Faire les changements les plus petits possibles qui répondent à la demande.
|
||||||
- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur.
|
- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Le projet est conçu pour être **construit depuis Windows via WSL** (les script
|
|||||||
### Sur le système installé (outillage `fws-*`)
|
### Sur le système installé (outillage `fws-*`)
|
||||||
| Commande | Rôle | Accès |
|
| Commande | Rôle | Accès |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `fws-hello` | Bienvenue au 1er démarrage (mise à jour, codecs, Proton-GE, VR, raccourcis) | auto au 1er login |
|
| `fws-hello` | Bienvenue au 1er démarrage (mise à jour, « Pilotes et matériel », Proton-GE, raccourcis) | auto au 1er login |
|
||||||
| `fws-wallpaper` | Fond d'écran FWS au **premier démarrage** — image embarquée dans l'ISO (aucun téléchargement) ; le choix fait ensuite par l'utilisateur n'est jamais écrasé (`--force` pour le reposer), et le premier login réessaie jusqu'à **20 min** si le bureau n'est pas prêt | auto au 1er login, `fws-wallpaper --force`, `fws-wallpaper --status`, `--wait <minutes>` |
|
| `fws-wallpaper` | Fond d'écran FWS au **premier démarrage** — image embarquée dans l'ISO (aucun téléchargement) ; le choix fait ensuite par l'utilisateur n'est jamais écrasé (`--force` pour le reposer), et le premier login réessaie jusqu'à **20 min** si le bureau n'est pas prêt | auto au 1er login, `fws-wallpaper --force`, `fws-wallpaper --status`, `--wait <minutes>` |
|
||||||
| `fws-update` | Mise à jour complète (pacman + cache + orphelins + flatpak) | bouton de la barre |
|
| `fws-update` | Mise à jour complète (pacman + cache + orphelins + flatpak) | bouton de la barre |
|
||||||
| `fws-keys` | Panneau des **raccourcis clavier réels** (lit la config Hyprland/i3) | `Super+K`, bouton ⌨ |
|
| `fws-keys` | Panneau des **raccourcis clavier réels** (lit la config Hyprland/i3) | `Super+K`, bouton ⌨ |
|
||||||
@@ -65,7 +65,6 @@ Le projet est conçu pour être **construit depuis Windows via WSL** (les script
|
|||||||
| `fws-drivers` | **« Pilotes et matériel »** : installation simple ou avancée des pilotes et de la stack matérielle, plus « vérifier et réparer seulement ». S'ouvre tout seul au 1er démarrage s'il reste quelque chose à proposer | auto au 1er démarrage, menu d'applications |
|
| `fws-drivers` | **« Pilotes et matériel »** : installation simple ou avancée des pilotes et de la stack matérielle, plus « vérifier et réparer seulement ». S'ouvre tout seul au 1er démarrage s'il reste quelque chose à proposer | auto au 1er démarrage, menu d'applications |
|
||||||
| `fws-setup-hardware` | Le **moteur** derrière la fenêtre ci-dessus, utilisable seul : `--plan`, `--all`, `--groups a,b`, `--unattended`, `--check` | terminal |
|
| `fws-setup-hardware` | Le **moteur** derrière la fenêtre ci-dessus, utilisable seul : `--plan`, `--all`, `--groups a,b`, `--unattended`, `--check` | terminal |
|
||||||
| `fws-intel-rst` | Disques derrière un contrôleur Intel VMD/RST : `--detect`, `--ensure`, `--enable`, `--persist` | terminal, appelé par l'installateur |
|
| `fws-intel-rst` | Disques derrière un contrôleur Intel VMD/RST : `--detect`, `--ensure`, `--enable`, `--persist` | terminal, appelé par l'installateur |
|
||||||
| `fws-vr-setup` | Drivers/runtimes VR (Vive/Index → SteamVR natif ; Quest → ALVR ; Monado) | `Super+Shift+V` (i3), menu |
|
|
||||||
| `fws-proton-ge` | Installe/actualise Proton-GE pour Steam (vérif sha512) | fws-hello, terminal |
|
| `fws-proton-ge` | Installe/actualise Proton-GE pour Steam (vérif sha512) | fws-hello, terminal |
|
||||||
| `fws-recovery` | **Application GTK de réparation** : GRUB, initramfs, pacman, terminal chroot (moteur bash + repli console) | menu « Récupération FWS » de l'OS installé, entrée GRUB « Réparer FWS », entrée de boot du live |
|
| `fws-recovery` | **Application GTK de réparation** : GRUB, initramfs, pacman, terminal chroot (moteur bash + repli console) | menu « Récupération FWS » de l'OS installé, entrée GRUB « Réparer FWS », entrée de boot du live |
|
||||||
| `fws-desktop-retry` *(généré à l'install)* | (Ré)installe le bureau choisi et active le display manager — appelé automatiquement par `fws-desktop-finalize.service` au 1er démarrage si l'install du bureau a échoué ; `--auto` bascule sur l'écran de connexion sans reboot | auto au 1er boot si échec, sinon `sudo fws-desktop-retry` |
|
| `fws-desktop-retry` *(généré à l'install)* | (Ré)installe le bureau choisi et active le display manager — appelé automatiquement par `fws-desktop-finalize.service` au 1er démarrage si l'install du bureau a échoué ; `--auto` bascule sur l'écran de connexion sans reboot | auto au 1er boot si échec, sinon `sudo fws-desktop-retry` |
|
||||||
@@ -238,13 +237,13 @@ L'ISO finale est générée dans `./out/FWS-YYYY.MM.DD-x86_64.iso`.
|
|||||||
4. **`pacman -Syu`** complet (obligatoire — sinon `makepkg` plante sur les "conflicting files" lors des splits de paquets type `gcc-libs`).
|
4. **`pacman -Syu`** complet (obligatoire — sinon `makepkg` plante sur les "conflicting files" lors des splits de paquets type `gcc-libs`).
|
||||||
5. **Install des outils de build** : `base-devel git`.
|
5. **Install des outils de build** : `base-devel git`.
|
||||||
6. **Création d'un utilisateur `fwsbuild`** non-root avec `sudo` NOPASSWD (makepkg refuse de tourner en root).
|
6. **Création d'un utilisateur `fwsbuild`** non-root avec `sudo` NOPASSWD (makepkg refuse de tourner en root).
|
||||||
7. **Clone + build AUR** : `broadcom-wl-dkms` et les paquets de `AUR_PACKAGES` via `makepkg -s --noconfirm`, plus les PKGBUILD locaux de `pkgbuilds/` (fws-pacmanage → PacManager 1.6.2, anaconda, anaconda-widgets, pykickstart, blivet, python-meh patché…). Le build est **incrémental** : un paquet déjà présent dans `local-repo/` à la bonne version est sauté.
|
7. **Clone + build AUR** : `broadcom-wl-dkms` et les paquets de `AUR_PACKAGES` via `makepkg -s --noconfirm`. Les paquets FWS (anaconda et ses deps, fws-dnd, fws-pacmanage) ne sont plus construits ici : ils viennent du dépôt distant `[fws]` déclaré dans le `pacman.conf` du profil. Le build est **incrémental** : un paquet déjà présent dans `local-repo/` à la bonne version est sauté.
|
||||||
- **Si l'AUR est injoignable**, chaque clonage a une seconde chance, puis le paquet déjà construit dans `local-repo/` est réutilisé. Le script n'abandonne que si le paquet est réellement absent. Un réseau qui bronche ne coûte plus les dix minutes de préparation pacman qui précèdent.
|
- **Si l'AUR est injoignable**, chaque clonage a une seconde chance, puis le paquet déjà construit dans `local-repo/` est réutilisé. Le script n'abandonne que si le paquet est réellement absent. Un réseau qui bronche ne coûte plus les dix minutes de préparation pacman qui précèdent.
|
||||||
- **`broadcom-wl-dkms` est construit mais PAS installé** sur la machine de build : il blackliste `b43`/`bcma`/`ssb` pour tout le système et compilerait un module contre le noyau du conteneur. Sur un run Arch natif, l'installer couperait le Wi-Fi de ta propre machine.
|
- **`broadcom-wl-dkms` est construit mais PAS installé** sur la machine de build : il blackliste `b43`/`bcma`/`ssb` pour tout le système et compilerait un module contre le noyau du conteneur. Sur un run Arch natif, l'installer couperait le Wi-Fi de ta propre machine.
|
||||||
8. **Création du repo local** : `repo-add local-repo/fws-local.db.tar.gz`.
|
8. **Création du repo local** : `repo-add local-repo/fws-local.db.tar.gz`.
|
||||||
9. **Cleanup** : suppression de l'utilisateur `fwsbuild`.
|
9. **Cleanup** : suppression de l'utilisateur `fwsbuild`.
|
||||||
|
|
||||||
**Durée** : quelques minutes en incrémental ; le premier build complet (anaconda + deps) est plus long.
|
**Durée** : quelques minutes en incrémental ; le premier build complet des paquets AUR est plus long.
|
||||||
|
|
||||||
### Publier sur le dépôt distant `[fws]`
|
### Publier sur le dépôt distant `[fws]`
|
||||||
|
|
||||||
@@ -264,7 +263,8 @@ Le dépôt distant est partagé avec d'autres projets (fws-deskmanager, fws-kitt
|
|||||||
6. **Dépôt distant `[fws]`** : déclaré dans `pacman.conf` (`SigLevel = Optional TrustAll`), il fournit les paquets FWS — ni `local-repo/` ni `setup-aur.sh` ne sont nécessaires. Sa base est lue avant le build : s'il est injoignable, le build s'arrête tout de suite.
|
6. **Dépôt distant `[fws]`** : déclaré dans `pacman.conf` (`SigLevel = Optional TrustAll`), il fournit les paquets FWS — ni `local-repo/` ni `setup-aur.sh` ne sont nécessaires. Sa base est lue avant le build : s'il est injoignable, le build s'arrête tout de suite.
|
||||||
7. **Paquets embarqués dans l'image** : PacManager (installé sur la cible pendant le `%post`, jamais dans le live) et le pilote Wi-Fi Broadcom (posé seulement si une carte muette est détectée). Le pilote Broadcom est téléchargé depuis `[fws]` et vérifié contre la somme SHA-256 de la base. Le build s'arrête d'emblée si un paquet que seul `[fws]` peut fournir n'y est pas publié.
|
7. **Paquets embarqués dans l'image** : PacManager (installé sur la cible pendant le `%post`, jamais dans le live) et le pilote Wi-Fi Broadcom (posé seulement si une carte muette est détectée). Le pilote Broadcom est téléchargé depuis `[fws]` et vérifié contre la somme SHA-256 de la base. Le build s'arrête d'emblée si un paquet que seul `[fws]` peut fournir n'y est pas publié.
|
||||||
8. **`dos2unix`** sur l'arborescence (au cas où tu as édité depuis Windows).
|
8. **`dos2unix`** sur l'arborescence (au cas où tu as édité depuis Windows).
|
||||||
9. **`mkarchiso -v -w /tmp/fws-build/work -o out/ /tmp/fws-build/releng`**.
|
9. **Firmwares jamais chargés** : `scripts/firmware-noextract.py` lit, dans le paquet `linux` qui sera installé, les firmwares que déclarent `iwlwifi` (Wi-Fi Intel) et `nouveau` (GSP NVIDIA), et ajoute au `pacman.conf` de build un `NoExtract` pour les versions plus anciennes que celle que le noyau chargera (~90 Mio). En cas d'échec, l'ISO garde simplement ces fichiers.
|
||||||
|
10. **`mkarchiso -v -w /tmp/fws-build/work -o out/ /tmp/fws-build/releng`**.
|
||||||
10. **Cleanup** du workdir.
|
10. **Cleanup** du workdir.
|
||||||
|
|
||||||
**Durée** : 5–15 minutes selon la machine et le cache pacman.
|
**Durée** : 5–15 minutes selon la machine et le cache pacman.
|
||||||
@@ -294,6 +294,8 @@ Le dépôt distant est partagé avec d'autres projets (fws-deskmanager, fws-kitt
|
|||||||
| `out/` | ISOs générées |
|
| `out/` | ISOs générées |
|
||||||
| `fws/mkarchiso` | Binaire `mkarchiso` embarqué (fork) |
|
| `fws/mkarchiso` | Binaire `mkarchiso` embarqué (fork) |
|
||||||
| `scripts/run_archiso.sh` | Lanceur QEMU |
|
| `scripts/run_archiso.sh` | Lanceur QEMU |
|
||||||
|
| `scripts/check-translations.py` | Contrôle des deux fichiers de traductions (lancé par `build.sh`) |
|
||||||
|
| `scripts/firmware-noextract.py` | Liste les versions de firmware que le noyau de l'ISO ne charge jamais (lancé par `build.sh`) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -326,15 +328,22 @@ Le dépôt distant est partagé avec d'autres projets (fws-deskmanager, fws-kitt
|
|||||||
- **Swap zram** (live + installé) : `configs/releng/airootfs/etc/systemd/zram-generator.conf` (paquet `zram-generator`)
|
- **Swap zram** (live + installé) : `configs/releng/airootfs/etc/systemd/zram-generator.conf` (paquet `zram-generator`)
|
||||||
- **Branding ISO** : `configs/releng/profiledef.sh` (`iso_name`, `iso_label`, `iso_publisher`) ; **visuel du menu BIOS** : `configs/releng/syslinux/splash.png` (PNG 8-bit) ; **nom/version affichés par l'installateur** : exports `ANACONDA_PRODUCTNAME`/`ANACONDA_PRODUCTVERSION` dans le `.xinitrc` (lus depuis l'os-release du live)
|
- **Branding ISO** : `configs/releng/profiledef.sh` (`iso_name`, `iso_label`, `iso_publisher`) ; **visuel du menu BIOS** : `configs/releng/syslinux/splash.png` (PNG 8-bit) ; **nom/version affichés par l'installateur** : exports `ANACONDA_PRODUCTNAME`/`ANACONDA_PRODUCTVERSION` dans le `.xinitrc` (lus depuis l'os-release du live)
|
||||||
|
|
||||||
### Traductions de l'installateur
|
### Traductions
|
||||||
|
|
||||||
Anaconda traduit ses propres écrans. Tout ce que FWS ajoute (écrans Connexion, Prise en charge du disque, Bureau, Récapitulatif, boutons Précédent/Suivant, messages de progression, fenêtres de fin d'installation) vient d'**un seul fichier** : `configs/baseline/airootfs/usr/local/share/fws/installer-translations.toml`.
|
Anaconda, les bureaux et leurs applications se traduisent eux-mêmes. Tout ce que FWS ajoute, plus les trous des catalogues d'Anaconda, vient de **trois fichiers** dans `configs/baseline/airootfs/usr/local/share/fws/` :
|
||||||
|
|
||||||
|
| Fichier | Contenu |
|
||||||
|
|---|---|
|
||||||
|
| `installer-translations.toml` | Écrans FWS de l'installateur (Connexion, Prise en charge du disque, Bureau, Récapitulatif, Précédent/Suivant), messages de progression, fenêtres de fin d'installation |
|
||||||
|
| `system-translations.toml` | Outils FWS du système installé (`fws-hello`, `fws-drivers`, `fws-setup-hardware`, `fws-update`, `fws-keys`…), écran de connexion SDDM, entrées de menu, demande de mot de passe polkit, libellés des barres i3/Hyprland |
|
||||||
|
| `anaconda-translations.toml` | Textes d'**Anaconda lui-même** absents de ses catalogues (écrans date, disque, utilisateur, root, dialogues) pour les langues qu'Anaconda couvre à 40 % ou plus. Ajoutés à `anaconda.mo` au build par `usr/local/lib/fws/merge-anaconda-translations.py`, sans jamais remplacer une traduction d'Anaconda |
|
||||||
|
|
||||||
- **Une table par texte, une ligne par langue**, avec les codes de langue d'Anaconda (`fr`, `de`, `pt_BR`, `"sr@latin"`…). `en` est obligatoire : c'est le texte affiché pour toute langue absente. Un code de territoire (`fr_CH`) l'emporte sur la langue (`fr`) pour ce territoire.
|
- **Une table par texte, une ligne par langue**, avec les codes de langue d'Anaconda (`fr`, `de`, `pt_BR`, `"sr@latin"`…). `en` est obligatoire : c'est le texte affiché pour toute langue absente. Un code de territoire (`fr_CH`) l'emporte sur la langue (`fr`) pour ce territoire.
|
||||||
- **Traduction dynamique** : le code demande `t("clé")` dans la langue choisie au premier écran, et chaque écran relit ses textes à chaque affichage. Revenir changer de langue retraduit donc tout le parcours.
|
- **La langue suit l'environnement**, dans l'ordre de gettext (`LANGUAGE`, `LC_ALL`, `LC_MESSAGES`, `LANG`), et `/etc/locale.conf` si aucune n'est définie (outils relancés par `sudo`). Dans l'installateur, c'est la langue du premier écran, et chaque écran relit ses textes à chaque affichage : revenir changer de langue retraduit tout le parcours. Sur le système installé, changer la langue du bureau change celle des outils FWS.
|
||||||
- **Côté code** : `t()` vient de `pyanaconda/ui/gui/spokes/fws_i18n.py` ; le `%post` passe des clés (`fws-install-step 32 fws:progress.desktop`) que l'écran de progression traduit ; les scripts shell appellent `fws-i18n <clé> [champ=valeur]`.
|
- **Côté code** : le module est `usr/local/lib/fws/fws_i18n.py` (hors du dossier d'Anaconda, qui suit la version de Python). Python : `catalog("system").t("clé", champ=valeur)` (`t()` seul pour l'installateur). Bash : `. /usr/local/lib/fws/i18n.sh <espaces de noms>` charge les textes en un appel, puis `$(t clé champ=valeur)`. Le `%post` passe des clés (`fws-install-step 32 fws:progress.desktop`) que l'écran de progression traduit ; `fws-i18n [--catalog system] <clé>` affiche un texte.
|
||||||
|
- **Fichiers qui ne savent pas lire le catalogue** : les entrées de menu (`X-FWS-Translation=<préfixe>`), le thème SDDM (`translations.js`) et la politique polkit (`<!-- fws-i18n: <préfixe> -->`) reçoivent toutes les langues au build (`usr/local/lib/fws/translate-static-files.py`, lancé par `customize_airootfs.sh`). Les configs waybar, polybar et i3 portent des marqueurs `{{t:clé}}` que le `%post` remplace dans la langue choisie à l'installation.
|
||||||
- **Avant le choix de la langue** (alerte mémoire, écran d'attente du `.xinitrc`), les textes sont en anglais.
|
- **Avant le choix de la langue** (alerte mémoire, écran d'attente du `.xinitrc`), les textes sont en anglais.
|
||||||
- **Contrôle** : `python3 scripts/check-installer-translations.py` vérifie le fichier (anglais présent, mêmes `{champs}` dans chaque langue, aucune clé utilisée par le code sans traduction) et affiche la couverture par langue. `build.sh` et `build-offi.sh` le lancent avant de construire.
|
- **Contrôle** : `python3 scripts/check-translations.py` vérifie les trois fichiers (anglais présent, mêmes `{champs}` dans chaque langue, aucune clé utilisée par le code sans traduction, aucun espace de noms partagé entre les deux) et affiche la couverture par langue. `build.sh` et `build-offi.sh` le lancent avant de construire.
|
||||||
|
|
||||||
> ⚠ **Règle d'or de la fusion** : au build, `configs/baseline/*` est copié **par-dessus** `configs/releng/*` — tout fichier homonyme de baseline **écrase** celui de releng. Ça concerne notamment `profiledef.sh`, `packages.x86_64`, `pacman.conf`, `efiboot/loader/entries/01-archiso-linux.conf` et `syslinux/syslinux.cfg` : **toute modification d'un de ces fichiers doit être reportée dans les deux profils** (des divergences ont déjà fait perdre silencieusement `firewalld` et le cap `udev.event_timeout` d'une ISO ; un `syslinux-linux.cfg` stock orphelin côté baseline définissait aussi un label `arch` sans le cap — supprimé, et le menu BIOS pointe désormais explicitement sur `DEFAULT fws`). Vérifier avec :
|
> ⚠ **Règle d'or de la fusion** : au build, `configs/baseline/*` est copié **par-dessus** `configs/releng/*` — tout fichier homonyme de baseline **écrase** celui de releng. Ça concerne notamment `profiledef.sh`, `packages.x86_64`, `pacman.conf`, `efiboot/loader/entries/01-archiso-linux.conf` et `syslinux/syslinux.cfg` : **toute modification d'un de ces fichiers doit être reportée dans les deux profils** (des divergences ont déjà fait perdre silencieusement `firewalld` et le cap `udev.event_timeout` d'une ISO ; un `syslinux-linux.cfg` stock orphelin côté baseline définissait aussi un label `arch` sans le cap — supprimé, et le menu BIOS pointe désormais explicitement sur `DEFAULT fws`). Vérifier avec :
|
||||||
> ```bash
|
> ```bash
|
||||||
|
|||||||
+89
-5
@@ -227,6 +227,60 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ── Conteneur sans CAP_SYS_ADMIN : builder via le Docker de l'hôte ──────────
|
||||||
|
# A Gitea runner runs jobs in an unprivileged container: mount() is denied and
|
||||||
|
# user namespaces are off, so mkarchiso cannot build in place. The host Docker
|
||||||
|
# socket is mounted though: re-run the build in a privileged archlinux
|
||||||
|
# container, streaming the tree in and the ISO out. A bind mount would not do:
|
||||||
|
# the runner workspace is not a path on the Docker host.
|
||||||
|
can_mount() {
|
||||||
|
local mp
|
||||||
|
mp="$(mktemp -d)" || return 1
|
||||||
|
if mount -t tmpfs tmpfs "$mp" 2>/dev/null; then
|
||||||
|
umount "$mp" 2>/dev/null
|
||||||
|
rmdir "$mp" 2>/dev/null
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
rmdir "$mp" 2>/dev/null
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$FWS_IN_CONTAINER" ] && ! can_mount; then
|
||||||
|
command -v docker >/dev/null 2>&1 \
|
||||||
|
|| { echo -e "\e[31mmount() refusé et docker absent : ce conteneur ne peut pas builder.\e[0m" >&2
|
||||||
|
echo " Installe docker (pacman -S docker) ou rends le runner privilégié." >&2
|
||||||
|
exit 1; }
|
||||||
|
[ -S /var/run/docker.sock ] \
|
||||||
|
|| { echo -e "\e[31mmount() refusé et /var/run/docker.sock absent : aucun moteur Docker joignable.\e[0m" >&2; exit 1; }
|
||||||
|
docker info >/dev/null 2>&1 \
|
||||||
|
|| { echo -e "\e[31mmount() refusé et démon Docker injoignable.\e[0m" >&2; exit 1; }
|
||||||
|
|
||||||
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
IMAGE="docker.io/library/archlinux:latest"
|
||||||
|
echo -e "\e[36mmount() refusé : build dans un conteneur Arch privilégié (docker)...\e[0m"
|
||||||
|
docker pull "$IMAGE" || exit 1
|
||||||
|
CID="$(docker create --privileged --network=host \
|
||||||
|
-e FWS_IN_CONTAINER=1 \
|
||||||
|
-e FWS_ISO_VERSION -e FWS_ISO_TAG \
|
||||||
|
-v fws-pacman-cache:/var/cache/pacman/pkg \
|
||||||
|
-w /tmp "$IMAGE" bash /tmp/build-offi.sh)" || exit 1
|
||||||
|
|
||||||
|
# docker cp from stdin needs an existing destination directory: /tmp is
|
||||||
|
# one, and it keeps the copied tree out of the container's root.
|
||||||
|
tar -C "$REPO_DIR" --exclude=./.git --exclude=./out -cf - . \
|
||||||
|
| docker cp - "$CID:/tmp" \
|
||||||
|
|| { docker rm -f "$CID" >/dev/null 2>&1; exit 1; }
|
||||||
|
if docker start -a "$CID"; then rc=0; else rc=$?; fi
|
||||||
|
if [ "$rc" -eq 0 ]; then
|
||||||
|
mkdir -p "$REPO_DIR/out"
|
||||||
|
docker cp "$CID:/tmp/out/." "$REPO_DIR/out/" || rc=$?
|
||||||
|
fi
|
||||||
|
docker rm -f "$CID" >/dev/null 2>&1 || true
|
||||||
|
OWNER="$(stat -c '%u:%g' "$REPO_DIR" 2>/dev/null || true)"
|
||||||
|
[ -z "$OWNER" ] || chown -R "$OWNER" "$REPO_DIR/out" 2>/dev/null || true
|
||||||
|
exit "$rc"
|
||||||
|
fi
|
||||||
|
|
||||||
if grep -qi 'microsoft\|wsl' /proc/version 2>/dev/null; then
|
if grep -qi 'microsoft\|wsl' /proc/version 2>/dev/null; then
|
||||||
echo -e "\e[36mBuild officiel dans WSL ($DISTRO_NAME) en tant que root...\e[0m"
|
echo -e "\e[36mBuild officiel dans WSL ($DISTRO_NAME) en tant que root...\e[0m"
|
||||||
IS_WSL=1
|
IS_WSL=1
|
||||||
@@ -243,9 +297,9 @@ echo "==> Dossier de travail : $WORK_DIR"
|
|||||||
# A broken translations file only shows once the ISO boots: check it now,
|
# A broken translations file only shows once the ISO boots: check it now,
|
||||||
# before anything long. A bare Arch container may lack python3: skip then.
|
# before anything long. A bare Arch container may lack python3: skip then.
|
||||||
if command -v python3 >/dev/null 2>&1; then
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
echo "==> Vérification des traductions de l'installateur..."
|
echo "==> Vérification des traductions FWS..."
|
||||||
python3 -I "$WORK_DIR/scripts/check-installer-translations.py" \
|
python3 -I "$WORK_DIR/scripts/check-translations.py" \
|
||||||
|| { echo -e "\e[31m[ERR] Traductions de l'installateur invalides (détail ci-dessus).\e[0m" >&2; exit 1; }
|
|| { echo -e "\e[31m[ERR] Traductions FWS invalides (détail ci-dessus).\e[0m" >&2; exit 1; }
|
||||||
else
|
else
|
||||||
echo "==> python3 absent : vérification des traductions sautée."
|
echo "==> python3 absent : vérification des traductions sautée."
|
||||||
fi
|
fi
|
||||||
@@ -309,9 +363,9 @@ reflector --verbose --latest 10 --sort rate --save /etc/pacman.d/mirrorlist || t
|
|||||||
if [ -n "$FWS_IN_CONTAINER" ]; then
|
if [ -n "$FWS_IN_CONTAINER" ]; then
|
||||||
# Image de base qui vieillit → upgrade complet AVANT d'ajouter archiso,
|
# Image de base qui vieillit → upgrade complet AVANT d'ajouter archiso,
|
||||||
# sinon partial upgrade (archiso tire des deps plus récentes que la base).
|
# sinon partial upgrade (archiso tire des deps plus récentes que la base).
|
||||||
pacman -Syu --noconfirm archiso
|
pacman -Syu --noconfirm archiso grub
|
||||||
else
|
else
|
||||||
pacman -Sy --noconfirm archiso
|
pacman -Sy --noconfirm archiso grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Préparation de l'environnement de build..."
|
echo "==> Préparation de l'environnement de build..."
|
||||||
@@ -385,6 +439,36 @@ if [ -n "$MISSING" ]; then
|
|||||||
fi
|
fi
|
||||||
echo "==> Pré-vol OK : ${#PROFILE_PKGS[@]} paquets résolus."
|
echo "==> Pré-vol OK : ${#PROFILE_PKGS[@]} paquets résolus."
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Firmware versions the ISO's kernel never loads
|
||||||
|
#
|
||||||
|
# iwlwifi (Intel Wi-Fi) and nouveau (NVIDIA GSP) ship several versions of
|
||||||
|
# the same firmware and load only one: the older ones stay out of the image
|
||||||
|
# (~90 MiB, scripts/firmware-noextract.py explains the rule). The packages
|
||||||
|
# land in the host cache, which mkarchiso's pacstrap reuses: nothing is
|
||||||
|
# downloaded twice. Any failure only costs the saving, never the build.
|
||||||
|
# ============================================================
|
||||||
|
echo "==> Firmwares que le noyau ne charge jamais..."
|
||||||
|
_FW_CONF=/tmp/fws-build/releng/pacman.conf
|
||||||
|
_FW_NAMES="linux linux-firmware-intel linux-firmware-nvidia"
|
||||||
|
_FW_CACHE="$(pacman-conf CacheDir 2>/dev/null | head -1)"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
if command -v python3 >/dev/null 2>&1 && [ -n "$_FW_CACHE" ] \
|
||||||
|
&& pacman -Sw --noconfirm $_FW_NAMES >/dev/null \
|
||||||
|
&& _FW_FILES="$(pacman -Sp --print-format '%f' $_FW_NAMES)" \
|
||||||
|
&& (cd "$_FW_CACHE" && python3 -I "$WORK_DIR/scripts/firmware-noextract.py" $_FW_FILES) > "$_FW_CONF.noextract" \
|
||||||
|
&& [ -s "$_FW_CONF.noextract" ]; then
|
||||||
|
# Right after the first NoExtract line, so inside [options].
|
||||||
|
awk -v list="$_FW_CONF.noextract" \
|
||||||
|
'{ print } /^NoExtract/ && !done { while ((getline l < list) > 0) print l; done = 1 }' \
|
||||||
|
"$_FW_CONF" > "$_FW_CONF.new" && mv -f "$_FW_CONF.new" "$_FW_CONF"
|
||||||
|
echo " $(grep -o 'usr/' "$_FW_CONF.noextract" | wc -l) fichiers de firmware exclus de l'image"
|
||||||
|
rm -f "$_FW_CONF.noextract"
|
||||||
|
else
|
||||||
|
rm -f "$_FW_CONF.noextract"
|
||||||
|
echo -e "\e[33m[!] Calcul des firmwares inutiles impossible : l'ISO les garde (≈ 90 Mio de plus).\e[0m" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Lancement de mkarchiso..."
|
echo "==> Lancement de mkarchiso..."
|
||||||
mkdir -p "$OUT_DIR"
|
mkdir -p "$OUT_DIR"
|
||||||
# mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si
|
# mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si
|
||||||
|
|||||||
@@ -202,9 +202,9 @@ echo "==> Dossier de travail : $WORK_DIR"
|
|||||||
# A broken translations file only shows once the ISO boots: check it now,
|
# A broken translations file only shows once the ISO boots: check it now,
|
||||||
# before anything long. A bare Arch container may lack python3: skip then.
|
# before anything long. A bare Arch container may lack python3: skip then.
|
||||||
if command -v python3 >/dev/null 2>&1; then
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
echo "==> Vérification des traductions de l'installateur..."
|
echo "==> Vérification des traductions FWS..."
|
||||||
python3 -I "$WORK_DIR/scripts/check-installer-translations.py" \
|
python3 -I "$WORK_DIR/scripts/check-translations.py" \
|
||||||
|| { echo -e "\e[31m[ERR] Traductions de l'installateur invalides (détail ci-dessus).\e[0m" >&2; exit 1; }
|
|| { echo -e "\e[31m[ERR] Traductions FWS invalides (détail ci-dessus).\e[0m" >&2; exit 1; }
|
||||||
else
|
else
|
||||||
echo "==> python3 absent : vérification des traductions sautée."
|
echo "==> python3 absent : vérification des traductions sautée."
|
||||||
fi
|
fi
|
||||||
@@ -464,6 +464,36 @@ while IFS= read -r -d '' _f; do
|
|||||||
echo " lien restauré : ${_f#"$_AIROOTFS"} -> $_target"
|
echo " lien restauré : ${_f#"$_AIROOTFS"} -> $_target"
|
||||||
done < <(find "$_AIROOTFS" -type f -print0)
|
done < <(find "$_AIROOTFS" -type f -print0)
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Firmware versions the ISO's kernel never loads
|
||||||
|
#
|
||||||
|
# iwlwifi (Intel Wi-Fi) and nouveau (NVIDIA GSP) ship several versions of
|
||||||
|
# the same firmware and load only one: the older ones stay out of the image
|
||||||
|
# (~90 MiB, scripts/firmware-noextract.py explains the rule). The packages
|
||||||
|
# land in the host cache, which mkarchiso's pacstrap reuses: nothing is
|
||||||
|
# downloaded twice. Any failure only costs the saving, never the build.
|
||||||
|
# ============================================================
|
||||||
|
echo "==> Firmwares que le noyau ne charge jamais..."
|
||||||
|
_FW_CONF=/tmp/fws-build/releng/pacman.conf
|
||||||
|
_FW_NAMES="linux linux-firmware-intel linux-firmware-nvidia"
|
||||||
|
_FW_CACHE="$(pacman-conf CacheDir 2>/dev/null | head -1)"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
if command -v python3 >/dev/null 2>&1 && [ -n "$_FW_CACHE" ] \
|
||||||
|
&& pacman -Sw --noconfirm $_FW_NAMES >/dev/null \
|
||||||
|
&& _FW_FILES="$(pacman -Sp --print-format '%f' $_FW_NAMES)" \
|
||||||
|
&& (cd "$_FW_CACHE" && python3 -I "$WORK_DIR/scripts/firmware-noextract.py" $_FW_FILES) > "$_FW_CONF.noextract" \
|
||||||
|
&& [ -s "$_FW_CONF.noextract" ]; then
|
||||||
|
# Right after the first NoExtract line, so inside [options].
|
||||||
|
awk -v list="$_FW_CONF.noextract" \
|
||||||
|
'{ print } /^NoExtract/ && !done { while ((getline l < list) > 0) print l; done = 1 }' \
|
||||||
|
"$_FW_CONF" > "$_FW_CONF.new" && mv -f "$_FW_CONF.new" "$_FW_CONF"
|
||||||
|
echo " $(grep -o 'usr/' "$_FW_CONF.noextract" | wc -l) fichiers de firmware exclus de l'image"
|
||||||
|
rm -f "$_FW_CONF.noextract"
|
||||||
|
else
|
||||||
|
rm -f "$_FW_CONF.noextract"
|
||||||
|
echo -e "\e[33m[!] Calcul des firmwares inutiles impossible : l'ISO les garde (≈ 90 Mio de plus).\e[0m" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Lancement de mkarchiso..."
|
echo "==> Lancement de mkarchiso..."
|
||||||
mkdir -p "$WORK_DIR/out"
|
mkdir -p "$WORK_DIR/out"
|
||||||
# mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si
|
# mkarchiso fait un « rm » interne de l'ISO cible avant de la (ré)écrire ; si
|
||||||
|
|||||||
@@ -47,3 +47,16 @@ if [ -d /usr/local/share/fws/anaconda-overlay/pyanaconda ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- Anaconda's own texts missing from its catalogs ---------------------------
|
||||||
|
# Some languages get parts of Anaconda's screens in English (Bulgarian lacked
|
||||||
|
# most of the root account screen): anaconda-translations.toml fills those
|
||||||
|
# gaps, never overriding a translation Anaconda has. After the anaconda
|
||||||
|
# package is installed, which is now.
|
||||||
|
python3 /usr/local/lib/fws/merge-anaconda-translations.py
|
||||||
|
|
||||||
|
# --- FWS translations written into files that cannot look them up -------------
|
||||||
|
# Menu entries, the SDDM theme and the polkit policy are read by programs that
|
||||||
|
# know nothing of system-translations.toml: every language is written into them
|
||||||
|
# here. A failure stops the build, since the login screen would show keys.
|
||||||
|
python3 /usr/local/lib/fws/translate-static-files.py
|
||||||
+12
-110
@@ -1,118 +1,20 @@
|
|||||||
# FWS — translations of the FWS parts of the installer.
|
# FWS — the installer screens' access to the FWS translations.
|
||||||
#
|
#
|
||||||
# Anaconda translates its own screens through gettext; the FWS screens are not
|
# The implementation lives in /usr/local/lib/fws/fws_i18n.py, shared with the
|
||||||
# in its catalogs. Their texts live in ONE TOML file (one table per message,
|
# FWS tools of the installed system, which must not depend on this folder: its
|
||||||
# one entry per language) and are looked up with t("key").
|
# path follows Python's version and Anaconda can be removed after installing.
|
||||||
#
|
|
||||||
# t() reads $LANG on every call: Anaconda stores the language picked on the
|
|
||||||
# first screen there (and clears LANGUAGE/LC_ALL/LC_MESSAGES). A screen that
|
|
||||||
# sets its texts each time it is shown therefore follows a language change made
|
|
||||||
# by going back to the first screen.
|
|
||||||
#
|
#
|
||||||
# Not a spoke: Anaconda imports every module of this folder while collecting
|
# Not a spoke: Anaconda imports every module of this folder while collecting
|
||||||
# spokes, and an empty __all__ keeps this one out of the collection.
|
# spokes, and an empty __all__ keeps this one out of the collection.
|
||||||
|
|
||||||
import os
|
import importlib.util
|
||||||
import tomllib
|
|
||||||
|
|
||||||
try:
|
_spec = importlib.util.spec_from_file_location("fws_i18n", "/usr/local/lib/fws/fws_i18n.py")
|
||||||
from pyanaconda.anaconda_loggers import get_module_logger
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
log = get_module_logger(__name__)
|
_spec.loader.exec_module(_module)
|
||||||
except ImportError:
|
|
||||||
# Loaded by path from /usr/local/bin/fws-i18n, outside Anaconda.
|
t = _module.t
|
||||||
import logging
|
catalog = _module.catalog
|
||||||
log = logging.getLogger(__name__)
|
language_candidates = _module.language_candidates
|
||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
TRANSLATIONS_FILE = "/usr/local/share/fws/installer-translations.toml"
|
|
||||||
FALLBACK_LANGUAGE = "en"
|
|
||||||
|
|
||||||
_cache = {"mtime": None, "messages": {}}
|
|
||||||
_reported = set()
|
|
||||||
|
|
||||||
|
|
||||||
def _flatten(table, prefix=""):
|
|
||||||
"""Yield (key, {language: text}) for every message of the TOML tree."""
|
|
||||||
texts = {name: value for name, value in table.items() if isinstance(value, str)}
|
|
||||||
if texts and prefix:
|
|
||||||
yield prefix, texts
|
|
||||||
for name, value in table.items():
|
|
||||||
if isinstance(value, dict):
|
|
||||||
yield from _flatten(value, f"{prefix}.{name}" if prefix else name)
|
|
||||||
|
|
||||||
|
|
||||||
def _messages():
|
|
||||||
try:
|
|
||||||
mtime = os.stat(TRANSLATIONS_FILE).st_mtime
|
|
||||||
except OSError:
|
|
||||||
return {}
|
|
||||||
if _cache["mtime"] != mtime:
|
|
||||||
try:
|
|
||||||
with open(TRANSLATIONS_FILE, "rb") as fh:
|
|
||||||
_cache["messages"] = dict(_flatten(tomllib.load(fh)))
|
|
||||||
except (OSError, tomllib.TOMLDecodeError) as exc:
|
|
||||||
# A broken file must not take the installer down: keys are shown
|
|
||||||
# instead of texts, which is visible but harmless.
|
|
||||||
log.error("FWS: unreadable translations file %s: %s", TRANSLATIONS_FILE, exc)
|
|
||||||
_cache["messages"] = {}
|
|
||||||
_cache["mtime"] = mtime
|
|
||||||
return _cache["messages"]
|
|
||||||
|
|
||||||
|
|
||||||
def language_candidates(locale_name=None):
|
|
||||||
"""Languages to try, most specific first, always ending with the fallback.
|
|
||||||
|
|
||||||
"sr_RS.UTF-8@latin" -> sr_RS@latin, sr@latin, sr_RS, sr, en
|
|
||||||
"fr_CH.UTF-8" -> fr_CH, fr, en
|
|
||||||
"""
|
|
||||||
if locale_name is None:
|
|
||||||
locale_name = os.environ.get("LANG", "")
|
|
||||||
base, _, modifier = locale_name.partition("@")
|
|
||||||
base = base.split(".", 1)[0]
|
|
||||||
language, _, territory = base.partition("_")
|
|
||||||
suffix = f"@{modifier}" if modifier else ""
|
|
||||||
candidates = []
|
|
||||||
if territory:
|
|
||||||
candidates.append(f"{language}_{territory}{suffix}")
|
|
||||||
candidates.append(f"{language}{suffix}")
|
|
||||||
if suffix:
|
|
||||||
if territory:
|
|
||||||
candidates.append(f"{language}_{territory}")
|
|
||||||
candidates.append(language)
|
|
||||||
candidates.append(FALLBACK_LANGUAGE)
|
|
||||||
return [c for c in dict.fromkeys(candidates) if c]
|
|
||||||
|
|
||||||
|
|
||||||
def t(key, **fields):
|
|
||||||
"""Text of `key` in the installer's current language.
|
|
||||||
|
|
||||||
Named `fields` fill the {placeholders} of the text. An unknown key is
|
|
||||||
returned as is, so a missing translation shows up on screen instead of
|
|
||||||
crashing the installer.
|
|
||||||
"""
|
|
||||||
texts = _messages().get(key)
|
|
||||||
text = None
|
|
||||||
if texts:
|
|
||||||
for language in language_candidates():
|
|
||||||
text = texts.get(language)
|
|
||||||
if text:
|
|
||||||
break
|
|
||||||
if not text:
|
|
||||||
if key not in _reported:
|
|
||||||
_reported.add(key)
|
|
||||||
log.warning("FWS: no translation for key %s", key)
|
|
||||||
return key
|
|
||||||
if not fields:
|
|
||||||
return text
|
|
||||||
try:
|
|
||||||
return text.format(**fields)
|
|
||||||
except (KeyError, IndexError, ValueError) as exc:
|
|
||||||
# A translation with a wrong placeholder: fall back to the reference
|
|
||||||
# text rather than showing nothing.
|
|
||||||
log.warning("FWS: bad placeholders in %s: %s", key, exc)
|
|
||||||
reference = texts.get(FALLBACK_LANGUAGE, key)
|
|
||||||
try:
|
|
||||||
return reference.format(**fields)
|
|
||||||
except (KeyError, IndexError, ValueError):
|
|
||||||
return reference
|
|
||||||
+43
-5
@@ -117,6 +117,14 @@ def _apply_live_keyboard():
|
|||||||
# faisait → XLayouts vide, et /root/anaconda-ks.cfg sans « --xlayouts= »
|
# faisait → XLayouts vide, et /root/anaconda-ks.cfg sans « --xlayouts= »
|
||||||
# pour le %post du kickstart.
|
# pour le %post du kickstart.
|
||||||
try:
|
try:
|
||||||
|
# SetXKeyboardDefaults() keeps layouts already set, as if they came
|
||||||
|
# from a kickstart: coming back to pick another language would keep
|
||||||
|
# the first language's keyboard. With the keyboard screen hidden, the
|
||||||
|
# layouts only ever come from the language, so they are recomputed.
|
||||||
|
if not proxy.KeyboardKickstarted:
|
||||||
|
proxy.XLayouts = []
|
||||||
|
proxy.LayoutSwitchOptions = []
|
||||||
|
proxy.VirtualConsoleKeymap = ""
|
||||||
proxy.SetXKeyboardDefaults()
|
proxy.SetXKeyboardDefaults()
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
log.debug("FWS: SetXKeyboardDefaults indisponible", exc_info=True)
|
log.debug("FWS: SetXKeyboardDefaults indisponible", exc_info=True)
|
||||||
@@ -192,12 +200,20 @@ def _hook_welcome_spoke():
|
|||||||
|
|
||||||
|
|
||||||
def _hook_user_spoke():
|
def _hook_user_spoke():
|
||||||
"""Translates the host name field that the FWS anaconda package adds.
|
"""User screen: a user account is required, and the host name field that
|
||||||
|
the FWS anaconda package adds is translated.
|
||||||
|
|
||||||
That field comes from a patch of user.glade in the anaconda package, so its
|
Upstream Anaconda lets the screen be left empty ("No user will be
|
||||||
texts are in none of Anaconda's catalogs: they come from ours, set on each
|
created"): FWS would then install a system whose login screen nobody can
|
||||||
display like the FWS screens.
|
get past, since root is meant for repairs only. "Next" is refused until a
|
||||||
|
user name is typed (the password rules stay Anaconda's), and the screen is
|
||||||
|
mandatory so the summary cannot start the installation without it.
|
||||||
|
|
||||||
|
The host name field comes from a patch of user.glade in the anaconda
|
||||||
|
package, so its texts are in none of Anaconda's catalogs: they come from
|
||||||
|
ours, set on each display like the FWS screens.
|
||||||
"""
|
"""
|
||||||
|
from pyanaconda.core.i18n import _
|
||||||
from pyanaconda.ui.gui.spokes import user as user_module
|
from pyanaconda.ui.gui.spokes import user as user_module
|
||||||
|
|
||||||
spoke_class = user_module.UserSpoke
|
spoke_class = user_module.UserSpoke
|
||||||
@@ -216,7 +232,29 @@ def _hook_user_spoke():
|
|||||||
entry.get_accessible().set_name(t("user.hostname_accessible"))
|
entry.get_accessible().set_name(t("user.hostname_accessible"))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
original_back = spoke_class.on_back_clicked
|
||||||
|
|
||||||
|
def on_back_clicked(self, button):
|
||||||
|
if not self.username.strip():
|
||||||
|
# Anaconda's own message: already translated in all its languages.
|
||||||
|
self.show_warning_message(_("User name not set!"))
|
||||||
|
return
|
||||||
|
original_back(self, button)
|
||||||
|
|
||||||
|
# Second lock, looked up on every check run rather than bound when the
|
||||||
|
# screen is built: Anaconda's own exit rule lets an all-empty screen go.
|
||||||
|
original_exit_conditions = spoke_class._check_spoke_exit_conditions
|
||||||
|
|
||||||
|
def _check_spoke_exit_conditions(self, unwaivable_check_failed):
|
||||||
|
original_exit_conditions(self, unwaivable_check_failed)
|
||||||
|
if not self.username.strip():
|
||||||
|
self.can_go_back = False
|
||||||
|
self.needs_waiver = False
|
||||||
|
|
||||||
spoke_class.refresh = refresh
|
spoke_class.refresh = refresh
|
||||||
|
spoke_class.on_back_clicked = on_back_clicked
|
||||||
|
spoke_class._check_spoke_exit_conditions = _check_spoke_exit_conditions
|
||||||
|
spoke_class.mandatory = property(lambda self: True)
|
||||||
spoke_class._fws_i18n_hooked = True
|
spoke_class._fws_i18n_hooked = True
|
||||||
|
|
||||||
|
|
||||||
@@ -704,7 +742,7 @@ except Exception: # pylint: disable=broad-except
|
|||||||
try:
|
try:
|
||||||
_hook_user_spoke()
|
_hook_user_spoke()
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
log.exception("FWS: champ « nom de machine » laissé non traduit.")
|
log.exception("FWS: écran utilisateur laissé tel quel (compte facultatif, nom de machine non traduit).")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_patch_main_window()
|
_patch_main_window()
|
||||||
|
|||||||
@@ -1,40 +1,91 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Print an FWS installer text in the language of $LANG.
|
"""Print FWS texts in the language of the environment.
|
||||||
|
|
||||||
Usage: fws-i18n <key> [name=value ...]
|
Usage:
|
||||||
|
fws-i18n [--catalog NAME] <key> [name=value ...]
|
||||||
|
fws-i18n --catalog NAME --shell <namespace>...
|
||||||
|
fws-i18n --catalog NAME --render <file>
|
||||||
|
|
||||||
Shell side of the installer translations: the live session (/root/.xinitrc)
|
The first form prints one text: the live session (/root/.xinitrc) uses it for
|
||||||
shows dialogs after the installer has closed, in the language picked on its
|
the dialogs shown after the installer has closed. The catalog defaults to
|
||||||
first screen. Same file and same lookup as the installer screens, so a key is
|
"installer"; "system" holds the texts of the FWS tools.
|
||||||
translated once for both.
|
|
||||||
|
--shell prints Bash assignments of every text of the given namespaces into the
|
||||||
|
associative array FWS_T, placeholders left in: /usr/local/lib/fws/i18n.sh loads
|
||||||
|
them once per script instead of starting Python for every message.
|
||||||
|
|
||||||
|
--render prints <file> with each {{t:key}} replaced by its text. The installer
|
||||||
|
uses it on the desktop configuration files it copies into the home folders.
|
||||||
|
Texts are escaped for JSON in a .json file; elsewhere their straight quotes are
|
||||||
|
made typographic, since these files embed them in quoted shell arguments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import glob
|
import json
|
||||||
import importlib.util
|
import re
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
|
||||||
def main():
|
MARKER = re.compile(r"\{\{t:([a-z0-9_]+(?:\.[a-z0-9_]+)+)\}\}")
|
||||||
if len(sys.argv) < 2:
|
TYPOGRAPHIC_QUOTES = str.maketrans({"'": "’", '"': "”"})
|
||||||
|
|
||||||
|
|
||||||
|
def shell_assignments(catalog, namespaces):
|
||||||
|
lines = ["declare -gA FWS_T"]
|
||||||
|
for key in sorted(catalog.messages()):
|
||||||
|
if key.split(".", 1)[0] in namespaces:
|
||||||
|
text = catalog.text(key)
|
||||||
|
if text is not None:
|
||||||
|
lines.append(f"FWS_T[{key}]={shlex.quote(text)}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def render(catalog, path):
|
||||||
|
with open(path, encoding="utf-8") as fh:
|
||||||
|
content = fh.read()
|
||||||
|
as_json = path.endswith(".json")
|
||||||
|
|
||||||
|
def replace(match):
|
||||||
|
text = catalog.t(match.group(1))
|
||||||
|
if as_json:
|
||||||
|
return json.dumps(text, ensure_ascii=False)[1:-1]
|
||||||
|
return text.translate(TYPOGRAPHIC_QUOTES)
|
||||||
|
|
||||||
|
return MARKER.sub(replace, content)
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
name = "installer"
|
||||||
|
if len(argv) >= 2 and argv[0] == "--catalog":
|
||||||
|
name, argv = argv[1], argv[2:]
|
||||||
|
if not argv:
|
||||||
print(__doc__.strip().splitlines()[2], file=sys.stderr)
|
print(__doc__.strip().splitlines()[2], file=sys.stderr)
|
||||||
return 2
|
return 2
|
||||||
key = sys.argv[1]
|
try:
|
||||||
fields = dict(arg.split("=", 1) for arg in sys.argv[2:] if "=" in arg)
|
import fws_i18n
|
||||||
text = key
|
catalog = fws_i18n.catalog(name)
|
||||||
# The module sits in Anaconda's folder, whose path follows Python's version.
|
except Exception as exc: # pylint: disable=broad-except
|
||||||
for path in glob.glob("/usr/lib/python3*/site-packages/pyanaconda/ui/gui/spokes/fws_i18n.py"):
|
print(f"fws-i18n: {exc}", file=sys.stderr)
|
||||||
try:
|
catalog = None
|
||||||
spec = importlib.util.spec_from_file_location("fws_i18n", path)
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
if argv[0] == "--shell":
|
||||||
spec.loader.exec_module(module)
|
# An empty array still lets the scripts run: they show keys then.
|
||||||
text = module.t(key, **fields)
|
print(shell_assignments(catalog, set(argv[1:])) if catalog
|
||||||
except Exception: # pylint: disable=broad-except
|
else "declare -gA FWS_T")
|
||||||
# A dialog with the key in it beats no dialog at all.
|
return 0
|
||||||
pass
|
if argv[0] == "--render":
|
||||||
break
|
if len(argv) != 2 or catalog is None:
|
||||||
print(text)
|
return 2
|
||||||
|
sys.stdout.write(render(catalog, argv[1]))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
key = argv[0]
|
||||||
|
fields = dict(arg.split("=", 1) for arg in argv[1:] if "=" in arg)
|
||||||
|
# A dialog with the key in it beats no dialog at all.
|
||||||
|
print(catalog.t(key, **fields) if catalog else key)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main(sys.argv[1:]))
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
# FWS — translations of the FWS installer screens and of the FWS tools.
|
||||||
|
#
|
||||||
|
# Anaconda, the desktops and their applications translate themselves through
|
||||||
|
# gettext; the FWS parts are in none of their catalogs. Their texts live in TOML
|
||||||
|
# catalogs (one table per message, one entry per language) and are looked up by
|
||||||
|
# key:
|
||||||
|
#
|
||||||
|
# installer-translations.toml the FWS installer screens and live dialogs
|
||||||
|
# system-translations.toml the FWS tools of the installed system
|
||||||
|
#
|
||||||
|
# The language is read from the environment on every call, in gettext's order
|
||||||
|
# ($LANGUAGE, $LC_ALL, $LC_MESSAGES, $LANG). Anaconda keeps only $LANG, set to
|
||||||
|
# the language picked on its first screen, so a screen that sets its texts each
|
||||||
|
# time it is shown follows a language change made by going back to that screen;
|
||||||
|
# on the installed system the tools follow the desktop's language setting.
|
||||||
|
#
|
||||||
|
# This file sits outside Python's versioned site-packages so that the tools
|
||||||
|
# keep working when Python is upgraded or Anaconda removed.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
try:
|
||||||
|
from pyanaconda.anaconda_loggers import get_module_logger
|
||||||
|
log = get_module_logger(__name__)
|
||||||
|
except ImportError:
|
||||||
|
import logging
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
TRANSLATIONS_DIR = "/usr/local/share/fws"
|
||||||
|
FALLBACK_LANGUAGE = "en"
|
||||||
|
|
||||||
|
|
||||||
|
def _flatten(table, prefix=""):
|
||||||
|
"""Yield (key, {language: text}) for every message of the TOML tree."""
|
||||||
|
texts = {name: value for name, value in table.items() if isinstance(value, str)}
|
||||||
|
if texts and prefix:
|
||||||
|
yield prefix, texts
|
||||||
|
for name, value in table.items():
|
||||||
|
if isinstance(value, dict):
|
||||||
|
yield from _flatten(value, f"{prefix}.{name}" if prefix else name)
|
||||||
|
|
||||||
|
|
||||||
|
def language_candidates(locale_name=None):
|
||||||
|
"""Languages to try, most specific first, always ending with the fallback.
|
||||||
|
|
||||||
|
"sr_RS.UTF-8@latin" -> sr_RS@latin, sr@latin, sr_RS, sr, en
|
||||||
|
"fr_CH.UTF-8" -> fr_CH, fr, en
|
||||||
|
Without an argument, every locale of the environment is expanded in turn.
|
||||||
|
"""
|
||||||
|
names = _environment_locales() if locale_name is None else [locale_name]
|
||||||
|
candidates = []
|
||||||
|
for name in names:
|
||||||
|
base, _, modifier = name.partition("@")
|
||||||
|
base = base.split(".", 1)[0]
|
||||||
|
language, _, territory = base.partition("_")
|
||||||
|
if not language:
|
||||||
|
continue
|
||||||
|
suffix = f"@{modifier}" if modifier else ""
|
||||||
|
if territory:
|
||||||
|
candidates.append(f"{language}_{territory}{suffix}")
|
||||||
|
candidates.append(f"{language}{suffix}")
|
||||||
|
if suffix:
|
||||||
|
if territory:
|
||||||
|
candidates.append(f"{language}_{territory}")
|
||||||
|
candidates.append(language)
|
||||||
|
candidates.append(FALLBACK_LANGUAGE)
|
||||||
|
return list(dict.fromkeys(candidates))
|
||||||
|
|
||||||
|
|
||||||
|
def _environment_locales():
|
||||||
|
"""Message locales of the environment, in gettext's order.
|
||||||
|
|
||||||
|
$LANGUAGE is a priority list (de_CH:de:en) that gettext ignores when the
|
||||||
|
locale itself is C, so it is ignored here too.
|
||||||
|
"""
|
||||||
|
env = os.environ
|
||||||
|
locale_name = env.get("LC_ALL") or env.get("LC_MESSAGES") or env.get("LANG")
|
||||||
|
if not locale_name:
|
||||||
|
# sudo can drop the locale variables: a tool run as root then speaks
|
||||||
|
# the system's language, as systemd services do.
|
||||||
|
locale_name = _system_locale()
|
||||||
|
if locale_name.split(".", 1)[0] in ("", "C", "POSIX"):
|
||||||
|
return []
|
||||||
|
return [name for name in env.get("LANGUAGE", "").split(":") if name] + [locale_name]
|
||||||
|
|
||||||
|
|
||||||
|
def _system_locale():
|
||||||
|
try:
|
||||||
|
with open("/etc/locale.conf", encoding="utf-8") as fh:
|
||||||
|
for line in fh:
|
||||||
|
name, _, value = line.strip().partition("=")
|
||||||
|
if name == "LANG":
|
||||||
|
return value.strip().strip("\"'")
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class Catalog:
|
||||||
|
"""One translations file, reloaded when it changes on disk."""
|
||||||
|
|
||||||
|
def __init__(self, name):
|
||||||
|
self.path = os.path.join(TRANSLATIONS_DIR, f"{name}-translations.toml")
|
||||||
|
self._mtime = None
|
||||||
|
self._messages = {}
|
||||||
|
self._reported = set()
|
||||||
|
|
||||||
|
def messages(self):
|
||||||
|
"""{key: {language: text}}; empty when the file is missing or broken."""
|
||||||
|
try:
|
||||||
|
mtime = os.stat(self.path).st_mtime
|
||||||
|
except OSError:
|
||||||
|
return {}
|
||||||
|
if self._mtime != mtime:
|
||||||
|
try:
|
||||||
|
with open(self.path, "rb") as fh:
|
||||||
|
self._messages = dict(_flatten(tomllib.load(fh)))
|
||||||
|
except (OSError, tomllib.TOMLDecodeError) as exc:
|
||||||
|
# A broken file must not take the program down: keys are shown
|
||||||
|
# instead of texts, which is visible but harmless.
|
||||||
|
log.error("FWS: unreadable translations file %s: %s", self.path, exc)
|
||||||
|
self._messages = {}
|
||||||
|
self._mtime = mtime
|
||||||
|
return self._messages
|
||||||
|
|
||||||
|
def text(self, key, languages=None):
|
||||||
|
"""Raw text of `key` (placeholders left in), or None."""
|
||||||
|
texts = self.messages().get(key)
|
||||||
|
if texts:
|
||||||
|
for language in languages or language_candidates():
|
||||||
|
if texts.get(language):
|
||||||
|
return texts[language]
|
||||||
|
return None
|
||||||
|
|
||||||
|
def t(self, key, **fields):
|
||||||
|
"""Text of `key` in the current language.
|
||||||
|
|
||||||
|
Named `fields` fill the {placeholders} of the text; fields the text
|
||||||
|
does not use are ignored. An unknown key is returned as is, so a
|
||||||
|
missing translation shows up on screen instead of crashing.
|
||||||
|
"""
|
||||||
|
text = self.text(key)
|
||||||
|
if text is None:
|
||||||
|
if key not in self._reported:
|
||||||
|
self._reported.add(key)
|
||||||
|
log.warning("FWS: no translation for key %s", key)
|
||||||
|
return key
|
||||||
|
if not fields:
|
||||||
|
return text
|
||||||
|
try:
|
||||||
|
return text.format(**fields)
|
||||||
|
except (KeyError, IndexError, ValueError) as exc:
|
||||||
|
# A translation with a wrong placeholder: fall back to the reference
|
||||||
|
# text rather than showing nothing.
|
||||||
|
log.warning("FWS: bad placeholders in %s: %s", key, exc)
|
||||||
|
reference = self.text(key, [FALLBACK_LANGUAGE]) or key
|
||||||
|
try:
|
||||||
|
return reference.format(**fields)
|
||||||
|
except (KeyError, IndexError, ValueError):
|
||||||
|
return reference
|
||||||
|
|
||||||
|
|
||||||
|
_catalogs = {}
|
||||||
|
|
||||||
|
|
||||||
|
def catalog(name):
|
||||||
|
"""The catalog `name` ("installer" or "system"), loaded once per process."""
|
||||||
|
if name not in _catalogs:
|
||||||
|
_catalogs[name] = Catalog(name)
|
||||||
|
return _catalogs[name]
|
||||||
|
|
||||||
|
|
||||||
|
def t(key, **fields):
|
||||||
|
"""Text of an installer message (see Catalog.t)."""
|
||||||
|
return catalog("installer").t(key, **fields)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# FWS — translations for the FWS shell tools (Bash, sourced).
|
||||||
|
#
|
||||||
|
# . /usr/local/lib/fws/i18n.sh <namespace>...
|
||||||
|
# say "$(t <key> [name=value]...)"
|
||||||
|
#
|
||||||
|
# Loads every text of the given namespaces of system-translations.toml with a
|
||||||
|
# single fws-i18n call, in the language of the environment; t then fills the
|
||||||
|
# {placeholders} in Bash. A missing text prints its key, like the Python tools.
|
||||||
|
# Literal braces ({{ }}) are not supported in texts used from shell.
|
||||||
|
|
||||||
|
declare -gA FWS_T=()
|
||||||
|
eval "$(/usr/local/bin/fws-i18n --catalog system --shell "$@" 2>/dev/null)" || true
|
||||||
|
|
||||||
|
t() {
|
||||||
|
local text="${FWS_T[$1]-$1}" pair
|
||||||
|
shift
|
||||||
|
for pair in "$@"; do
|
||||||
|
text="${text//"{${pair%%=*}}"/"${pair#*=}"}"
|
||||||
|
done
|
||||||
|
printf '%s' "$text"
|
||||||
|
}
|
||||||
|
|
||||||
|
# The answers a yes/no prompt accepts: the translated word, its first letter,
|
||||||
|
# the same without accents ("si" for "sí": not every keyboard has them), and
|
||||||
|
# the English ones that every keyboard can type.
|
||||||
|
t_is_yes() {
|
||||||
|
local answer="${1,,}" yes plain
|
||||||
|
yes="$(t common.yes)"
|
||||||
|
yes="${yes,,}"
|
||||||
|
[ -n "$answer" ] || return 1
|
||||||
|
# C.UTF-8 is built into glibc, so transliteration works even when the
|
||||||
|
# session's locale is not generated; anything else than plain letters
|
||||||
|
# (a non-Latin word comes out as "?" marks) keeps the word as written.
|
||||||
|
plain="$(printf '%s' "$yes" | LC_ALL=C.UTF-8 iconv -f UTF-8 -t ASCII//TRANSLIT 2>/dev/null)"
|
||||||
|
[[ "$plain" =~ ^[a-z]+$ ]] || plain="$yes"
|
||||||
|
case "$answer" in
|
||||||
|
y | yes | "$yes" | "${yes:0:1}" | "$plain" | "${plain:0:1}") return 0 ;;
|
||||||
|
esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Add the FWS translations of Anaconda's own texts to Anaconda's catalogs.
|
||||||
|
|
||||||
|
Run at build time by customize_airootfs.sh (usage: merge-anaconda-translations.py
|
||||||
|
[--root DIR]). Anaconda's catalogs leave some of its screens partly in English
|
||||||
|
in several languages (Bulgarian lacks most of the root account screen, for
|
||||||
|
instance). anaconda-translations.toml holds translations for the texts of the
|
||||||
|
screens FWS shows; each one is added to /usr/share/locale/<lang>/LC_MESSAGES/
|
||||||
|
anaconda.mo only when Anaconda has none, or only a copy of the English text
|
||||||
|
(Italian has "_Root Account" as is): its own translations always win. One
|
||||||
|
catalog serves both the Python code and GtkBuilder, so the .mo is rewritten
|
||||||
|
rather than a second domain added.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
SUPPLEMENT = "usr/local/share/fws/anaconda-translations.toml"
|
||||||
|
CATALOG = "usr/share/locale/{language}/LC_MESSAGES/anaconda.mo"
|
||||||
|
CONTEXT_SEPARATOR = b"\x04"
|
||||||
|
|
||||||
|
|
||||||
|
def read_mo(path):
|
||||||
|
"""[(original bytes, translation bytes)], plural and context keys as stored."""
|
||||||
|
with open(path, "rb") as fh:
|
||||||
|
data = fh.read()
|
||||||
|
magic = struct.unpack("<I", data[:4])[0]
|
||||||
|
order = "<" if magic == 0x950412DE else ">"
|
||||||
|
_, count, originals, translations = struct.unpack(order + "4I", data[4:20])
|
||||||
|
entries = []
|
||||||
|
for index in range(count):
|
||||||
|
length, offset = struct.unpack(order + "2I", data[originals + 8 * index:originals + 8 * index + 8])
|
||||||
|
key = data[offset:offset + length]
|
||||||
|
length, offset = struct.unpack(order + "2I", data[translations + 8 * index:translations + 8 * index + 8])
|
||||||
|
entries.append((key, data[offset:offset + length]))
|
||||||
|
return entries
|
||||||
|
|
||||||
|
|
||||||
|
def write_mo(path, entries):
|
||||||
|
"""Write a .mo without hash table: gettext then looks keys up by binary
|
||||||
|
search, which needs the originals sorted bytewise."""
|
||||||
|
entries = sorted(entries)
|
||||||
|
count = len(entries)
|
||||||
|
header = 7 * 4
|
||||||
|
originals_table = header
|
||||||
|
translations_table = originals_table + 8 * count
|
||||||
|
data_start = translations_table + 8 * count
|
||||||
|
blobs, original_index, translation_index = b"", b"", b""
|
||||||
|
for key, _ in entries:
|
||||||
|
original_index += struct.pack("<2I", len(key), data_start + len(blobs))
|
||||||
|
blobs += key + b"\0"
|
||||||
|
for _, value in entries:
|
||||||
|
translation_index += struct.pack("<2I", len(value), data_start + len(blobs))
|
||||||
|
blobs += value + b"\0"
|
||||||
|
with open(path + ".fws", "wb") as fh:
|
||||||
|
fh.write(struct.pack("<7I", 0x950412DE, 0, count, originals_table,
|
||||||
|
translations_table, 0, data_start))
|
||||||
|
fh.write(original_index + translation_index + blobs)
|
||||||
|
os.replace(path + ".fws", path)
|
||||||
|
|
||||||
|
|
||||||
|
def is_translated(key, value):
|
||||||
|
"""A copy of the English text is how some catalogs leave a text untranslated."""
|
||||||
|
msgid = key.split(CONTEXT_SEPARATOR, 1)[-1]
|
||||||
|
return bool(value) and value != msgid
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
parser.add_argument("--root", default="/")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
supplement = os.path.join(args.root, SUPPLEMENT)
|
||||||
|
try:
|
||||||
|
with open(supplement, "rb") as fh:
|
||||||
|
messages = tomllib.load(fh).get("message", [])
|
||||||
|
except (OSError, tomllib.TOMLDecodeError) as exc:
|
||||||
|
print(f"merge-anaconda-translations: {supplement}: {exc}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
by_language = {}
|
||||||
|
for message in messages:
|
||||||
|
key = message["msgid"].encode()
|
||||||
|
if message.get("context"):
|
||||||
|
key = message["context"].encode() + CONTEXT_SEPARATOR + key
|
||||||
|
for language, text in message.items():
|
||||||
|
# A text that reads the same as the English (de "Region") would
|
||||||
|
# change nothing on screen and look missing again on every run.
|
||||||
|
if language not in ("msgid", "context") and text != message["msgid"]:
|
||||||
|
by_language.setdefault(language, {})[key] = text.encode()
|
||||||
|
|
||||||
|
added = {}
|
||||||
|
for language, texts in sorted(by_language.items()):
|
||||||
|
path = os.path.join(args.root, CATALOG.format(language=language))
|
||||||
|
if not os.path.exists(path):
|
||||||
|
print(f"merge-anaconda-translations: no Anaconda catalog for {language}", file=sys.stderr)
|
||||||
|
continue
|
||||||
|
entries = read_mo(path)
|
||||||
|
present = {key for key, value in entries if is_translated(key, value)}
|
||||||
|
new = [(key, value) for key, value in texts.items() if key not in present]
|
||||||
|
if new:
|
||||||
|
write_mo(path, [(key, value) for key, value in entries if key not in texts or key in present] + new)
|
||||||
|
added[language] = len(new)
|
||||||
|
print("merge-anaconda-translations: " + (", ".join(f"{lang} +{n}" for lang, n in added.items()) or "nothing to add"))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Write the FWS translations into the files that cannot look them up.
|
||||||
|
|
||||||
|
Run at build time by customize_airootfs.sh (usage: translate-static-files.py
|
||||||
|
[--root DIR], DIR defaulting to /). Menu entries, the SDDM theme and polkit
|
||||||
|
policies are read by programs that know nothing of the FWS catalogs, so the
|
||||||
|
texts of system-translations.toml are written into them, every language at
|
||||||
|
once; each program then picks the language of its user.
|
||||||
|
|
||||||
|
- Desktop entries carrying X-FWS-Translation=<prefix> get their Name,
|
||||||
|
GenericName, Comment and Keywords from <prefix>.name, .generic_name,
|
||||||
|
.comment and .keywords: the English text as the plain key, the other
|
||||||
|
languages as Name[de]= and so on.
|
||||||
|
- The SDDM theme "fws" gets translations.js with every sddm.* text.
|
||||||
|
- A polkit action containing <!-- fws-i18n: <prefix> --> gets its
|
||||||
|
<description> and <message> from <prefix>.description and .message.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
|
FWS_LIB = "/usr/local/lib/fws"
|
||||||
|
DESKTOP_DIRS = ["usr/share/applications", "etc/xdg/autostart", "usr/local/share/applications"]
|
||||||
|
DESKTOP_FIELDS = {"Name": "name", "GenericName": "generic_name",
|
||||||
|
"Comment": "comment", "Keywords": "keywords"}
|
||||||
|
SDDM_TRANSLATIONS = "usr/share/sddm/themes/fws/translations.js"
|
||||||
|
POLKIT_DIR = "usr/share/polkit-1/actions"
|
||||||
|
POLKIT_MARKER = re.compile(r"<!--\s*fws-i18n:\s*([a-z0-9_.]+)\s*-->")
|
||||||
|
|
||||||
|
|
||||||
|
def desktop_value(text, field):
|
||||||
|
text = text.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t")
|
||||||
|
if field == "Keywords" and not text.endswith(";"):
|
||||||
|
text += ";"
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def translate_desktop_entry(path, messages):
|
||||||
|
with open(path, encoding="utf-8") as fh:
|
||||||
|
lines = fh.read().splitlines()
|
||||||
|
prefix = next((line.split("=", 1)[1].strip() for line in lines
|
||||||
|
if line.startswith("X-FWS-Translation=")), None)
|
||||||
|
if not prefix:
|
||||||
|
return False
|
||||||
|
out, group = [], None
|
||||||
|
for line in lines:
|
||||||
|
if line.startswith("["):
|
||||||
|
group = line.strip()
|
||||||
|
field = line.split("=", 1)[0]
|
||||||
|
base = field.split("[", 1)[0]
|
||||||
|
texts = messages.get(f"{prefix}.{DESKTOP_FIELDS.get(base, '')}")
|
||||||
|
if group != "[Desktop Entry]" or base not in DESKTOP_FIELDS or not texts:
|
||||||
|
out.append(line)
|
||||||
|
continue
|
||||||
|
if field != base:
|
||||||
|
continue # an old translation, rewritten below
|
||||||
|
out.append(f"{base}={desktop_value(texts['en'], base)}")
|
||||||
|
for language in sorted(texts):
|
||||||
|
if language != "en":
|
||||||
|
out.append(f"{base}[{language}]={desktop_value(texts[language], base)}")
|
||||||
|
with open(path, "w", encoding="utf-8") as fh:
|
||||||
|
fh.write("\n".join(out) + "\n")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def write_sddm_translations(path, messages):
|
||||||
|
sddm = {key: texts for key, texts in messages.items() if key.startswith("sddm.")}
|
||||||
|
with open(path, "w", encoding="utf-8") as fh:
|
||||||
|
fh.write(".pragma library\n"
|
||||||
|
"// Generated at build time from system-translations.toml.\n"
|
||||||
|
f"var messages = {json.dumps(sddm, ensure_ascii=False, sort_keys=True)};\n")
|
||||||
|
|
||||||
|
|
||||||
|
def translate_policy(path, messages):
|
||||||
|
with open(path, encoding="utf-8") as fh:
|
||||||
|
content = fh.read()
|
||||||
|
changed = False
|
||||||
|
|
||||||
|
def action(match):
|
||||||
|
nonlocal changed
|
||||||
|
block = match.group(0)
|
||||||
|
marker = POLKIT_MARKER.search(block)
|
||||||
|
if not marker:
|
||||||
|
return block
|
||||||
|
for element in ("description", "message"):
|
||||||
|
texts = messages.get(f"{marker.group(1)}.{element}")
|
||||||
|
if not texts:
|
||||||
|
continue
|
||||||
|
# Drop earlier translations, then put the English text back with
|
||||||
|
# every other language after it.
|
||||||
|
block = re.sub(rf"\s*<{element} xml:lang=\"[^\"]*\">.*?</{element}>", "", block)
|
||||||
|
base = re.search(rf"([ \t]*)<{element}>.*?</{element}>", block)
|
||||||
|
if not base:
|
||||||
|
continue
|
||||||
|
indent = base.group(1)
|
||||||
|
lines = [f"{indent}<{element}>{escape(texts['en'])}</{element}>"]
|
||||||
|
lines += [f"{indent}<{element} xml:lang=\"{language}\">{escape(text)}</{element}>"
|
||||||
|
for language, text in sorted(texts.items()) if language != "en"]
|
||||||
|
block = block[:base.start()] + "\n".join(lines) + block[base.end():]
|
||||||
|
changed = True
|
||||||
|
return block
|
||||||
|
|
||||||
|
content = re.sub(r"<action\b.*?</action>", action, content, flags=re.S)
|
||||||
|
if changed:
|
||||||
|
with open(path, "w", encoding="utf-8") as fh:
|
||||||
|
fh.write(content)
|
||||||
|
return changed
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
parser.add_argument("--root", default="/")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.join(args.root, FWS_LIB.lstrip("/")))
|
||||||
|
import fws_i18n # pylint: disable=import-outside-toplevel
|
||||||
|
fws_i18n.TRANSLATIONS_DIR = os.path.join(args.root, fws_i18n.TRANSLATIONS_DIR.lstrip("/"))
|
||||||
|
messages = fws_i18n.catalog("system").messages()
|
||||||
|
if not messages:
|
||||||
|
print("translate-static-files: system-translations.toml missing or unreadable",
|
||||||
|
file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
done = []
|
||||||
|
for folder in DESKTOP_DIRS:
|
||||||
|
folder = os.path.join(args.root, folder)
|
||||||
|
for name in sorted(os.listdir(folder)) if os.path.isdir(folder) else []:
|
||||||
|
if name.endswith(".desktop") and translate_desktop_entry(os.path.join(folder, name), messages):
|
||||||
|
done.append(name)
|
||||||
|
sddm = os.path.join(args.root, SDDM_TRANSLATIONS)
|
||||||
|
if os.path.isdir(os.path.dirname(sddm)):
|
||||||
|
write_sddm_translations(sddm, messages)
|
||||||
|
done.append("sddm")
|
||||||
|
policies = os.path.join(args.root, POLKIT_DIR)
|
||||||
|
for name in sorted(os.listdir(policies)) if os.path.isdir(policies) else []:
|
||||||
|
if name.startswith("org.fws.") and translate_policy(os.path.join(policies, name), messages):
|
||||||
|
done.append(name)
|
||||||
|
print(f"translate-static-files: {', '.join(done) or 'nothing to translate'}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
|||||||
|
title FWS install medium (%ARCH%, UEFI)
|
||||||
|
sort-key 01
|
||||||
|
linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux
|
||||||
|
initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img
|
||||||
|
options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% udev.event_timeout=45
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
timeout 3
|
||||||
|
default 01-archiso-linux.conf
|
||||||
@@ -32,6 +32,14 @@ Architecture = auto
|
|||||||
# initrd entry, no microcode hook) and archiso empties /boot in the image; the
|
# initrd entry, no microcode hook) and archiso empties /boot in the image; the
|
||||||
# installed system gets its microcode from /usr/lib/firmware via mkinitcpio.
|
# installed system gets its microcode from /usr/lib/firmware via mkinitcpio.
|
||||||
NoExtract = usr/share/doc/* usr/share/gtk-doc/* boot/intel-ucode.img boot/amd-ucode.img
|
NoExtract = usr/share/doc/* usr/share/gtk-doc/* boot/intel-ucode.img boot/amd-ucode.img
|
||||||
|
# Firmware of router and server chips, never found in a PC (~47 MiB): Qualcomm
|
||||||
|
# IPQ/QCN Wi-Fi SoCs, MediaTek Filogic access points (mt7996), NXP DPAA2,
|
||||||
|
# Chelsio and Broadcom NetXtreme II server cards, QLogic NetXen. build.sh adds
|
||||||
|
# the firmware versions the kernel never loads (scripts/firmware-noextract.py).
|
||||||
|
NoExtract = usr/lib/firmware/ath11k/IPQ* usr/lib/firmware/ath11k/QCN9074* usr/lib/firmware/ath12k/IPQ* usr/lib/firmware/ath12k/QCN9274* usr/lib/firmware/mediatek/mt7996/* usr/lib/firmware/dpaa2/* usr/lib/firmware/cxgb4/* usr/lib/firmware/bnx2x/* usr/lib/firmware/phanfw.bin*
|
||||||
|
# Bytecode for "python -O" only (~7 MiB): nothing runs Python that way, and
|
||||||
|
# the plain .pyc next to them stays.
|
||||||
|
NoExtract = usr/lib/python3*/__pycache__/*.opt-1.pyc usr/lib/python3*/__pycache__/*.opt-2.pyc
|
||||||
|
|
||||||
# Misc options
|
# Misc options
|
||||||
#UseSyslog
|
#UseSyslog
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Pilotes et matériel (FWS)
|
X-FWS-Translation=apps.drivers_autostart
|
||||||
Comment=Terminer la mise en route du matériel au premier démarrage
|
Name=Drivers & Hardware (FWS)
|
||||||
|
Comment=Finish setting up the hardware on first start
|
||||||
# --autostart : ne s'affiche que si le marqueur /var/lib/fws/hardware-done est
|
# --autostart : ne s'affiche que si le marqueur /var/lib/fws/hardware-done est
|
||||||
# absent et que l'utilisateur ne l'a pas refusée. Deux cas le laissent absent :
|
# absent et que l'utilisateur ne l'a pas refusée. Deux cas le laissent absent :
|
||||||
# une installation sans réseau (rien n'a pu être installé), et — sur un bureau —
|
# une installation sans réseau (rien n'a pu être installé), et — sur un bureau —
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Bienvenue sur FWS
|
X-FWS-Translation=apps.hello_autostart
|
||||||
Comment=Fenêtre de bienvenue au premier démarrage
|
Name=Welcome to FWS
|
||||||
|
Comment=Welcome window on first start
|
||||||
Exec=fws-hello --autostart
|
Exec=fws-hello --autostart
|
||||||
Icon=help-about
|
Icon=help-about
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Fond d'écran FWS
|
X-FWS-Translation=apps.wallpaper_autostart
|
||||||
Comment=Applique le fond d'écran FWS au premier démarrage (le choix de l'utilisateur est conservé ensuite)
|
Name=FWS wallpaper
|
||||||
|
Comment=Sets the FWS wallpaper on first start (the user's choice is kept afterwards)
|
||||||
# --autostart réessaie jusqu'à 20 min si le bureau n'est pas encore prêt.
|
# --autostart réessaie jusqu'à 20 min si le bureau n'est pas encore prêt.
|
||||||
Exec=fws-wallpaper --autostart
|
Exec=fws-wallpaper --autostart
|
||||||
TryExec=fws-wallpaper
|
TryExec=fws-wallpaper
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# FWS — fenêtre « À propos » : deux onglets, « Le projet FWS » (ce qu'est FWS,
|
# FWS — « About » window: two tabs, « The FWS project » (what FWS is, version,
|
||||||
# version, liens) et « Système » (matériel + logiciel détectés). Remplace le
|
# links) and « System » (detected hardware and software). Replaces the « About
|
||||||
# « About Xfce » de libxfce4ui par une page de marque FWS. GTK3 (python-gobject
|
# Xfce » of libxfce4ui with an FWS-branded page. Texts come from
|
||||||
# installé avec le bureau).
|
# system-translations.toml (about.* keys). GTK3 (python-gobject installed with
|
||||||
|
# the desktop).
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
@@ -14,6 +16,11 @@ gi.require_version("Gtk", "3.0")
|
|||||||
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
||||||
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
t = catalog("system").t
|
||||||
|
|
||||||
GLib.set_prgname("fws-about")
|
GLib.set_prgname("fws-about")
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +55,7 @@ def _cpu():
|
|||||||
return line.split(":", 1)[1].strip()
|
return line.split(":", 1)[1].strip()
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
return "inconnu"
|
return t("about.unknown")
|
||||||
|
|
||||||
|
|
||||||
def _mem():
|
def _mem():
|
||||||
@@ -57,10 +64,10 @@ def _mem():
|
|||||||
for line in fh:
|
for line in fh:
|
||||||
if line.startswith("MemTotal"):
|
if line.startswith("MemTotal"):
|
||||||
kib = int(line.split()[1])
|
kib = int(line.split()[1])
|
||||||
return f"{kib / 1048576:.1f} Gio"
|
return t("about.memory_size", size=f"{kib / 1048576:.1f}")
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
return "inconnu"
|
return t("about.unknown")
|
||||||
|
|
||||||
|
|
||||||
def _gpus():
|
def _gpus():
|
||||||
@@ -69,7 +76,7 @@ def _gpus():
|
|||||||
low = line.lower()
|
low = line.lower()
|
||||||
if "vga" in low or "3d" in low or "display" in low:
|
if "vga" in low or "3d" in low or "display" in low:
|
||||||
out.append(line.split(":", 2)[-1].strip())
|
out.append(line.split(":", 2)[-1].strip())
|
||||||
return out or ["inconnu"]
|
return out or [t("about.unknown")]
|
||||||
|
|
||||||
|
|
||||||
def _desktop():
|
def _desktop():
|
||||||
@@ -77,12 +84,13 @@ def _desktop():
|
|||||||
return "Hyprland"
|
return "Hyprland"
|
||||||
env = os.environ.get("XDG_CURRENT_DESKTOP") \
|
env = os.environ.get("XDG_CURRENT_DESKTOP") \
|
||||||
or os.environ.get("DESKTOP_SESSION") or ""
|
or os.environ.get("DESKTOP_SESSION") or ""
|
||||||
return env or "inconnu"
|
return env or t("about.unknown")
|
||||||
|
|
||||||
|
|
||||||
def _session_type():
|
def _session_type():
|
||||||
t = os.environ.get("XDG_SESSION_TYPE", "")
|
session_type = os.environ.get("XDG_SESSION_TYPE", "")
|
||||||
return {"wayland": "Wayland", "x11": "X11"}.get(t, t or "inconnu")
|
return {"wayland": "Wayland", "x11": "X11"}.get(
|
||||||
|
session_type, session_type or t("about.unknown"))
|
||||||
|
|
||||||
|
|
||||||
def _disks():
|
def _disks():
|
||||||
@@ -91,7 +99,7 @@ def _disks():
|
|||||||
f = line.split()
|
f = line.split()
|
||||||
if f and f[-1] == "disk":
|
if f and f[-1] == "disk":
|
||||||
out.append(" ".join(f[:-1]))
|
out.append(" ".join(f[:-1]))
|
||||||
return out or ["inconnu"]
|
return out or [t("about.unknown")]
|
||||||
|
|
||||||
|
|
||||||
def _grid(rows):
|
def _grid(rows):
|
||||||
@@ -114,43 +122,36 @@ def _project_tab(osr):
|
|||||||
title.set_markup(f"<span size='xx-large' weight='bold'>{name}</span>")
|
title.set_markup(f"<span size='xx-large' weight='bold'>{name}</span>")
|
||||||
box.pack_start(title, False, False, 0)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
tag = Gtk.Label(label="Une distribution Linux qui ouvre ses bras à tout "
|
tag = Gtk.Label(label=t("about.tagline"))
|
||||||
"le monde : simple dès le premier démarrage, sans "
|
|
||||||
"rien retirer à Linux — c'est un Arch complet "
|
|
||||||
"dessous, et tout y reste possible.")
|
|
||||||
tag.set_line_wrap(True)
|
tag.set_line_wrap(True)
|
||||||
tag.set_max_width_chars(52)
|
tag.set_max_width_chars(52)
|
||||||
box.pack_start(tag, False, False, 0)
|
box.pack_start(tag, False, False, 0)
|
||||||
|
|
||||||
feats = Gtk.Label()
|
feats = Gtk.Label()
|
||||||
feats.set_markup(
|
feats.set_markup(t("about.features"))
|
||||||
"<b>Inclus :</b> installateur graphique · plusieurs bureaux "
|
|
||||||
"(GNOME, KDE, Hyprland, i3, XFCE) · Steam & Proton-GE · "
|
|
||||||
"réalité virtuelle (SteamVR) · PacManager (paquets) · "
|
|
||||||
"pare-feu · réparation système intégrée.")
|
|
||||||
feats.set_line_wrap(True)
|
feats.set_line_wrap(True)
|
||||||
feats.set_max_width_chars(52)
|
feats.set_max_width_chars(52)
|
||||||
feats.set_xalign(0)
|
feats.set_xalign(0)
|
||||||
box.pack_start(feats, False, False, 6)
|
box.pack_start(feats, False, False, 6)
|
||||||
|
|
||||||
home = osr.get("HOME_URL") or "https://gitea.nocode-var.tech/FWS/FWS-ISO"
|
home = osr.get("HOME_URL") or "https://gitea.nocode-var.tech/FWS/FWS-ISO"
|
||||||
link = Gtk.LinkButton.new_with_label(home, "Site du projet")
|
link = Gtk.LinkButton.new_with_label(home, t("about.project_website"))
|
||||||
box.pack_start(link, False, False, 0)
|
box.pack_start(link, False, False, 0)
|
||||||
return box
|
return box
|
||||||
|
|
||||||
|
|
||||||
def _system_tab(osr):
|
def _system_tab(osr):
|
||||||
rows = [
|
rows = [
|
||||||
("Système", osr.get("PRETTY_NAME", "FWS Linux")),
|
(t("about.system_label"), osr.get("PRETTY_NAME", "FWS Linux")),
|
||||||
("Build", osr.get("BUILD_ID", "rolling")),
|
(t("about.build_label"), osr.get("BUILD_ID", "rolling")),
|
||||||
("Noyau", _cmd("uname", "-r") or "inconnu"),
|
(t("about.kernel_label"), _cmd("uname", "-r") or t("about.unknown")),
|
||||||
("Bureau", _desktop()),
|
(t("about.desktop_label"), _desktop()),
|
||||||
("Affichage", _session_type()),
|
(t("about.display_label"), _session_type()),
|
||||||
("Nom de machine", _cmd("hostname") or os.uname().nodename),
|
(t("about.hostname_label"), _cmd("hostname") or os.uname().nodename),
|
||||||
("Processeur", _cpu()),
|
(t("about.processor_label"), _cpu()),
|
||||||
("Mémoire", _mem()),
|
(t("about.memory_label"), _mem()),
|
||||||
("Carte(s) graphique(s)", "\n".join(_gpus())),
|
(t("about.graphics_label"), "\n".join(_gpus())),
|
||||||
("Disque(s)", "\n".join(_disks())),
|
(t("about.disks_label"), "\n".join(_disks())),
|
||||||
]
|
]
|
||||||
scroll = Gtk.ScrolledWindow()
|
scroll = Gtk.ScrolledWindow()
|
||||||
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||||
@@ -160,15 +161,17 @@ def _system_tab(osr):
|
|||||||
|
|
||||||
class AboutWindow(Gtk.Window):
|
class AboutWindow(Gtk.Window):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(title="À propos de FWS")
|
super().__init__(title=t("about.window_title"))
|
||||||
self.set_default_size(520, 460)
|
self.set_default_size(520, 460)
|
||||||
self.set_position(Gtk.WindowPosition.CENTER)
|
self.set_position(Gtk.WindowPosition.CENTER)
|
||||||
self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
|
self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
|
||||||
|
|
||||||
osr = _osrelease()
|
osr = _osrelease()
|
||||||
notebook = Gtk.Notebook()
|
notebook = Gtk.Notebook()
|
||||||
notebook.append_page(_project_tab(osr), Gtk.Label(label="Le projet FWS"))
|
notebook.append_page(_project_tab(osr),
|
||||||
notebook.append_page(_system_tab(osr), Gtk.Label(label="Système"))
|
Gtk.Label(label=t("about.project_tab")))
|
||||||
|
notebook.append_page(_system_tab(osr),
|
||||||
|
Gtk.Label(label=t("about.system_tab")))
|
||||||
self.add(notebook)
|
self.add(notebook)
|
||||||
self.connect("destroy", Gtk.main_quit)
|
self.connect("destroy", Gtk.main_quit)
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,16 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
# What the user sees comes from system-translations.toml (bugreport.* keys).
|
||||||
|
# The report itself (section titles, field names, notes inside the collected
|
||||||
|
# text, the local trace) stays in French whatever the session's language: it
|
||||||
|
# is read by the FWS team, not by the user.
|
||||||
|
t = catalog("system").t
|
||||||
|
|
||||||
# Trace locale de chaque tentative d'envoi (date, code HTTP, réponse du
|
# Trace locale de chaque tentative d'envoi (date, code HTTP, réponse du
|
||||||
# serveur) — la façon de vérifier qu'un rapport est bien parti :
|
# serveur) — la façon de vérifier qu'un rapport est bien parti :
|
||||||
@@ -41,12 +51,12 @@ _LOG_PATH = "/tmp/fws-bugreport.log"
|
|||||||
_URL = "https://fws.laxacube.ch/api/bugs.php"
|
_URL = "https://fws.laxacube.ch/api/bugs.php"
|
||||||
_APP = "FWS"
|
_APP = "FWS"
|
||||||
|
|
||||||
# (valeur envoyée au serveur, libellé affiché)
|
# (value sent to the server, key of the label shown)
|
||||||
_TYPES = [
|
_TYPES = [
|
||||||
("bug", "Bug / panne"),
|
("bug", "bugreport.type_bug"),
|
||||||
("question", "Question"),
|
("question", "bugreport.type_question"),
|
||||||
("suggestion", "Suggestion"),
|
("suggestion", "bugreport.type_suggestion"),
|
||||||
("other", "Autre"),
|
("other", "bugreport.type_other"),
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -137,8 +147,9 @@ def _desktop():
|
|||||||
|
|
||||||
|
|
||||||
def _session_type():
|
def _session_type():
|
||||||
t = os.environ.get("XDG_SESSION_TYPE", "")
|
session_type = os.environ.get("XDG_SESSION_TYPE", "")
|
||||||
return {"wayland": "Wayland", "x11": "X11"}.get(t, t or "inconnu")
|
return {"wayland": "Wayland", "x11": "X11"}.get(
|
||||||
|
session_type, session_type or "inconnu")
|
||||||
|
|
||||||
|
|
||||||
def _tail(path, max_lines):
|
def _tail(path, max_lines):
|
||||||
@@ -411,11 +422,11 @@ def _send(payload):
|
|||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC — "
|
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC — "
|
||||||
f"curl introuvable : {exc}"])
|
f"curl introuvable : {exc}"])
|
||||||
return False, f"curl introuvable : {exc}"
|
return False, t("bugreport.curl_missing", error=exc)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC — délai "
|
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC — délai "
|
||||||
"dépassé (30 s)"])
|
"dépassé (30 s)"])
|
||||||
return False, "Délai dépassé (30 s) — vérifie ta connexion réseau."
|
return False, t("bugreport.timeout")
|
||||||
|
|
||||||
out = proc.stdout.decode("utf-8", "replace")
|
out = proc.stdout.decode("utf-8", "replace")
|
||||||
err = proc.stderr.decode("utf-8", "replace")
|
err = proc.stderr.decode("utf-8", "replace")
|
||||||
@@ -427,7 +438,8 @@ def _send(payload):
|
|||||||
detail = err.strip() or body.strip()
|
detail = err.strip() or body.strip()
|
||||||
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC curl "
|
_trace([f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] ÉCHEC curl "
|
||||||
f"(code {proc.returncode}) : {detail[:300]}"])
|
f"(code {proc.returncode}) : {detail[:300]}"])
|
||||||
return False, detail or f"curl a échoué (code {proc.returncode})."
|
return False, detail or t("bugreport.curl_failed",
|
||||||
|
code=proc.returncode)
|
||||||
|
|
||||||
# Le serveur répond en JSON : {"ok":true,"id":…,"message":…}. Un code
|
# Le serveur répond en JSON : {"ok":true,"id":…,"message":…}. Un code
|
||||||
# HTTP ≥ 400 ne fait PAS échouer curl — on le détecte ici, sinon l'utilisateur
|
# HTTP ≥ 400 ne fait PAS échouer curl — on le détecte ici, sinon l'utilisateur
|
||||||
@@ -453,8 +465,8 @@ def _send(payload):
|
|||||||
|
|
||||||
if ok:
|
if ok:
|
||||||
return True, f"HTTP {code or '?'} — {msg}{rid}"
|
return True, f"HTTP {code or '?'} — {msg}{rid}"
|
||||||
return False, (f"HTTP {code or '?'} — {msg or 'réponse vide'}. "
|
return False, t("bugreport.server_refused", code=code or "?",
|
||||||
"Le serveur a refusé le rapport.")
|
message=msg or t("bugreport.empty_response"))
|
||||||
|
|
||||||
|
|
||||||
# ── Assistant console (repli sans X) ─────────────────────────────────────────
|
# ── Assistant console (repli sans X) ─────────────────────────────────────────
|
||||||
@@ -475,29 +487,41 @@ def _tui(preload_path):
|
|||||||
except EOFError:
|
except EOFError:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
print("FWS — « Signaler un problème » (envoi optionnel de logs)")
|
def is_yes(answer):
|
||||||
print("Rien ne sera envoyé sans ta confirmation.\n")
|
# Same answers as t_is_yes (i18n.sh): the translated word, its first
|
||||||
|
# letter, the same without accents ("si" for "sí"), and the English
|
||||||
|
# ones that every keyboard can type.
|
||||||
|
answer = answer.lower()
|
||||||
|
yes = t("common.yes").lower()
|
||||||
|
plain = "".join(c for c in unicodedata.normalize("NFKD", yes)
|
||||||
|
if not unicodedata.combining(c))
|
||||||
|
return bool(answer) and answer in ("y", "yes", yes, yes[:1], plain, plain[:1])
|
||||||
|
|
||||||
|
print(t("bugreport.console_title"))
|
||||||
|
print(t("bugreport.console_confirmation_note") + "\n")
|
||||||
|
|
||||||
if preload_path:
|
if preload_path:
|
||||||
try:
|
try:
|
||||||
with open(preload_path, errors="replace") as fh:
|
with open(preload_path, errors="replace") as fh:
|
||||||
description = fh.read().strip()
|
description = fh.read().strip()
|
||||||
print(f"Logs chargés depuis {preload_path} "
|
print(t("bugreport.console_logs_loaded", path=preload_path,
|
||||||
f"({len(description)} caractères).")
|
count=len(description)))
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
print(f" ⚠ Impossible de lire {preload_path} : {exc}")
|
print(" ⚠ " + t("bugreport.read_error", path=preload_path,
|
||||||
|
error=exc))
|
||||||
description = ""
|
description = ""
|
||||||
else:
|
else:
|
||||||
description = ""
|
description = ""
|
||||||
|
|
||||||
valid_types = [v for v, _l in _TYPES]
|
valid_types = [v for v, _l in _TYPES]
|
||||||
if not description:
|
if not description:
|
||||||
print("Type (défaut : bug) : " + ", ".join(valid_types))
|
print(t("bugreport.console_type_choices", default="bug",
|
||||||
|
types=", ".join(valid_types)))
|
||||||
typ = ask("> ", "bug")
|
typ = ask("> ", "bug")
|
||||||
if typ not in valid_types:
|
if typ not in valid_types:
|
||||||
typ = "bug"
|
typ = "bug"
|
||||||
title = ask("Titre : ")
|
title = ask(t("bugreport.title_label") + " ")
|
||||||
print("Description (ligne vide pour terminer) :")
|
print(t("bugreport.console_description_prompt"))
|
||||||
lines = []
|
lines = []
|
||||||
while True:
|
while True:
|
||||||
line = ask("> ")
|
line = ask("> ")
|
||||||
@@ -506,26 +530,29 @@ def _tui(preload_path):
|
|||||||
lines.append(line)
|
lines.append(line)
|
||||||
description = "\n".join(lines)
|
description = "\n".join(lines)
|
||||||
else:
|
else:
|
||||||
typ = ask("Type (défaut : bug) : ", "bug")
|
typ = ask(t("bugreport.console_type_prompt", default="bug") + " ",
|
||||||
|
"bug")
|
||||||
if typ not in valid_types:
|
if typ not in valid_types:
|
||||||
typ = "bug"
|
typ = "bug"
|
||||||
title = ask("Titre : ")
|
title = ask(t("bugreport.title_label") + " ")
|
||||||
|
|
||||||
if not title:
|
if not title:
|
||||||
print(" ⚠ Titre obligatoire — envoi annulé.")
|
print(" ⚠ " + t("bugreport.console_title_required"))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
osr = _osrelease()
|
osr = _osrelease()
|
||||||
payload = _build_payload(osr, typ, title, description, include_diag=True)
|
payload = _build_payload(osr, typ, title, description, include_diag=True)
|
||||||
print("\n─── Aperçu de ce qui sera envoyé à", _URL, "───")
|
print("\n─── " + t("bugreport.console_preview_header", url=_URL) + " ───")
|
||||||
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
||||||
if ask("\nEnvoyer ? [o/N] ", "n").lower() not in ("o", "oui", "y", "yes"):
|
answer = ask(f"\n{t('bugreport.console_send_prompt')} "
|
||||||
print("Envoi annulé.")
|
f"{t('common.yes_no')} ", "n")
|
||||||
|
if not is_yes(answer):
|
||||||
|
print(t("bugreport.console_cancelled"))
|
||||||
return 0
|
return 0
|
||||||
ok, msg = _send(payload)
|
ok, msg = _send(payload)
|
||||||
print(("✔ " if ok else "✖ ") + msg)
|
print(("✔ " if ok else "✖ ") + msg)
|
||||||
if not ok:
|
if not ok:
|
||||||
print(f"Détails : {_LOG_PATH}")
|
print(t("bugreport.details", path=_LOG_PATH))
|
||||||
return 0 if ok else 1
|
return 0 if ok else 1
|
||||||
|
|
||||||
|
|
||||||
@@ -533,21 +560,21 @@ def _tui(preload_path):
|
|||||||
|
|
||||||
if _HAS_GTK:
|
if _HAS_GTK:
|
||||||
def _preview_dialog(parent, payload):
|
def _preview_dialog(parent, payload):
|
||||||
dlg = Gtk.Dialog(title="Confirmer l'envoi", transient_for=parent,
|
dlg = Gtk.Dialog(title=t("bugreport.confirm_title"),
|
||||||
modal=True, destroy_with_parent=True)
|
transient_for=parent, modal=True,
|
||||||
|
destroy_with_parent=True)
|
||||||
dlg.set_default_size(680, 520)
|
dlg.set_default_size(680, 520)
|
||||||
dlg.set_position(Gtk.WindowPosition.CENTER)
|
dlg.set_position(Gtk.WindowPosition.CENTER)
|
||||||
dlg.add_buttons("Annuler", Gtk.ResponseType.CANCEL,
|
dlg.add_buttons(t("bugreport.cancel_button"), Gtk.ResponseType.CANCEL,
|
||||||
"Confirmer l'envoi", Gtk.ResponseType.OK)
|
t("bugreport.confirm_button"), Gtk.ResponseType.OK)
|
||||||
|
|
||||||
box = dlg.get_content_area()
|
box = dlg.get_content_area()
|
||||||
box.set_spacing(10)
|
box.set_spacing(10)
|
||||||
box.set_border_width(14)
|
box.set_border_width(14)
|
||||||
|
|
||||||
note = Gtk.Label()
|
note = Gtk.Label()
|
||||||
note.set_markup(
|
note.set_markup(t("bugreport.preview_note",
|
||||||
"<b>Voici EXACTEMENT ce qui sera envoyé</b> à "
|
url=GLib.markup_escape_text(_URL)))
|
||||||
"<span font_family='monospace'>https://fws.laxacube.ch/api/bugs.php</span> :")
|
|
||||||
note.set_line_wrap(True)
|
note.set_line_wrap(True)
|
||||||
note.set_xalign(0)
|
note.set_xalign(0)
|
||||||
box.pack_start(note, False, False, 0)
|
box.pack_start(note, False, False, 0)
|
||||||
@@ -582,7 +609,7 @@ if _HAS_GTK:
|
|||||||
|
|
||||||
class BugReportWindow(Gtk.Window):
|
class BugReportWindow(Gtk.Window):
|
||||||
def __init__(self, preload_path=None):
|
def __init__(self, preload_path=None):
|
||||||
super().__init__(title="Signaler un problème — FWS")
|
super().__init__(title=t("bugreport.window_title"))
|
||||||
self.set_icon_name("fws-bugreport")
|
self.set_icon_name("fws-bugreport")
|
||||||
self.set_default_size(580, -1)
|
self.set_default_size(580, -1)
|
||||||
self.set_position(Gtk.WindowPosition.CENTER)
|
self.set_position(Gtk.WindowPosition.CENTER)
|
||||||
@@ -600,13 +627,11 @@ if _HAS_GTK:
|
|||||||
|
|
||||||
title = Gtk.Label()
|
title = Gtk.Label()
|
||||||
title.set_markup(
|
title.set_markup(
|
||||||
"<span size='x-large' weight='bold'>Signaler un problème</span>")
|
"<span size='x-large' weight='bold'>"
|
||||||
|
f"{GLib.markup_escape_text(t('bugreport.title'))}</span>")
|
||||||
box.pack_start(title, False, False, 0)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
subtitle = Gtk.Label(
|
subtitle = Gtk.Label(label=t("bugreport.subtitle"))
|
||||||
label="Un souci avec FWS ? Décris-le ci-dessous. Les informations "
|
|
||||||
"système et les logs de diagnostic peuvent être joints pour "
|
|
||||||
"aider les développeurs. Rien ne part sans ta confirmation.")
|
|
||||||
subtitle.set_line_wrap(True)
|
subtitle.set_line_wrap(True)
|
||||||
subtitle.set_xalign(0)
|
subtitle.set_xalign(0)
|
||||||
box.pack_start(subtitle, False, False, 0)
|
box.pack_start(subtitle, False, False, 0)
|
||||||
@@ -614,21 +639,24 @@ if _HAS_GTK:
|
|||||||
grid = Gtk.Grid(column_spacing=10, row_spacing=8)
|
grid = Gtk.Grid(column_spacing=10, row_spacing=8)
|
||||||
grid.set_halign(Gtk.Align.FILL)
|
grid.set_halign(Gtk.Align.FILL)
|
||||||
|
|
||||||
grid.attach(Gtk.Label(label="Type :", xalign=1), 0, 0, 1, 1)
|
grid.attach(Gtk.Label(label=t("bugreport.type_label"), xalign=1),
|
||||||
|
0, 0, 1, 1)
|
||||||
self._type = Gtk.ComboBoxText()
|
self._type = Gtk.ComboBoxText()
|
||||||
for value, label in _TYPES:
|
for value, label in _TYPES:
|
||||||
self._type.append(value, label)
|
self._type.append(value, t(label))
|
||||||
self._type.set_active(0)
|
self._type.set_active(0)
|
||||||
grid.attach(self._type, 1, 0, 1, 1)
|
grid.attach(self._type, 1, 0, 1, 1)
|
||||||
|
|
||||||
grid.attach(Gtk.Label(label="Titre :", xalign=1), 0, 1, 1, 1)
|
grid.attach(Gtk.Label(label=t("bugreport.title_label"), xalign=1),
|
||||||
|
0, 1, 1, 1)
|
||||||
self._title = Gtk.Entry()
|
self._title = Gtk.Entry()
|
||||||
self._title.set_placeholder_text("Résumé court du problème")
|
self._title.set_placeholder_text(t("bugreport.title_placeholder"))
|
||||||
grid.attach(self._title, 1, 1, 1, 1)
|
grid.attach(self._title, 1, 1, 1, 1)
|
||||||
|
|
||||||
box.pack_start(grid, False, False, 0)
|
box.pack_start(grid, False, False, 0)
|
||||||
|
|
||||||
desc_label = Gtk.Label(label="Description :", xalign=0)
|
desc_label = Gtk.Label(label=t("bugreport.description_label"),
|
||||||
|
xalign=0)
|
||||||
box.pack_start(desc_label, False, False, 0)
|
box.pack_start(desc_label, False, False, 0)
|
||||||
scroll = Gtk.ScrolledWindow()
|
scroll = Gtk.ScrolledWindow()
|
||||||
scroll.set_min_content_height(130)
|
scroll.set_min_content_height(130)
|
||||||
@@ -636,7 +664,7 @@ if _HAS_GTK:
|
|||||||
self._description = Gtk.TextView()
|
self._description = Gtk.TextView()
|
||||||
self._description.set_wrap_mode(Gtk.WrapMode.WORD)
|
self._description.set_wrap_mode(Gtk.WrapMode.WORD)
|
||||||
self._description.set_placeholder_text(
|
self._description.set_placeholder_text(
|
||||||
"Ce qui s'est passé, ce que tu attendais, ce que tu as essayé…")
|
t("bugreport.description_placeholder"))
|
||||||
scroll.add(self._description)
|
scroll.add(self._description)
|
||||||
box.pack_start(scroll, False, False, 0)
|
box.pack_start(scroll, False, False, 0)
|
||||||
|
|
||||||
@@ -646,29 +674,29 @@ if _HAS_GTK:
|
|||||||
content = fh.read()
|
content = fh.read()
|
||||||
self._description.get_buffer().set_text(content)
|
self._description.get_buffer().set_text(content)
|
||||||
loaded = Gtk.Label()
|
loaded = Gtk.Label()
|
||||||
|
path = GLib.markup_escape_text(preload_path)
|
||||||
loaded.set_markup(
|
loaded.set_markup(
|
||||||
f"<span size='small' foreground='#89b4fa'>Logs chargés "
|
"<span size='small' foreground='#89b4fa'>"
|
||||||
f"depuis <span font_family='monospace'>{preload_path}"
|
f"{t('bugreport.logs_loaded', path=path)}</span>")
|
||||||
f"</span> — tu peux les compléter ou les retirer.</span>")
|
|
||||||
loaded.set_line_wrap(True)
|
loaded.set_line_wrap(True)
|
||||||
loaded.set_xalign(0)
|
loaded.set_xalign(0)
|
||||||
box.pack_start(loaded, False, False, 0)
|
box.pack_start(loaded, False, False, 0)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
_message(self, "error", "Fichier illisible",
|
_message(self, "error", t("bugreport.file_unreadable"),
|
||||||
f"{preload_path} : {exc}")
|
t("bugreport.read_error", path=preload_path,
|
||||||
|
error=exc))
|
||||||
|
|
||||||
self._include = Gtk.CheckButton(
|
self._include = Gtk.CheckButton(
|
||||||
label="Joindre les informations système et les logs de diagnostic")
|
label=t("bugreport.include_diagnostics"))
|
||||||
self._include.set_active(True)
|
self._include.set_active(True)
|
||||||
self._include.set_tooltip_text(
|
self._include.set_tooltip_text(
|
||||||
"Version FWS, matériel détecté, extrait du journal du dernier "
|
t("bugreport.include_diagnostics_tooltip"))
|
||||||
"démarrage — à relire dans l'aperçu avant l'envoi")
|
|
||||||
box.pack_start(self._include, False, False, 4)
|
box.pack_start(self._include, False, False, 4)
|
||||||
|
|
||||||
footer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
footer = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
||||||
cancel = Gtk.Button(label="Fermer")
|
cancel = Gtk.Button(label=t("common.close"))
|
||||||
cancel.connect("clicked", lambda _b: self.close())
|
cancel.connect("clicked", lambda _b: self.close())
|
||||||
send = Gtk.Button(label="Envoyer…")
|
send = Gtk.Button(label=t("bugreport.send_button"))
|
||||||
send.get_style_context().add_class("suggested-action")
|
send.get_style_context().add_class("suggested-action")
|
||||||
send.connect("clicked", self._on_send)
|
send.connect("clicked", self._on_send)
|
||||||
footer.pack_end(send, False, False, 0)
|
footer.pack_end(send, False, False, 0)
|
||||||
@@ -686,8 +714,8 @@ if _HAS_GTK:
|
|||||||
except Exception as exc: # noqa: BLE001
|
except Exception as exc: # noqa: BLE001
|
||||||
_trace(["=== CRASH fws-bugreport ===",
|
_trace(["=== CRASH fws-bugreport ===",
|
||||||
traceback.format_exc()])
|
traceback.format_exc()])
|
||||||
_message(self, "error", "Erreur inattendue",
|
_message(self, "error", t("bugreport.unexpected_error"),
|
||||||
f"{exc}\n\nDétails : {_LOG_PATH}")
|
f"{exc}\n\n{t('bugreport.details', path=_LOG_PATH)}")
|
||||||
|
|
||||||
def _do_send(self):
|
def _do_send(self):
|
||||||
title = self._title.get_text().strip()
|
title = self._title.get_text().strip()
|
||||||
@@ -696,13 +724,12 @@ if _HAS_GTK:
|
|||||||
buf.get_end_iter(), True).strip()
|
buf.get_end_iter(), True).strip()
|
||||||
include = self._include.get_active()
|
include = self._include.get_active()
|
||||||
if not title:
|
if not title:
|
||||||
_message(self, "error", "Titre manquant",
|
_message(self, "error", t("bugreport.title_missing"),
|
||||||
"Indique un titre court pour le problème.")
|
t("bugreport.title_missing_detail"))
|
||||||
return
|
return
|
||||||
if not description and not include:
|
if not description and not include:
|
||||||
_message(self, "error", "Rapport vide",
|
_message(self, "error", t("bugreport.report_empty"),
|
||||||
"Écris une description ou coche la jointure des "
|
t("bugreport.report_empty_detail"))
|
||||||
"informations système et des logs.")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
typ = self._type.get_active_id() or "bug"
|
typ = self._type.get_active_id() or "bug"
|
||||||
@@ -711,13 +738,13 @@ if _HAS_GTK:
|
|||||||
return
|
return
|
||||||
ok, msg = _send(payload)
|
ok, msg = _send(payload)
|
||||||
if ok:
|
if ok:
|
||||||
_message(self, "info", "Rapport envoyé ✔",
|
_message(self, "info", t("bugreport.sent_title"),
|
||||||
f"{msg}\n\nMerci ! L'équipe FWS a reçu ton rapport.\n"
|
f"{msg}\n\n{t('bugreport.sent_thanks')}\n"
|
||||||
f"(trace : {_LOG_PATH})")
|
f"{t('bugreport.log_path', path=_LOG_PATH)}")
|
||||||
else:
|
else:
|
||||||
_message(self, "error", "Envoi impossible",
|
_message(self, "error", t("bugreport.send_failed_title"),
|
||||||
f"{msg}\n\nTon rapport n'a pas été envoyé. Vérifie ta "
|
f"{msg}\n\n{t('bugreport.send_failed_detail')}\n"
|
||||||
f"connexion et réessaie.\nDétails : {_LOG_PATH}")
|
f"{t('bugreport.details', path=_LOG_PATH)}")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@@ -12,10 +12,14 @@
|
|||||||
# fws-setup-hardware --groups a,b <bureau>→ installation avancée
|
# fws-setup-hardware --groups a,b <bureau>→ installation avancée
|
||||||
# fws-setup-hardware --check → vérification/réparation seule
|
# fws-setup-hardware --check → vérification/réparation seule
|
||||||
#
|
#
|
||||||
|
# Texts come from system-translations.toml (drivers.* keys); the group names
|
||||||
|
# come translated from the engine's plan (hardware.* keys).
|
||||||
|
#
|
||||||
# GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ; python-gobject
|
# GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ; python-gobject
|
||||||
# est installé avec le bureau par le kickstart — mêmes prérequis que fws-hello.
|
# est installé avec le bureau par le kickstart — mêmes prérequis que fws-hello.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -27,6 +31,11 @@ gi.require_version("Gtk", "3.0")
|
|||||||
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
||||||
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
t = catalog("system").t
|
||||||
|
|
||||||
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante » ciblent
|
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante » ciblent
|
||||||
# cette classe.
|
# cette classe.
|
||||||
GLib.set_prgname("fws-drivers")
|
GLib.set_prgname("fws-drivers")
|
||||||
@@ -78,8 +87,8 @@ def _privileged_argv(args):
|
|||||||
term = _terminal()
|
term = _terminal()
|
||||||
if term is None:
|
if term is None:
|
||||||
return ["sh", "-c", "sudo " + " ".join([_ENGINE] + args)], False
|
return ["sh", "-c", "sudo " + " ".join([_ENGINE] + args)], False
|
||||||
command = ("sudo " + " ".join([_ENGINE] + args)
|
command = ("sudo " + " ".join([_ENGINE] + args) + "; echo; echo "
|
||||||
+ "; echo; echo 'Appuie sur Entrée pour fermer.'; read _")
|
+ shlex.quote(t("common.press_enter_to_close")) + "; read _")
|
||||||
if term == "gnome-terminal":
|
if term == "gnome-terminal":
|
||||||
return [term, "--", "sh", "-c", command], False
|
return [term, "--", "sh", "-c", command], False
|
||||||
return [term, "-e", "sh", "-c", command], False
|
return [term, "-e", "sh", "-c", command], False
|
||||||
@@ -129,7 +138,7 @@ def _big_button(label, description):
|
|||||||
|
|
||||||
class DriversWindow(Gtk.Window):
|
class DriversWindow(Gtk.Window):
|
||||||
def __init__(self, autostart=False):
|
def __init__(self, autostart=False):
|
||||||
super().__init__(title="FWS — Pilotes et matériel")
|
super().__init__(title=t("drivers.window_title"))
|
||||||
self._autostart = autostart
|
self._autostart = autostart
|
||||||
self.set_default_size(560, -1)
|
self.set_default_size(560, -1)
|
||||||
self.set_position(Gtk.WindowPosition.CENTER)
|
self.set_position(Gtk.WindowPosition.CENTER)
|
||||||
@@ -154,40 +163,30 @@ class DriversWindow(Gtk.Window):
|
|||||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
|
||||||
|
|
||||||
title = Gtk.Label()
|
title = Gtk.Label()
|
||||||
title.set_markup("<span size='x-large' weight='bold'>Pilotes et matériel</span>")
|
title.set_markup("<span size='x-large' weight='bold'>"
|
||||||
|
f"{GLib.markup_escape_text(t('drivers.title'))}</span>")
|
||||||
title.set_xalign(0)
|
title.set_xalign(0)
|
||||||
box.pack_start(title, False, False, 0)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
subtitle = Gtk.Label(
|
subtitle = Gtk.Label(label=t("drivers.subtitle"))
|
||||||
label="Tout ce qu'il faut pour que ta machine fonctionne au mieux : "
|
|
||||||
"affichage, son, Bluetooth, luminosité, imprimante, jeux.")
|
|
||||||
subtitle.set_line_wrap(True)
|
subtitle.set_line_wrap(True)
|
||||||
subtitle.set_xalign(0)
|
subtitle.set_xalign(0)
|
||||||
box.pack_start(subtitle, False, False, 0)
|
box.pack_start(subtitle, False, False, 0)
|
||||||
|
|
||||||
simple = _big_button(
|
simple = _big_button(t("drivers.simple_label"),
|
||||||
"Installation simple (recommandé)",
|
t("drivers.simple_description"))
|
||||||
"FWS installe ce dont ta machine a besoin, puis s'assure que "
|
|
||||||
"l'affichage, le son, le Bluetooth et le réseau fonctionnent. "
|
|
||||||
"Ajoute aussi les codecs audio/vidéo, Steam + Wine et la réalité "
|
|
||||||
"virtuelle : plusieurs gigaoctets, compte un bon moment selon ta "
|
|
||||||
"connexion. Tu n'as rien à choisir.")
|
|
||||||
simple.connect("clicked", self._on_simple)
|
simple.connect("clicked", self._on_simple)
|
||||||
box.pack_start(simple, False, False, 0)
|
box.pack_start(simple, False, False, 0)
|
||||||
|
|
||||||
advanced = _big_button(
|
advanced = _big_button(t("drivers.advanced_label"),
|
||||||
"Installation avancée",
|
t("drivers.advanced_description"))
|
||||||
"Pour décider toi-même de ce qui s'installe. Ce qui a été reconnu "
|
|
||||||
"sur ta machine est déjà coché.")
|
|
||||||
advanced.connect("clicked", self._on_advanced)
|
advanced.connect("clicked", self._on_advanced)
|
||||||
box.pack_start(advanced, False, False, 0)
|
box.pack_start(advanced, False, False, 0)
|
||||||
|
|
||||||
box.pack_start(Gtk.Separator(), False, False, 6)
|
box.pack_start(Gtk.Separator(), False, False, 6)
|
||||||
|
|
||||||
check = _big_button(
|
check = _big_button(t("drivers.check_label"),
|
||||||
"Vérifier et réparer seulement",
|
t("drivers.check_description"))
|
||||||
"N'installe rien. Regarde si le son, le Bluetooth, le réseau et "
|
|
||||||
"l'imprimante répondent, et les remet en route si besoin.")
|
|
||||||
check.connect("clicked", self._on_check)
|
check.connect("clicked", self._on_check)
|
||||||
box.pack_start(check, False, False, 0)
|
box.pack_start(check, False, False, 0)
|
||||||
|
|
||||||
@@ -195,12 +194,11 @@ class DriversWindow(Gtk.Window):
|
|||||||
# à la main, elle n'a aucune raison de se faire taire.
|
# à la main, elle n'a aucune raison de se faire taire.
|
||||||
self._again = None
|
self._again = None
|
||||||
if self._autostart:
|
if self._autostart:
|
||||||
self._again = Gtk.CheckButton(
|
self._again = Gtk.CheckButton(label=t("drivers.dont_offer_again"))
|
||||||
label="Ne plus me le proposer au démarrage")
|
|
||||||
self._again.set_active(False)
|
self._again.set_active(False)
|
||||||
box.pack_start(self._again, False, False, 6)
|
box.pack_start(self._again, False, False, 6)
|
||||||
|
|
||||||
close = Gtk.Button(label="Fermer")
|
close = Gtk.Button(label=t("common.close"))
|
||||||
close.connect("clicked", lambda _b: self.close())
|
close.connect("clicked", lambda _b: self.close())
|
||||||
box.pack_start(close, False, False, 6)
|
box.pack_start(close, False, False, 6)
|
||||||
return box
|
return box
|
||||||
@@ -210,13 +208,12 @@ class DriversWindow(Gtk.Window):
|
|||||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12)
|
||||||
|
|
||||||
title = Gtk.Label()
|
title = Gtk.Label()
|
||||||
title.set_markup("<span size='x-large' weight='bold'>Installation avancée</span>")
|
title.set_markup("<span size='x-large' weight='bold'>"
|
||||||
|
f"{GLib.markup_escape_text(t('drivers.advanced_label'))}</span>")
|
||||||
title.set_xalign(0)
|
title.set_xalign(0)
|
||||||
box.pack_start(title, False, False, 0)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
hint = Gtk.Label(
|
hint = Gtk.Label(label=t("drivers.advanced_hint"))
|
||||||
label="Ce qui a été reconnu sur ta machine est coché. "
|
|
||||||
"Décoche ce dont tu ne veux pas.")
|
|
||||||
hint.set_line_wrap(True)
|
hint.set_line_wrap(True)
|
||||||
hint.set_xalign(0)
|
hint.set_xalign(0)
|
||||||
hint.get_style_context().add_class("dim-label")
|
hint.get_style_context().add_class("dim-label")
|
||||||
@@ -237,7 +234,7 @@ class DriversWindow(Gtk.Window):
|
|||||||
head = Gtk.Label()
|
head = Gtk.Label()
|
||||||
mark = GLib.markup_escape_text(label)
|
mark = GLib.markup_escape_text(label)
|
||||||
if not detected:
|
if not detected:
|
||||||
mark += " <i>(non détecté sur cette machine)</i>"
|
mark += f" <i>{GLib.markup_escape_text(t('drivers.not_detected'))}</i>"
|
||||||
head.set_markup(mark)
|
head.set_markup(mark)
|
||||||
head.set_xalign(0)
|
head.set_xalign(0)
|
||||||
head.set_line_wrap(True)
|
head.set_line_wrap(True)
|
||||||
@@ -254,10 +251,10 @@ class DriversWindow(Gtk.Window):
|
|||||||
|
|
||||||
buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
|
||||||
buttons.set_halign(Gtk.Align.END)
|
buttons.set_halign(Gtk.Align.END)
|
||||||
back = Gtk.Button(label="Précédent")
|
back = Gtk.Button(label=t("drivers.back_button"))
|
||||||
back.connect("clicked",
|
back.connect("clicked",
|
||||||
lambda _b: self._stack.set_visible_child_name("home"))
|
lambda _b: self._stack.set_visible_child_name("home"))
|
||||||
install = Gtk.Button(label="Installer la sélection")
|
install = Gtk.Button(label=t("drivers.install_selection_button"))
|
||||||
install.get_style_context().add_class("suggested-action")
|
install.get_style_context().add_class("suggested-action")
|
||||||
install.connect("clicked", self._on_install_selection)
|
install.connect("clicked", self._on_install_selection)
|
||||||
buttons.pack_start(back, False, False, 0)
|
buttons.pack_start(back, False, False, 0)
|
||||||
@@ -295,21 +292,19 @@ class DriversWindow(Gtk.Window):
|
|||||||
self._spinner = Gtk.Spinner()
|
self._spinner = Gtk.Spinner()
|
||||||
self._spinner.start()
|
self._spinner.start()
|
||||||
row.pack_start(self._spinner, False, False, 0)
|
row.pack_start(self._spinner, False, False, 0)
|
||||||
self._status = Gtk.Label(label="Préparation…")
|
self._status = Gtk.Label(label=t("drivers.status_preparing"))
|
||||||
self._status.set_xalign(0)
|
self._status.set_xalign(0)
|
||||||
self._status.set_line_wrap(True)
|
self._status.set_line_wrap(True)
|
||||||
row.pack_start(self._status, True, True, 0)
|
row.pack_start(self._status, True, True, 0)
|
||||||
box.pack_start(row, False, False, 0)
|
box.pack_start(row, False, False, 0)
|
||||||
|
|
||||||
self._reassure = Gtk.Label(
|
self._reassure = Gtk.Label(label=t("drivers.reassurance"))
|
||||||
label="Tu peux laisser cette fenêtre ouverte, il n'y a rien à faire. "
|
|
||||||
"Évite juste d'éteindre la machine maintenant.")
|
|
||||||
self._reassure.set_line_wrap(True)
|
self._reassure.set_line_wrap(True)
|
||||||
self._reassure.set_xalign(0)
|
self._reassure.set_xalign(0)
|
||||||
self._reassure.get_style_context().add_class("dim-label")
|
self._reassure.get_style_context().add_class("dim-label")
|
||||||
box.pack_start(self._reassure, False, False, 0)
|
box.pack_start(self._reassure, False, False, 0)
|
||||||
|
|
||||||
expander = Gtk.Expander(label="Afficher les détails")
|
expander = Gtk.Expander(label=t("drivers.show_details"))
|
||||||
scroll = Gtk.ScrolledWindow()
|
scroll = Gtk.ScrolledWindow()
|
||||||
scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
scroll.set_min_content_height(240)
|
scroll.set_min_content_height(240)
|
||||||
@@ -321,7 +316,7 @@ class DriversWindow(Gtk.Window):
|
|||||||
expander.add(scroll)
|
expander.add(scroll)
|
||||||
box.pack_start(expander, True, True, 0)
|
box.pack_start(expander, True, True, 0)
|
||||||
|
|
||||||
self._close = Gtk.Button(label="Fermer")
|
self._close = Gtk.Button(label=t("common.close"))
|
||||||
self._close.set_sensitive(False)
|
self._close.set_sensitive(False)
|
||||||
self._close.connect("clicked", lambda _b: self.close())
|
self._close.connect("clicked", lambda _b: self.close())
|
||||||
box.pack_start(self._close, False, False, 0)
|
box.pack_start(self._close, False, False, 0)
|
||||||
@@ -342,8 +337,7 @@ class DriversWindow(Gtk.Window):
|
|||||||
# Repli terminal : impossible de suivre la sortie depuis ici.
|
# Repli terminal : impossible de suivre la sortie depuis ici.
|
||||||
subprocess.Popen(argv) # noqa: S603 — commandes internes FWS
|
subprocess.Popen(argv) # noqa: S603 — commandes internes FWS
|
||||||
self._spinner.stop()
|
self._spinner.stop()
|
||||||
self._status.set_text(
|
self._status.set_text(t("drivers.status_in_terminal"))
|
||||||
"La suite se passe dans la fenêtre de terminal qui vient de s'ouvrir.")
|
|
||||||
self._reassure.hide()
|
self._reassure.hide()
|
||||||
self._close.set_sensitive(True)
|
self._close.set_sensitive(True)
|
||||||
return
|
return
|
||||||
@@ -364,31 +358,24 @@ class DriversWindow(Gtk.Window):
|
|||||||
self._proc.wait()
|
self._proc.wait()
|
||||||
GLib.idle_add(self._finished, self._proc.returncode, None)
|
GLib.idle_add(self._finished, self._proc.returncode, None)
|
||||||
|
|
||||||
# Traduction des étapes du moteur en phrases lisibles. Les libellés bruts
|
# Engine steps turned into readable sentences, by the tag of their line
|
||||||
# restent dans les détails.
|
# ("[FWS-hw:install] …"): the engine's text is translated, possibly into
|
||||||
_STEPS = (
|
# another language than the window's (pkexec runs it with the system's), so
|
||||||
("groupe «", "Installation : "),
|
# only the tag is read. The raw lines stay in the details.
|
||||||
("installation :", "Téléchargement et installation des paquets…"),
|
_STEP_PREFIX = "[FWS-hw:"
|
||||||
("vérification des services", "Vérification de ton matériel…"),
|
_STEPS = {
|
||||||
("synchro pacman", "Mise à jour de la liste des logiciels…"),
|
"install": "drivers.status_installing",
|
||||||
)
|
"check": "drivers.status_checking",
|
||||||
|
}
|
||||||
|
|
||||||
def _append(self, line):
|
def _append(self, line):
|
||||||
buf = self._log.get_buffer()
|
buf = self._log.get_buffer()
|
||||||
buf.insert(buf.get_end_iter(), line + "\n")
|
buf.insert(buf.get_end_iter(), line + "\n")
|
||||||
self._log.scroll_to_iter(buf.get_end_iter(), 0.0, False, 0.0, 0.0)
|
self._log.scroll_to_iter(buf.get_end_iter(), 0.0, False, 0.0, 0.0)
|
||||||
if not line.startswith("[FWS-hw]"):
|
if line.startswith(self._STEP_PREFIX):
|
||||||
return False
|
step = line[len(self._STEP_PREFIX):].split("]", 1)[0]
|
||||||
text = line.split("]", 1)[1].strip()
|
if step in self._STEPS:
|
||||||
for needle, friendly in self._STEPS:
|
self._status.set_text(t(self._STEPS[step]))
|
||||||
if needle in text:
|
|
||||||
if friendly.endswith(": "):
|
|
||||||
# « groupe « Pilotes graphiques — … » » → « Pilotes graphiques »
|
|
||||||
label = text.split("«", 1)[1].rsplit("»", 1)[0]
|
|
||||||
self._status.set_text(friendly + label.split("—")[0].strip())
|
|
||||||
else:
|
|
||||||
self._status.set_text(friendly)
|
|
||||||
return False
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _finished(self, code, error):
|
def _finished(self, code, error):
|
||||||
@@ -396,31 +383,27 @@ class DriversWindow(Gtk.Window):
|
|||||||
self._reassure.hide()
|
self._reassure.hide()
|
||||||
self._close.set_sensitive(True)
|
self._close.set_sensitive(True)
|
||||||
if error is not None:
|
if error is not None:
|
||||||
self._status.set_markup(
|
self._show_result(t("drivers.launch_failed"), error)
|
||||||
"<b>Impossible de lancer l'installation.</b>\n"
|
|
||||||
+ GLib.markup_escape_text(error))
|
|
||||||
return
|
return
|
||||||
if code == 0:
|
if code == 0:
|
||||||
self._status.set_markup(
|
self._show_result(t("drivers.done_title"), t("drivers.done_body"))
|
||||||
"<b>C'est prêt.</b>\nSi des pilotes graphiques viennent d'être "
|
|
||||||
"installés, redémarre pour qu'ils prennent effet.")
|
|
||||||
elif code == 126:
|
elif code == 126:
|
||||||
# pkexec : authentification refusée ou annulée.
|
# pkexec : authentification refusée ou annulée.
|
||||||
self._status.set_markup(
|
self._show_result(t("drivers.cancelled_title"), t("drivers.cancelled_body"))
|
||||||
"<b>Annulé.</b>\nRien n'a été modifié — le mot de passe "
|
|
||||||
"administrateur n'a pas été validé.")
|
|
||||||
else:
|
else:
|
||||||
self._status.set_markup(
|
self._show_result(t("drivers.failed_title"), t("drivers.failed_body"))
|
||||||
"<b>Tout n'a pas abouti.</b>\nLe plus souvent c'est la connexion "
|
|
||||||
"Internet. Vérifie-la puis réessaie ; les détails ci-dessous "
|
def _show_result(self, title, body):
|
||||||
"disent ce qui a échoué.")
|
"""Status line: `title` in bold, then `body` on the next line."""
|
||||||
|
self._status.set_markup(f"<b>{GLib.markup_escape_text(title)}</b>\n"
|
||||||
|
+ GLib.markup_escape_text(body))
|
||||||
|
|
||||||
# ---------------------------------------------------------------- actions
|
# ---------------------------------------------------------------- actions
|
||||||
def _on_simple(self, _button):
|
def _on_simple(self, _button):
|
||||||
self._start(["--all", self._session], "Installation du nécessaire")
|
self._start(["--all", self._session], t("drivers.simple_heading"))
|
||||||
|
|
||||||
def _on_check(self, _button):
|
def _on_check(self, _button):
|
||||||
self._start(["--check"], "Vérification du matériel")
|
self._start(["--check"], t("drivers.check_heading"))
|
||||||
|
|
||||||
def _on_advanced(self, _button):
|
def _on_advanced(self, _button):
|
||||||
groups = _plan(self._session)
|
groups = _plan(self._session)
|
||||||
@@ -428,10 +411,9 @@ class DriversWindow(Gtk.Window):
|
|||||||
dialog = Gtk.MessageDialog(
|
dialog = Gtk.MessageDialog(
|
||||||
transient_for=self, modal=True,
|
transient_for=self, modal=True,
|
||||||
message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK,
|
message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK,
|
||||||
text="Impossible de lister le matériel")
|
text=t("drivers.plan_failed_title"))
|
||||||
dialog.format_secondary_text(
|
dialog.format_secondary_text(
|
||||||
f"« {_ENGINE} --plan » n'a rien renvoyé. "
|
t("drivers.plan_failed_detail", command=f"{_ENGINE} --plan"))
|
||||||
"L'installation simple reste utilisable.")
|
|
||||||
dialog.run()
|
dialog.run()
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
return
|
return
|
||||||
@@ -449,7 +431,7 @@ class DriversWindow(Gtk.Window):
|
|||||||
self._stack.set_visible_child_name("home")
|
self._stack.set_visible_child_name("home")
|
||||||
return
|
return
|
||||||
self._start(["--groups", ",".join(chosen), self._session],
|
self._start(["--groups", ",".join(chosen), self._session],
|
||||||
"Installation de ta sélection")
|
t("drivers.selection_heading"))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -460,11 +442,10 @@ def main():
|
|||||||
if os.path.exists(_SYSTEM_DONE) or os.path.exists(_USER_DONE):
|
if os.path.exists(_SYSTEM_DONE) or os.path.exists(_USER_DONE):
|
||||||
return 0
|
return 0
|
||||||
if not Gtk.init_check()[0]:
|
if not Gtk.init_check()[0]:
|
||||||
print("Aucun serveur graphique : utilise « sudo fws-setup-hardware » "
|
print(t("drivers.no_display", command=f"sudo {_ENGINE}"), file=sys.stderr)
|
||||||
"en console.", file=sys.stderr)
|
|
||||||
return 1
|
return 1
|
||||||
if shutil.which(_ENGINE) is None:
|
if shutil.which(_ENGINE) is None:
|
||||||
print(f"{_ENGINE} est absent de cette image.", file=sys.stderr)
|
print(t("drivers.engine_missing", command=_ENGINE), file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
window = DriversWindow(autostart=autostart)
|
window = DriversWindow(autostart=autostart)
|
||||||
window.connect("destroy", lambda _w: Gtk.main_quit())
|
window.connect("destroy", lambda _w: Gtk.main_quit())
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# FWS — fenêtre de bienvenue au premier démarrage (pendant post-install de la
|
# FWS — welcome window on first start. Buttons: system update, « Drivers &
|
||||||
# page récap de l'installateur). Boutons : mise à jour, codecs, VR, raccourcis,
|
# Hardware » (which also installs codecs, games and VR), Proton-GE, keyboard
|
||||||
# Proton-GE. GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ;
|
# shortcuts. Texts come from system-translations.toml (hello.* keys).
|
||||||
|
# GTK3 : présent sur TOUS les bureaux FWS (Firefox le tire) ;
|
||||||
# python-gobject est installé avec le bureau par le kickstart.
|
# python-gobject est installé avec le bureau par le kickstart.
|
||||||
#
|
#
|
||||||
# Lancement : /etc/xdg/autostart (KDE/GNOME/XFCE) et exec des configs
|
# Lancement : /etc/xdg/autostart (KDE/GNOME/XFCE) et exec des configs
|
||||||
@@ -19,32 +20,23 @@ gi.require_version("Gtk", "3.0")
|
|||||||
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
gi.require_version("Gdk", "3.0") # sinon gi charge Gdk 4.0 (conflit avec Gtk3)
|
||||||
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
from gi.repository import Gdk, GLib, Gtk # noqa: E402
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
t = catalog("system").t
|
||||||
|
|
||||||
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante »
|
# WM_CLASS déterministe : les règles i3/Hyprland « fenêtre flottante »
|
||||||
# ciblent cette classe.
|
# ciblent cette classe.
|
||||||
GLib.set_prgname("fws-hello")
|
GLib.set_prgname("fws-hello")
|
||||||
|
|
||||||
_FLAG = os.path.expanduser("~/.config/fws/hello-done")
|
_FLAG = os.path.expanduser("~/.config/fws/hello-done")
|
||||||
|
|
||||||
_CODECS = ("gst-plugins-base gst-plugins-good gst-plugins-bad "
|
# (label key, description key, command, in a terminal). Codecs and VR are
|
||||||
"gst-plugins-ugly gst-libav ffmpeg mpv")
|
# groups of « Drivers & Hardware »: one place to install them, not two.
|
||||||
|
|
||||||
# (libellé, description, commande, en_terminal)
|
|
||||||
_ACTIONS = [
|
_ACTIONS = [
|
||||||
("Mettre à jour le système",
|
("hello.update_label", "hello.update_description", "fws-update", True),
|
||||||
"pacman -Syu + nettoyage du cache",
|
("hello.drivers_label", "hello.drivers_description", "fws-drivers", False),
|
||||||
"fws-update", True),
|
("hello.proton_label", "hello.proton_description", "fws-proton-ge", True),
|
||||||
("Pilotes et matériel",
|
|
||||||
"graphique, son, Bluetooth, luminosité, jeux, impression",
|
|
||||||
"fws-drivers", False),
|
|
||||||
("Installer les codecs multimédia",
|
|
||||||
"lecture vidéo/audio (GStreamer, ffmpeg, mpv)",
|
|
||||||
f"sudo pacman -S --needed {_CODECS}", True),
|
|
||||||
("Proton-GE pour Steam",
|
|
||||||
"meilleure compatibilité des jeux Windows",
|
|
||||||
"fws-proton-ge", True),
|
|
||||||
("Configurer la VR",
|
|
||||||
"drivers casque : HTC Vive, Index, Quest…",
|
|
||||||
"fws-vr-setup", True),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
_TERMINALS = ["kitty", "konsole", "gnome-terminal", "xfce4-terminal", "xterm"]
|
_TERMINALS = ["kitty", "konsole", "gnome-terminal", "xfce4-terminal", "xterm"]
|
||||||
@@ -73,7 +65,7 @@ def _run(command, in_terminal):
|
|||||||
|
|
||||||
class HelloWindow(Gtk.Window):
|
class HelloWindow(Gtk.Window):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(title="Bienvenue sur FWS")
|
super().__init__(title=t("hello.window_title"))
|
||||||
self.set_default_size(460, -1)
|
self.set_default_size(460, -1)
|
||||||
self.set_position(Gtk.WindowPosition.CENTER)
|
self.set_position(Gtk.WindowPosition.CENTER)
|
||||||
self.set_border_width(18)
|
self.set_border_width(18)
|
||||||
@@ -87,11 +79,11 @@ class HelloWindow(Gtk.Window):
|
|||||||
self.add(box)
|
self.add(box)
|
||||||
|
|
||||||
title = Gtk.Label()
|
title = Gtk.Label()
|
||||||
title.set_markup("<span size='x-large' weight='bold'>Bienvenue sur FWS !</span>")
|
title.set_markup("<span size='x-large' weight='bold'>"
|
||||||
|
f"{GLib.markup_escape_text(t('hello.title'))}</span>")
|
||||||
box.pack_start(title, False, False, 0)
|
box.pack_start(title, False, False, 0)
|
||||||
|
|
||||||
subtitle = Gtk.Label(
|
subtitle = Gtk.Label(label=t("hello.subtitle"))
|
||||||
label="Ton système est prêt. Quelques réglages utiles pour bien démarrer :")
|
|
||||||
subtitle.set_line_wrap(True)
|
subtitle.set_line_wrap(True)
|
||||||
subtitle.set_xalign(0)
|
subtitle.set_xalign(0)
|
||||||
box.pack_start(subtitle, False, False, 0)
|
box.pack_start(subtitle, False, False, 0)
|
||||||
@@ -101,31 +93,30 @@ class HelloWindow(Gtk.Window):
|
|||||||
# (Hyprland/i3) — les autres bureaux ont leurs propres réglages.
|
# (Hyprland/i3) — les autres bureaux ont leurs propres réglages.
|
||||||
session = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
session = os.environ.get("XDG_CURRENT_DESKTOP", "").lower()
|
||||||
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE") or "i3" in session:
|
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE") or "i3" in session:
|
||||||
actions.append(("Voir les raccourcis clavier",
|
actions.append(("hello.keys_label", "hello.keys_description",
|
||||||
"aussi disponible à tout moment : Super+K",
|
|
||||||
"fws-keys", False))
|
"fws-keys", False))
|
||||||
|
|
||||||
for label, desc, command, in_term in actions:
|
for label, desc, command, in_term in actions:
|
||||||
button = Gtk.Button()
|
button = Gtk.Button()
|
||||||
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)
|
||||||
lab = Gtk.Label()
|
lab = Gtk.Label()
|
||||||
lab.set_markup(f"<b>{label}</b>")
|
lab.set_markup(f"<b>{GLib.markup_escape_text(t(label))}</b>")
|
||||||
lab.set_xalign(0)
|
lab.set_xalign(0)
|
||||||
sub = Gtk.Label(label=desc)
|
sub = Gtk.Label(label=t(desc))
|
||||||
sub.set_xalign(0)
|
sub.set_xalign(0)
|
||||||
sub.get_style_context().add_class("dim-label")
|
sub.get_style_context().add_class("dim-label")
|
||||||
inner.pack_start(lab, False, False, 0)
|
inner.pack_start(lab, False, False, 0)
|
||||||
inner.pack_start(sub, False, False, 0)
|
inner.pack_start(sub, False, False, 0)
|
||||||
button.add(inner)
|
button.add(inner)
|
||||||
button.connect("clicked",
|
button.connect("clicked",
|
||||||
lambda _b, c=command, t=in_term: _run(c, t))
|
lambda _b, c=command, term=in_term: _run(c, term))
|
||||||
box.pack_start(button, False, False, 0)
|
box.pack_start(button, False, False, 0)
|
||||||
|
|
||||||
self._again = Gtk.CheckButton(label="Afficher cette fenêtre au prochain démarrage")
|
self._again = Gtk.CheckButton(label=t("hello.show_again"))
|
||||||
self._again.set_active(False)
|
self._again.set_active(False)
|
||||||
box.pack_start(self._again, False, False, 6)
|
box.pack_start(self._again, False, False, 6)
|
||||||
|
|
||||||
close = Gtk.Button(label="Fermer")
|
close = Gtk.Button(label=t("common.close"))
|
||||||
close.connect("clicked", lambda _b: self.close())
|
close.connect("clicked", lambda _b: self.close())
|
||||||
box.pack_start(close, False, False, 0)
|
box.pack_start(close, False, False, 0)
|
||||||
|
|
||||||
|
|||||||
@@ -13,33 +13,60 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
_catalog = catalog("system")
|
||||||
|
t = _catalog.t
|
||||||
|
|
||||||
_WOFI_STYLE = "/usr/local/share/fws/wofi-keys.css"
|
_WOFI_STYLE = "/usr/local/share/fws/wofi-keys.css"
|
||||||
|
|
||||||
# Bits de modmask Hyprland (masques X11) dans l'ordre d'affichage voulu.
|
# Bits de modmask Hyprland (masques X11) dans l'ordre d'affichage voulu.
|
||||||
_MODS = [(64, "SUPER"), (4, "CTRL"), (8, "ALT"), (1, "SHIFT")]
|
_MODS = [(64, "SUPER"), (4, "CTRL"), (8, "ALT"), (1, "SHIFT")]
|
||||||
|
|
||||||
|
# Key names translated for display (keys of system-translations.toml).
|
||||||
_KEY_LABELS = {
|
_KEY_LABELS = {
|
||||||
"mouse:272": "clic gauche",
|
"mouse:272": "keys.left_click",
|
||||||
"mouse:273": "clic droit",
|
"mouse:273": "keys.right_click",
|
||||||
"mouse:274": "clic molette",
|
"mouse:274": "keys.middle_click",
|
||||||
"mouse_down": "molette bas",
|
"mouse_down": "keys.wheel_down",
|
||||||
"mouse_up": "molette haut",
|
"mouse_up": "keys.wheel_up",
|
||||||
"button4": "molette haut",
|
"button4": "keys.wheel_up",
|
||||||
"button5": "molette bas",
|
"button5": "keys.wheel_down",
|
||||||
"return": "Entrée",
|
"return": "keys.enter",
|
||||||
"space": "Espace",
|
"space": "keys.space",
|
||||||
"escape": "Échap",
|
"escape": "keys.escape",
|
||||||
"tab": "Tab",
|
"tab": "keys.tab",
|
||||||
|
"print": "keys.print_screen",
|
||||||
|
}
|
||||||
|
_KEY_SYMBOLS = {
|
||||||
"left": "←",
|
"left": "←",
|
||||||
"right": "→",
|
"right": "→",
|
||||||
"up": "↑",
|
"up": "↑",
|
||||||
"down": "↓",
|
"down": "↓",
|
||||||
"print": "Impr écran",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _label(key):
|
def _label(key):
|
||||||
return _KEY_LABELS.get(key.lower(), key)
|
name = key.lower()
|
||||||
|
if name in _KEY_LABELS:
|
||||||
|
return t(_KEY_LABELS[name])
|
||||||
|
return _KEY_SYMBOLS.get(name, key)
|
||||||
|
|
||||||
|
|
||||||
|
def _description(bind):
|
||||||
|
"""Description of a Hyprland bind, translated when it is an FWS key.
|
||||||
|
|
||||||
|
The FWS config writes keys (binds.open_terminal) as bindd descriptions:
|
||||||
|
a translated text with a comma in it would break the bind line, so they
|
||||||
|
are translated here instead of in the file. A user's own plain-text
|
||||||
|
description is shown as written.
|
||||||
|
"""
|
||||||
|
desc = (bind.get("description") or "").strip()
|
||||||
|
if desc.startswith("binds.") and _catalog.text(desc) is not None:
|
||||||
|
# The workspace binds share one text: their argument is the number.
|
||||||
|
return t(desc, number=(bind.get("arg") or "").strip())
|
||||||
|
return desc
|
||||||
|
|
||||||
|
|
||||||
# --- Hyprland : binds réels via hyprctl ------------------------------------
|
# --- Hyprland : binds réels via hyprctl ------------------------------------
|
||||||
@@ -54,7 +81,7 @@ def hyprland_lines():
|
|||||||
if not combo or combo in seen:
|
if not combo or combo in seen:
|
||||||
continue
|
continue
|
||||||
seen.add(combo)
|
seen.add(combo)
|
||||||
desc = (bind.get("description") or "").strip() \
|
desc = _description(bind) \
|
||||||
or f"{bind.get('dispatcher', '?')} {(bind.get('arg') or '').strip()}".strip()
|
or f"{bind.get('dispatcher', '?')} {(bind.get('arg') or '').strip()}".strip()
|
||||||
lines.append(f"{combo:<24} {desc}")
|
lines.append(f"{combo:<24} {desc}")
|
||||||
return lines
|
return lines
|
||||||
@@ -94,17 +121,17 @@ def i3_lines():
|
|||||||
|
|
||||||
def show(lines):
|
def show(lines):
|
||||||
if not lines:
|
if not lines:
|
||||||
lines = ["(aucun raccourci trouvé)"]
|
lines = [t("keys.none_found")]
|
||||||
text = "\n".join(lines)
|
text = "\n".join(lines)
|
||||||
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE"):
|
if os.environ.get("HYPRLAND_INSTANCE_SIGNATURE"):
|
||||||
cmd = ["wofi", "--dmenu", "--prompt", "Raccourcis clavier — taper pour filtrer",
|
cmd = ["wofi", "--dmenu", "--prompt", t("keys.prompt_filter"),
|
||||||
"--width", "820", "--height", "600", "--insensitive",
|
"--width", "820", "--height", "600", "--insensitive",
|
||||||
"--cache-file", "/dev/null"]
|
"--cache-file", "/dev/null"]
|
||||||
if os.path.exists(_WOFI_STYLE):
|
if os.path.exists(_WOFI_STYLE):
|
||||||
cmd += ["--style", _WOFI_STYLE]
|
cmd += ["--style", _WOFI_STYLE]
|
||||||
else:
|
else:
|
||||||
# X11/i3 : rofi en dmenu, style assorti (mono pour l'alignement).
|
# X11/i3 : rofi en dmenu, style assorti (mono pour l'alignement).
|
||||||
cmd = ["rofi", "-dmenu", "-i", "-p", "Raccourcis clavier",
|
cmd = ["rofi", "-dmenu", "-i", "-p", t("keys.prompt"),
|
||||||
"-no-custom",
|
"-no-custom",
|
||||||
"-theme-str", 'window { width: 880px; } listview { lines: 18; }',
|
"-theme-str", 'window { width: 880px; } listview { lines: 18; }',
|
||||||
"-theme-str", '* { font: "Noto Sans Mono 11"; }']
|
"-theme-str", '* { font: "Noto Sans Mono 11"; }']
|
||||||
@@ -118,8 +145,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
lines = i3_lines()
|
lines = i3_lines()
|
||||||
except Exception as exc: # noqa: BLE001 — best effort, jamais de crash muet
|
except Exception as exc: # noqa: BLE001 — best effort, jamais de crash muet
|
||||||
subprocess.run(["notify-send", "Raccourcis FWS", f"Erreur : {exc}"],
|
subprocess.run(["notify-send", t("keys.error_title"),
|
||||||
check=False)
|
t("keys.error", error=exc)], check=False)
|
||||||
return 1
|
return 1
|
||||||
show(lines)
|
show(lines)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -9,10 +9,14 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, "/usr/local/lib/fws")
|
||||||
|
from fws_i18n import catalog # noqa: E402
|
||||||
|
|
||||||
|
t = catalog("system").t
|
||||||
|
|
||||||
_WOFI_STYLE = "/usr/local/share/fws/wofi-style.css"
|
_WOFI_STYLE = "/usr/local/share/fws/wofi-style.css"
|
||||||
_HYPR = bool(os.environ.get("HYPRLAND_INSTANCE_SIGNATURE"))
|
_HYPR = bool(os.environ.get("HYPRLAND_INSTANCE_SIGNATURE"))
|
||||||
|
|
||||||
# (libellé affiché, commande shell). L'icône Nerd Font aide au repérage.
|
|
||||||
if _HYPR:
|
if _HYPR:
|
||||||
_lock = "hyprlock"
|
_lock = "hyprlock"
|
||||||
_logout = "hyprctl dispatch exit"
|
_logout = "hyprctl dispatch exit"
|
||||||
@@ -20,24 +24,26 @@ else:
|
|||||||
_lock = "i3lock -c 1e1e2e"
|
_lock = "i3lock -c 1e1e2e"
|
||||||
_logout = "i3-msg exit"
|
_logout = "i3-msg exit"
|
||||||
|
|
||||||
|
# (Nerd Font icon, label key, shell command). The icon stays out of the
|
||||||
|
# translated text: it is the same in every language.
|
||||||
_ITEMS = [
|
_ITEMS = [
|
||||||
(" Verrouiller", _lock),
|
("", "powermenu.lock", _lock),
|
||||||
(" Déconnexion", _logout),
|
("", "powermenu.log_out", _logout),
|
||||||
(" Suspendre", "systemctl suspend"),
|
("", "powermenu.suspend", "systemctl suspend"),
|
||||||
(" Redémarrer", "systemctl reboot"),
|
("", "powermenu.restart", "systemctl reboot"),
|
||||||
(" Éteindre", "systemctl poweroff"),
|
("", "powermenu.shut_down", "systemctl poweroff"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def _menu(entries):
|
def _menu(entries):
|
||||||
text = "\n".join(entries)
|
text = "\n".join(entries)
|
||||||
if _HYPR:
|
if _HYPR:
|
||||||
cmd = ["wofi", "--dmenu", "--prompt", "Alimentation",
|
cmd = ["wofi", "--dmenu", "--prompt", t("powermenu.prompt"),
|
||||||
"--width", "300", "--height", "260", "--cache-file", "/dev/null"]
|
"--width", "300", "--height", "260", "--cache-file", "/dev/null"]
|
||||||
if os.path.exists(_WOFI_STYLE):
|
if os.path.exists(_WOFI_STYLE):
|
||||||
cmd += ["--style", _WOFI_STYLE]
|
cmd += ["--style", _WOFI_STYLE]
|
||||||
else:
|
else:
|
||||||
cmd = ["rofi", "-dmenu", "-i", "-p", "Alimentation", "-no-custom",
|
cmd = ["rofi", "-dmenu", "-i", "-p", t("powermenu.prompt"), "-no-custom",
|
||||||
"-theme-str", "window { width: 300px; } listview { lines: 5; }"]
|
"-theme-str", "window { width: 300px; } listview { lines: 5; }"]
|
||||||
out = subprocess.run(cmd, input=text, text=True,
|
out = subprocess.run(cmd, input=text, text=True,
|
||||||
capture_output=True, check=False)
|
capture_output=True, check=False)
|
||||||
@@ -45,10 +51,13 @@ def _menu(entries):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
choice = _menu([label for label, _ in _ITEMS])
|
# The menu returns the chosen line: it is matched back to its command by
|
||||||
|
# the very labels it was given.
|
||||||
|
items = [(f"{icon} {t(key)}", command) for icon, key, command in _ITEMS]
|
||||||
|
choice = _menu([label for label, _ in items])
|
||||||
if not choice:
|
if not choice:
|
||||||
return 0
|
return 0
|
||||||
for label, command in _ITEMS:
|
for label, command in items:
|
||||||
if label == choice:
|
if label == choice:
|
||||||
subprocess.Popen(["sh", "-c", command]) # noqa: S603,S607
|
subprocess.Popen(["sh", "-c", command]) # noqa: S603,S607
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -3,44 +3,44 @@
|
|||||||
# meilleure compatibilité des jeux Windows que le Proton officiel.
|
# meilleure compatibilité des jeux Windows que le Proton officiel.
|
||||||
# S'exécute en UTILISATEUR (installe dans ~/.steam/root/compatibilitytools.d).
|
# S'exécute en UTILISATEUR (installe dans ~/.steam/root/compatibilitytools.d).
|
||||||
set -u
|
set -u
|
||||||
|
. /usr/local/lib/fws/i18n.sh proton common
|
||||||
say() { printf '\n\033[1;34m==> %s\033[0m\n' "$*"; }
|
say() { printf '\n\033[1;34m==> %s\033[0m\n' "$*"; }
|
||||||
fail() { printf '\033[1;31m ✗ %s\033[0m\n' "$*"; read -rp "Entrée pour fermer. " _; exit 1; }
|
fail() { printf '\033[1;31m ✗ %s\033[0m\n' "$*"; read -rp "$(t common.press_enter_to_close) " _; exit 1; }
|
||||||
|
|
||||||
[ "$(id -u)" -eq 0 ] && fail "à lancer en utilisateur normal (pas root) : l'outil s'installe dans ton Steam."
|
[ "$(id -u)" -eq 0 ] && fail "$(t proton.not_as_root)"
|
||||||
|
|
||||||
API="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest"
|
API="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest"
|
||||||
DEST="$HOME/.steam/root/compatibilitytools.d"
|
DEST="$HOME/.steam/root/compatibilitytools.d"
|
||||||
|
|
||||||
say "Recherche de la dernière version de Proton-GE…"
|
say "$(t proton.looking_up_latest)"
|
||||||
JSON="$(curl -fsSL "$API")" || fail "GitHub inaccessible (réseau ?)"
|
JSON="$(curl -fsSL "$API")" || fail "$(t proton.github_unreachable)"
|
||||||
URL="$(printf '%s' "$JSON" | grep -o '"browser_download_url": *"[^"]*\.tar\.gz"' | cut -d'"' -f4 | head -1)"
|
URL="$(printf '%s' "$JSON" | grep -o '"browser_download_url": *"[^"]*\.tar\.gz"' | cut -d'"' -f4 | head -1)"
|
||||||
SUM_URL="$(printf '%s' "$JSON" | grep -o '"browser_download_url": *"[^"]*\.sha512sum"' | cut -d'"' -f4 | head -1)"
|
SUM_URL="$(printf '%s' "$JSON" | grep -o '"browser_download_url": *"[^"]*\.sha512sum"' | cut -d'"' -f4 | head -1)"
|
||||||
[ -n "$URL" ] || fail "archive introuvable dans la release GitHub"
|
[ -n "$URL" ] || fail "$(t proton.archive_not_found)"
|
||||||
NAME="$(basename "$URL" .tar.gz)"
|
NAME="$(basename "$URL" .tar.gz)"
|
||||||
|
|
||||||
if [ -d "$DEST/$NAME" ]; then
|
if [ -d "$DEST/$NAME" ]; then
|
||||||
say "$NAME est déjà installé ✔"
|
say "$(t proton.already_installed name="$NAME")"
|
||||||
read -rp "Entrée pour fermer. " _; exit 0
|
read -rp "$(t common.press_enter_to_close) " _; exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TMP="$(mktemp -d)"
|
TMP="$(mktemp -d)"
|
||||||
trap 'rm -rf "$TMP"' EXIT
|
trap 'rm -rf "$TMP"' EXIT
|
||||||
say "Téléchargement de $NAME (~450 Mo)…"
|
say "$(t proton.downloading name="$NAME")"
|
||||||
curl -fL --progress-bar -o "$TMP/$NAME.tar.gz" "$URL" || fail "téléchargement échoué"
|
curl -fL --progress-bar -o "$TMP/$NAME.tar.gz" "$URL" || fail "$(t proton.download_failed)"
|
||||||
|
|
||||||
if [ -n "$SUM_URL" ]; then
|
if [ -n "$SUM_URL" ]; then
|
||||||
say "Vérification de l'intégrité (sha512)…"
|
say "$(t proton.verifying)"
|
||||||
curl -fsSL -o "$TMP/sum" "$SUM_URL" \
|
curl -fsSL -o "$TMP/sum" "$SUM_URL" \
|
||||||
&& (cd "$TMP" && sed "s|[^ ]*\.tar\.gz|$NAME.tar.gz|" sum | sha512sum -c -) \
|
&& (cd "$TMP" && sed "s|[^ ]*\.tar\.gz|$NAME.tar.gz|" sum | sha512sum -c -) \
|
||||||
|| fail "somme de contrôle invalide — archive corrompue ?"
|
|| fail "$(t proton.checksum_invalid)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
say "Installation dans $DEST…"
|
say "$(t proton.installing_into folder="$DEST")"
|
||||||
mkdir -p "$DEST"
|
mkdir -p "$DEST"
|
||||||
tar -xzf "$TMP/$NAME.tar.gz" -C "$DEST" || fail "extraction échouée"
|
tar -xzf "$TMP/$NAME.tar.gz" -C "$DEST" || fail "$(t proton.extraction_failed)"
|
||||||
|
|
||||||
say "$NAME installé ✔"
|
say "$(t proton.installed name="$NAME")"
|
||||||
echo " Dans Steam : Paramètres → Compatibilité → activer, puis choisir"
|
# The texts carry their own line breaks: sed indents every line.
|
||||||
echo " « $NAME » (ou par jeu : Propriétés → Compatibilité)."
|
printf '%s\n' "$(t proton.how_to_enable name="$NAME")" "$(t proton.restart_steam)" | sed 's/^/ /'
|
||||||
echo " Redémarre Steam pour qu'il apparaisse."
|
read -rp "$(t common.press_enter_to_close) " _
|
||||||
read -rp "Entrée pour fermer. " _
|
|
||||||
@@ -33,6 +33,11 @@ WANTED=""
|
|||||||
|
|
||||||
usage() { sed -n '3,18p' "$0" | sed 's/^# \{0,1\}//'; }
|
usage() { sed -n '3,18p' "$0" | sed 's/^# \{0,1\}//'; }
|
||||||
|
|
||||||
|
# Texts in the language of the environment (hardware.* keys). Like every step
|
||||||
|
# here, a missing helper must not stop the engine: t then prints the keys.
|
||||||
|
[ -r /usr/local/lib/fws/i18n.sh ] && . /usr/local/lib/fws/i18n.sh hardware
|
||||||
|
declare -F t >/dev/null || t() { printf '%s' "$1"; }
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--plan) MODE="plan" ;;
|
--plan) MODE="plan" ;;
|
||||||
@@ -41,19 +46,22 @@ while [ $# -gt 0 ]; do
|
|||||||
--unattended) MODE="unattended" ;;
|
--unattended) MODE="unattended" ;;
|
||||||
--groups) MODE="groups"; WANTED="$2"; shift ;;
|
--groups) MODE="groups"; WANTED="$2"; shift ;;
|
||||||
-h|--help) usage; exit 0 ;;
|
-h|--help) usage; exit 0 ;;
|
||||||
-*) echo "option inconnue : $1" >&2; exit 2 ;;
|
-*) echo "$(t hardware.unknown_option option="$1")" >&2; exit 2 ;;
|
||||||
*) DESK="$1" ;;
|
*) DESK="$1" ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
log() { echo "[FWS-hw] $*"; }
|
log() { echo "[FWS-hw] $*"; }
|
||||||
|
# A step that fws-drivers shows in its status line: the window reads the step
|
||||||
|
# name in the tag ("[FWS-hw:install] …"), never the text, which is translated.
|
||||||
|
step() { local name="$1"; shift; echo "[FWS-hw:$name] $*"; }
|
||||||
ok() { echo " ✔ $*"; }
|
ok() { echo " ✔ $*"; }
|
||||||
ko() { echo " ✘ $*"; }
|
ko() { echo " ✘ $*"; }
|
||||||
|
|
||||||
# Les installations et les activations de services exigent root ; « --plan » non.
|
# Les installations et les activations de services exigent root ; « --plan » non.
|
||||||
if [ "$MODE" != "plan" ] && [ "$(id -u)" -ne 0 ]; then
|
if [ "$MODE" != "plan" ] && [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "Ce script doit être lancé en root (sudo fws-setup-hardware …)" >&2
|
echo "$(t hardware.needs_root)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -125,7 +133,7 @@ if printf '%s' "$GPU" | grep -qiE 'NVIDIA|GeForce'; then
|
|||||||
# prendre la main, alors qu'une carte récente sans module propriétaire est
|
# prendre la main, alors qu'une carte récente sans module propriétaire est
|
||||||
# tout simplement inutilisable.
|
# tout simplement inutilisable.
|
||||||
if [ "$_NEWEST" -eq 0 ] || [ "$_NEWEST" -ge $((16#1E00)) ]; then
|
if [ "$_NEWEST" -eq 0 ] || [ "$_NEWEST" -ge $((16#1E00)) ]; then
|
||||||
GPU_NOTE="NVIDIA 0x$(printf '%04x' "$_NEWEST") → modules ouverts (Turing ou plus récent)"
|
GPU_NOTE="$(t hardware.note_nvidia_open device="NVIDIA 0x$(printf '%04x' "$_NEWEST")")"
|
||||||
# libva-nvidia-driver : le pilote VA-API (décodage vidéo matériel) —
|
# libva-nvidia-driver : le pilote VA-API (décodage vidéo matériel) —
|
||||||
# nvidia-utils ne fournit que le VDPAU historique ; sans ce paquet,
|
# nvidia-utils ne fournit que le VDPAU historique ; sans ce paquet,
|
||||||
# Firefox/Chrome et les lecteurs décodent en CPU et saccadent en 4K.
|
# Firefox/Chrome et les lecteurs décodent en CPU et saccadent en 4K.
|
||||||
@@ -138,7 +146,7 @@ if printf '%s' "$GPU" | grep -qiE 'NVIDIA|GeForce'; then
|
|||||||
printf '%s' "$GPU" | grep -qiE '\bIntel\b|\bAMD\b|\bATI\b' \
|
printf '%s' "$GPU" | grep -qiE '\bIntel\b|\bAMD\b|\bATI\b' \
|
||||||
&& GPU_PKGS="$GPU_PKGS nvidia-prime"
|
&& GPU_PKGS="$GPU_PKGS nvidia-prime"
|
||||||
else
|
else
|
||||||
GPU_NOTE="NVIDIA 0x$(printf '%04x' "$_NEWEST") antérieure à Turing → nouveau (pilote libre)"
|
GPU_NOTE="$(t hardware.note_nvidia_nouveau device="NVIDIA 0x$(printf '%04x' "$_NEWEST")")"
|
||||||
GPU_PKGS="$GPU_PKGS xf86-video-nouveau"
|
GPU_PKGS="$GPU_PKGS xf86-video-nouveau"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -162,7 +170,7 @@ if printf '%s' "$GPU" | grep -qi '\bIntel\b'; then
|
|||||||
[ "$LIB32" = 1 ] && GPU_PKGS="$GPU_PKGS lib32-vulkan-intel"
|
[ "$LIB32" = 1 ] && GPU_PKGS="$GPU_PKGS lib32-vulkan-intel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
group gpu "Pilotes graphiques${GPU_NOTE:+ — $GPU_NOTE}" 1 $GPU_PKGS
|
group gpu "$(t hardware.group_gpu)${GPU_NOTE:+ — $GPU_NOTE}" 1 $GPU_PKGS
|
||||||
|
|
||||||
# ── 1bis) Réseau sans fil ───────────────────────────────────────────────────
|
# ── 1bis) Réseau sans fil ───────────────────────────────────────────────────
|
||||||
# linux-firmware couvre Intel, Atheros, Realtek et les Broadcom FullMAC
|
# linux-firmware couvre Intel, Atheros, Realtek et les Broadcom FullMAC
|
||||||
@@ -196,18 +204,18 @@ WIFI_IFACE="$(wifi_iface)"
|
|||||||
if [ -n "$WIFI_HW" ]; then
|
if [ -n "$WIFI_HW" ]; then
|
||||||
WIFI_DETECT=1
|
WIFI_DETECT=1
|
||||||
if [ -n "$WIFI_IFACE" ]; then
|
if [ -n "$WIFI_IFACE" ]; then
|
||||||
WIFI_NOTE="interface $WIFI_IFACE reconnue par le noyau"
|
WIFI_NOTE="$(t hardware.note_wifi_interface interface="$WIFI_IFACE")"
|
||||||
elif printf '%s' "$WIFI_HW" | grep -qi 'Broadcom'; then
|
elif printf '%s' "$WIFI_HW" | grep -qi 'Broadcom'; then
|
||||||
WIFI_NOTE="Broadcom muette → pilote propriétaire wl"
|
WIFI_NOTE="$(t hardware.note_wifi_broadcom)"
|
||||||
# dkms + linux-headers : broadcom-wl-dkms compile son module à
|
# dkms + linux-headers : broadcom-wl-dkms compile son module à
|
||||||
# l'installation ET à chaque mise à jour du noyau.
|
# l'installation ET à chaque mise à jour du noyau.
|
||||||
WIFI_PKGS="$WIFI_PKGS broadcom-wl-dkms linux-headers dkms"
|
WIFI_PKGS="$WIFI_PKGS broadcom-wl-dkms linux-headers dkms"
|
||||||
BROADCOM_WL=1
|
BROADCOM_WL=1
|
||||||
else
|
else
|
||||||
WIFI_NOTE="contrôleur sans interface — micrologiciel manquant ?"
|
WIFI_NOTE="$(t hardware.note_wifi_no_interface)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
group wifi "Réseau sans fil${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_PKGS
|
group wifi "$(t hardware.group_wifi)${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_PKGS
|
||||||
|
|
||||||
# ── 2) Son ──────────────────────────────────────────────────────────────────
|
# ── 2) Son ──────────────────────────────────────────────────────────────────
|
||||||
# PipeWire est le serveur audio, PAS PulseAudio : « pipewire-pulse » est la
|
# PipeWire est le serveur audio, PAS PulseAudio : « pipewire-pulse » est la
|
||||||
@@ -215,7 +223,7 @@ group wifi "Réseau sans fil${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_
|
|||||||
# les modules volume de waybar/polybar fonctionnent) et elle est en conflit
|
# les modules volume de waybar/polybar fonctionnent) et elle est en conflit
|
||||||
# pacman avec le vrai paquet pulseaudio — il ne peut pas s'installer.
|
# pacman avec le vrai paquet pulseaudio — il ne peut pas s'installer.
|
||||||
# alsa-firmware/alsa-plugins : codecs et cartes muets sans eux.
|
# alsa-firmware/alsa-plugins : codecs et cartes muets sans eux.
|
||||||
group audio "Son et micro (PipeWire)" 1 \
|
group audio "$(t hardware.group_audio)" 1 \
|
||||||
pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber \
|
pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber \
|
||||||
pavucontrol alsa-utils alsa-firmware alsa-plugins realtime-privileges
|
pavucontrol alsa-utils alsa-firmware alsa-plugins realtime-privileges
|
||||||
|
|
||||||
@@ -225,17 +233,17 @@ BT_DETECT=0
|
|||||||
BT_PKGS="bluez bluez-utils"
|
BT_PKGS="bluez bluez-utils"
|
||||||
# KDE et GNOME ont leur propre gestionnaire ; blueman pour les autres bureaux.
|
# KDE et GNOME ont leur propre gestionnaire ; blueman pour les autres bureaux.
|
||||||
case "$DESK" in hyprland|xfce|i3) BT_PKGS="$BT_PKGS blueman" ;; esac
|
case "$DESK" in hyprland|xfce|i3) BT_PKGS="$BT_PKGS blueman" ;; esac
|
||||||
group bluetooth "Bluetooth" "$BT_DETECT" $BT_PKGS
|
group bluetooth "$(t hardware.group_bluetooth)" "$BT_DETECT" $BT_PKGS
|
||||||
|
|
||||||
# ── 4) Luminosité ───────────────────────────────────────────────────────────
|
# ── 4) Luminosité ───────────────────────────────────────────────────────────
|
||||||
# brightnessctl règle la luminosité sans root (via logind) — utilisé par les
|
# brightnessctl règle la luminosité sans root (via logind) — utilisé par les
|
||||||
# touches XF86MonBrightness* et le module backlight de waybar/polybar.
|
# touches XF86MonBrightness* et le module backlight de waybar/polybar.
|
||||||
BL_DETECT=0
|
BL_DETECT=0
|
||||||
[ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ] && BL_DETECT=1
|
[ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ] && BL_DETECT=1
|
||||||
group brightness "Luminosité de l'écran" "$BL_DETECT" brightnessctl
|
group brightness "$(t hardware.group_brightness)" "$BL_DETECT" brightnessctl
|
||||||
|
|
||||||
# ── 5) Codecs multimédia ────────────────────────────────────────────────────
|
# ── 5) Codecs multimédia ────────────────────────────────────────────────────
|
||||||
group codecs "Codecs audio et vidéo" "$GRAPHICAL" \
|
group codecs "$(t hardware.group_codecs)" "$GRAPHICAL" \
|
||||||
gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly \
|
gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly \
|
||||||
gst-libav ffmpeg mpv
|
gst-libav ffmpeg mpv
|
||||||
|
|
||||||
@@ -256,21 +264,21 @@ done
|
|||||||
# déclarer une imprimante sur absolument toutes les machines.
|
# déclarer une imprimante sur absolument toutes les machines.
|
||||||
[ "$PRINT_DETECT" = 0 ] && ls -d /sys/class/parport/parport* >/dev/null 2>&1 && PRINT_DETECT=1
|
[ "$PRINT_DETECT" = 0 ] && ls -d /sys/class/parport/parport* >/dev/null 2>&1 && PRINT_DETECT=1
|
||||||
[ "$PRINT_DETECT" = 0 ] && [ -s /etc/cups/printers.conf ] && PRINT_DETECT=1
|
[ "$PRINT_DETECT" = 0 ] && [ -s /etc/cups/printers.conf ] && PRINT_DETECT=1
|
||||||
group printing "Imprimantes et scanners" "$PRINT_DETECT" \
|
group printing "$(t hardware.group_printing)" "$PRINT_DETECT" \
|
||||||
cups cups-filters cups-pdf gutenprint foomatic-db foomatic-db-engine \
|
cups cups-filters cups-pdf gutenprint foomatic-db foomatic-db-engine \
|
||||||
system-config-printer sane avahi nss-mdns
|
system-config-printer sane avahi nss-mdns
|
||||||
|
|
||||||
# ── 7) Jeux ─────────────────────────────────────────────────────────────────
|
# ── 7) Jeux ─────────────────────────────────────────────────────────────────
|
||||||
# mangohud : overlay FPS/perfs en jeu (mangohud %command% dans Steam).
|
# mangohud : overlay FPS/perfs en jeu (mangohud %command% dans Steam).
|
||||||
group gaming "Jeux (Steam, Wine, Proton)" "$GRAPHICAL" \
|
group gaming "$(t hardware.group_gaming)" "$GRAPHICAL" \
|
||||||
steam wine winetricks wine-mono wine-gecko lib32-pipewire \
|
steam wine winetricks wine-mono wine-gecko lib32-pipewire \
|
||||||
gamemode lib32-gamemode mangohud lib32-mangohud \
|
gamemode lib32-gamemode mangohud lib32-mangohud \
|
||||||
noto-fonts ttf-liberation
|
noto-fonts ttf-liberation
|
||||||
|
|
||||||
# ── 8) Réalité virtuelle ────────────────────────────────────────────────────
|
# ── 8) Réalité virtuelle ────────────────────────────────────────────────────
|
||||||
# Monado/OpenXR → SteamVR pour HTC Vive et Valve Index ; Oculus/Meta n'a pas de
|
# Monado/OpenXR → SteamVR pour HTC Vive et Valve Index ; Oculus/Meta n'a pas de
|
||||||
# support Linux officiel (fws-vr-setup l'explique et propose ALVR pour Quest).
|
# support Linux officiel (streaming Wi-Fi via ALVR, hors dépôts Arch).
|
||||||
group vr "Réalité virtuelle (OpenXR, Monado)" "$GRAPHICAL" monado
|
group vr "$(t hardware.group_vr)" "$GRAPHICAL" monado
|
||||||
|
|
||||||
# ── 9) Outils invité de virtualisation ──────────────────────────────────────
|
# ── 9) Outils invité de virtualisation ──────────────────────────────────────
|
||||||
VM_PKGS=""; VMSVC=""; VM_DETECT=0
|
VM_PKGS=""; VMSVC=""; VM_DETECT=0
|
||||||
@@ -280,11 +288,11 @@ case "$(systemd-detect-virt 2>/dev/null)" in
|
|||||||
qemu|kvm) VM_PKGS="qemu-guest-agent spice-vdagent"; VMSVC="qemu-guest-agent spice-vdagentd"; VM_DETECT=1 ;;
|
qemu|kvm) VM_PKGS="qemu-guest-agent spice-vdagent"; VMSVC="qemu-guest-agent spice-vdagentd"; VM_DETECT=1 ;;
|
||||||
microsoft) VM_PKGS="hyperv"; VMSVC="hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon"; VM_DETECT=1 ;;
|
microsoft) VM_PKGS="hyperv"; VMSVC="hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon"; VM_DETECT=1 ;;
|
||||||
esac
|
esac
|
||||||
[ -n "$VM_PKGS" ] && group vm "Outils invité de la machine virtuelle" "$VM_DETECT" $VM_PKGS
|
[ -n "$VM_PKGS" ] && group vm "$(t hardware.group_vm)" "$VM_DETECT" $VM_PKGS
|
||||||
|
|
||||||
# ── 10) Conteneurs ──────────────────────────────────────────────────────────
|
# ── 10) Conteneurs ──────────────────────────────────────────────────────────
|
||||||
# Moteur de conteneurs sans démon : applications isolées (Distrobox, images OCI).
|
# Moteur de conteneurs sans démon : applications isolées (Distrobox, images OCI).
|
||||||
group containers "Conteneurs (Podman)" 1 podman
|
group containers "$(t hardware.group_containers)" 1 podman
|
||||||
|
|
||||||
# ── Groupes À LA DEMANDE ────────────────────────────────────────────────────
|
# ── Groupes À LA DEMANDE ────────────────────────────────────────────────────
|
||||||
# Ces groupes sont PERTINENTS (donc détectés, donc pré-cochés dans l'installation
|
# Ces groupes sont PERTINENTS (donc détectés, donc pré-cochés dans l'installation
|
||||||
@@ -306,6 +314,8 @@ is_ondemand() {
|
|||||||
# ── Mode « plan » : lister et sortir ────────────────────────────────────────
|
# ── Mode « plan » : lister et sortir ────────────────────────────────────────
|
||||||
# Format volontairement tabulé pour être lu par fws-drivers :
|
# Format volontairement tabulé pour être lu par fws-drivers :
|
||||||
# id <TAB> détecté <TAB> libellé <TAB> paquets
|
# id <TAB> détecté <TAB> libellé <TAB> paquets
|
||||||
|
# The label is already in the language of the environment: the window, which
|
||||||
|
# runs this as the same user, shows it as is.
|
||||||
if [ "$MODE" = "plan" ]; then
|
if [ "$MODE" = "plan" ]; then
|
||||||
for id in "${ORDER[@]}"; do
|
for id in "${ORDER[@]}"; do
|
||||||
printf '%s\t%s\t%s\t%s\n' \
|
printf '%s\t%s\t%s\t%s\n' \
|
||||||
@@ -337,7 +347,7 @@ case "$MODE" in
|
|||||||
if [ -n "${G_LABEL[$id]:-}" ]; then
|
if [ -n "${G_LABEL[$id]:-}" ]; then
|
||||||
SELECTED+=("$id")
|
SELECTED+=("$id")
|
||||||
else
|
else
|
||||||
log "groupe inconnu, ignoré : $id"
|
log "$(t hardware.unknown_group group="$id")"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -357,11 +367,11 @@ selected_has() {
|
|||||||
if [ "${#SELECTED[@]}" -gt 0 ]; then
|
if [ "${#SELECTED[@]}" -gt 0 ]; then
|
||||||
WANTED_PKGS=""
|
WANTED_PKGS=""
|
||||||
for id in "${SELECTED[@]}"; do
|
for id in "${SELECTED[@]}"; do
|
||||||
log "groupe « ${G_LABEL[$id]} »"
|
log "$(t hardware.group_selected group="${G_LABEL[$id]}")"
|
||||||
WANTED_PKGS="$WANTED_PKGS ${G_PKGS[$id]}"
|
WANTED_PKGS="$WANTED_PKGS ${G_PKGS[$id]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
pacman -Sy --noconfirm || log "synchro pacman échouée (réseau ?)"
|
pacman -Sy --noconfirm || log "$(t hardware.sync_failed)"
|
||||||
|
|
||||||
# Filtre aux paquets RÉELLEMENT existants : un nom manquant ou renommé ne
|
# Filtre aux paquets RÉELLEMENT existants : un nom manquant ou renommé ne
|
||||||
# doit pas faire échouer toute la transaction. Les absents sont NOMMÉS —
|
# doit pas faire échouer toute la transaction. Les absents sont NOMMÉS —
|
||||||
@@ -374,9 +384,9 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then
|
|||||||
MISSING="$MISSING $p"
|
MISSING="$MISSING $p"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ -n "$MISSING" ] && log "AVERTISSEMENT : paquets introuvables dans les dépôts :$MISSING"
|
[ -n "$MISSING" ] && log "$(t hardware.packages_not_found packages="${MISSING# }")"
|
||||||
if [ -n "$VALID" ]; then
|
if [ -n "$VALID" ]; then
|
||||||
log "installation :$VALID"
|
step install "$(t hardware.installing_packages packages="${VALID# }")"
|
||||||
if pacman -S --noconfirm --needed $VALID; then
|
if pacman -S --noconfirm --needed $VALID; then
|
||||||
# polices : le cache fontconfig doit inclure la police emoji qui
|
# polices : le cache fontconfig doit inclure la police emoji qui
|
||||||
# vient d'être installée, sinon les applications déjà lancées ne la
|
# vient d'être installée, sinon les applications déjà lancées ne la
|
||||||
@@ -401,17 +411,16 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then
|
|||||||
done
|
done
|
||||||
if [ -n "$_pending" ]; then
|
if [ -n "$_pending" ]; then
|
||||||
rm -f /var/lib/fws/hardware-done
|
rm -f /var/lib/fws/hardware-done
|
||||||
log "reste à proposer à l'utilisateur :$_pending"
|
log "$(t hardware.pending_groups groups="${_pending# }")"
|
||||||
log "« Pilotes et matériel » s'ouvrira au premier démarrage"
|
log "$(t hardware.drivers_will_open)"
|
||||||
else
|
else
|
||||||
install -d /var/lib/fws
|
install -d /var/lib/fws
|
||||||
printf '%s groupes=%s\n' "$(date -Is)" "${SELECTED[*]}" \
|
printf '%s groupes=%s\n' "$(date -Is)" "${SELECTED[*]}" \
|
||||||
> /var/lib/fws/hardware-done
|
> /var/lib/fws/hardware-done
|
||||||
log "mise en route matérielle enregistrée (/var/lib/fws/hardware-done)"
|
log "$(t hardware.setup_recorded path=/var/lib/fws/hardware-done)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "certains paquets n'ont pas été installés — la fenêtre « Pilotes et matériel »"
|
log "$(t hardware.install_incomplete)"
|
||||||
log "s'ouvrira au premier démarrage pour terminer"
|
|
||||||
rm -f /var/lib/fws/hardware-done
|
rm -f /var/lib/fws/hardware-done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -429,19 +438,19 @@ _wifi_selected=0
|
|||||||
for id in "${SELECTED[@]}"; do [ "$id" = wifi ] && _wifi_selected=1; done
|
for id in "${SELECTED[@]}"; do [ "$id" = wifi ] && _wifi_selected=1; done
|
||||||
if [ "$BROADCOM_WL" = 1 ] && [ "$_wifi_selected" = 1 ]; then
|
if [ "$BROADCOM_WL" = 1 ] && [ "$_wifi_selected" = 1 ]; then
|
||||||
if pacman -Qq broadcom-wl-dkms >/dev/null 2>&1; then
|
if pacman -Qq broadcom-wl-dkms >/dev/null 2>&1; then
|
||||||
log "wi-fi Broadcom : pilote wl déjà installé"
|
log "$(t hardware.broadcom_already_installed)"
|
||||||
else
|
else
|
||||||
_WL_PKG="$(ls /usr/local/share/fws/drivers/broadcom-wl-dkms-*.pkg.tar.* 2>/dev/null | head -1)"
|
_WL_PKG="$(ls /usr/local/share/fws/drivers/broadcom-wl-dkms-*.pkg.tar.* 2>/dev/null | head -1)"
|
||||||
if [ -z "$_WL_PKG" ]; then
|
if [ -z "$_WL_PKG" ]; then
|
||||||
log "wi-fi Broadcom : pilote wl introuvable (ni dépôts, ni image)"
|
log "$(t hardware.broadcom_not_found)"
|
||||||
elif pacman -U --noconfirm "$_WL_PKG"; then
|
elif pacman -U --noconfirm "$_WL_PKG"; then
|
||||||
log "wi-fi Broadcom : pilote wl installé — redémarre pour l'activer"
|
log "$(t hardware.broadcom_installed)"
|
||||||
rm -f "$_WL_PKG"
|
rm -f "$_WL_PKG"
|
||||||
else
|
else
|
||||||
# dkms et linux-headers ne sont PAS dans l'image : sans réseau,
|
# dkms et linux-headers ne sont PAS dans l'image : sans réseau,
|
||||||
# « -U » échoue sur les dépendances. On le dit au lieu de laisser
|
# « -U » échoue sur les dépendances. On le dit au lieu de laisser
|
||||||
# croire que la carte est définitivement morte.
|
# croire que la carte est définitivement morte.
|
||||||
log "wi-fi Broadcom : échec — dkms/linux-headers manquants (réseau requis)"
|
log "$(t hardware.broadcom_failed)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -455,14 +464,14 @@ fi
|
|||||||
# Jouée après une installation, et seule avec « --check ». Chaque contrôle est
|
# Jouée après une installation, et seule avec « --check ». Chaque contrôle est
|
||||||
# idempotent : on peut la relancer autant de fois qu'on veut.
|
# idempotent : on peut la relancer autant de fois qu'on veut.
|
||||||
echo
|
echo
|
||||||
log "vérification des services et des connexions"
|
step check "$(t hardware.checking_services)"
|
||||||
|
|
||||||
# --- Réseau -----------------------------------------------------------------
|
# --- Réseau -----------------------------------------------------------------
|
||||||
if systemctl is-enabled NetworkManager.service >/dev/null 2>&1; then
|
if systemctl is-enabled NetworkManager.service >/dev/null 2>&1; then
|
||||||
ok "NetworkManager activé"
|
ok "$(t hardware.networkmanager_enabled)"
|
||||||
else
|
else
|
||||||
systemctl enable --now NetworkManager.service >/dev/null 2>&1 \
|
systemctl enable --now NetworkManager.service >/dev/null 2>&1 \
|
||||||
&& ok "NetworkManager activé (réparé)" || ko "NetworkManager : activation impossible"
|
&& ok "$(t hardware.networkmanager_repaired)" || ko "$(t hardware.networkmanager_failed)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Son --------------------------------------------------------------------
|
# --- Son --------------------------------------------------------------------
|
||||||
@@ -478,8 +487,8 @@ if selected_has audio; then
|
|||||||
# Une unité par appel : groupées, un seul échec en masquerait les autres.
|
# Une unité par appel : groupées, un seul échec en masquerait les autres.
|
||||||
for u in pipewire.socket pipewire-pulse.socket wireplumber.service; do
|
for u in pipewire.socket pipewire-pulse.socket wireplumber.service; do
|
||||||
systemctl --global enable "$u" >/dev/null 2>&1 \
|
systemctl --global enable "$u" >/dev/null 2>&1 \
|
||||||
&& ok "son : $u activé pour toutes les sessions" \
|
&& ok "$(t hardware.audio_unit_enabled unit="$u")" \
|
||||||
|| ko "son : activation de $u impossible"
|
|| ko "$(t hardware.audio_unit_failed unit="$u")"
|
||||||
done
|
done
|
||||||
# Priorité temps réel : contre les craquements et les coupures sous charge.
|
# Priorité temps réel : contre les craquements et les coupures sous charge.
|
||||||
if getent group realtime >/dev/null 2>&1; then
|
if getent group realtime >/dev/null 2>&1; then
|
||||||
@@ -487,7 +496,7 @@ if selected_has audio; then
|
|||||||
[ "$uid" -ge 1000 ] && [ "$uid" -le 60000 ] \
|
[ "$uid" -ge 1000 ] && [ "$uid" -le 60000 ] \
|
||||||
&& usermod -aG realtime "$u" 2>/dev/null
|
&& usermod -aG realtime "$u" 2>/dev/null
|
||||||
done < /etc/passwd
|
done < /etc/passwd
|
||||||
ok "son : comptes humains ajoutés au groupe realtime"
|
ok "$(t hardware.audio_realtime_group)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -495,41 +504,42 @@ fi
|
|||||||
if selected_has bluetooth; then
|
if selected_has bluetooth; then
|
||||||
# rfkill d'abord : un contrôleur bloqué au niveau noyau ne répondra à
|
# rfkill d'abord : un contrôleur bloqué au niveau noyau ne répondra à
|
||||||
# aucune commande, et c'est l'état par défaut sur pas mal de portables.
|
# aucune commande, et c'est l'état par défaut sur pas mal de portables.
|
||||||
rfkill unblock bluetooth 2>/dev/null && ok "bluetooth : radio débloquée"
|
rfkill unblock bluetooth 2>/dev/null && ok "$(t hardware.bluetooth_unblocked)"
|
||||||
if systemctl enable --now bluetooth.service >/dev/null 2>&1; then
|
if systemctl enable --now bluetooth.service >/dev/null 2>&1; then
|
||||||
ok "bluetooth : service activé"
|
ok "$(t hardware.bluetooth_service_enabled)"
|
||||||
# Contrôleur allumé + appairages retrouvés au démarrage.
|
# Contrôleur allumé + appairages retrouvés au démarrage.
|
||||||
printf 'power on\n' | timeout 10 bluetoothctl >/dev/null 2>&1 \
|
printf 'power on\n' | timeout 10 bluetoothctl >/dev/null 2>&1 \
|
||||||
&& ok "bluetooth : contrôleur allumé" \
|
&& ok "$(t hardware.bluetooth_powered_on)" \
|
||||||
|| ko "bluetooth : contrôleur injoignable (aucun adaptateur ?)"
|
|| ko "$(t hardware.bluetooth_unreachable)"
|
||||||
else
|
else
|
||||||
ko "bluetooth : service indisponible"
|
ko "$(t hardware.bluetooth_service_unavailable)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Impression -------------------------------------------------------------
|
# --- Impression -------------------------------------------------------------
|
||||||
if selected_has printing; then
|
if selected_has printing; then
|
||||||
systemctl enable --now cups.service >/dev/null 2>&1 \
|
systemctl enable --now cups.service >/dev/null 2>&1 \
|
||||||
&& ok "impression : cups activé" || ko "impression : cups indisponible"
|
&& ok "$(t hardware.printing_cups_enabled)" || ko "$(t hardware.printing_cups_unavailable)"
|
||||||
# Découverte des imprimantes réseau (mDNS) : avahi + résolution .local.
|
# Découverte des imprimantes réseau (mDNS) : avahi + résolution .local.
|
||||||
systemctl enable --now avahi-daemon.service >/dev/null 2>&1 \
|
systemctl enable --now avahi-daemon.service >/dev/null 2>&1 \
|
||||||
&& ok "impression : découverte réseau (avahi) activée" || true
|
&& ok "$(t hardware.printing_discovery_enabled)" || true
|
||||||
if [ -f /etc/nsswitch.conf ] && ! grep -q 'mdns' /etc/nsswitch.conf; then
|
if [ -f /etc/nsswitch.conf ] && ! grep -q 'mdns' /etc/nsswitch.conf; then
|
||||||
sed -i 's/^hosts:.*/& mdns_minimal [NOTFOUND=return]/' /etc/nsswitch.conf \
|
sed -i 's/^hosts:.*/& mdns_minimal [NOTFOUND=return]/' /etc/nsswitch.conf \
|
||||||
&& ok "impression : résolution .local ajoutée à nsswitch.conf"
|
&& ok "$(t hardware.printing_local_names_added)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Conteneurs -------------------------------------------------------------
|
# --- Conteneurs -------------------------------------------------------------
|
||||||
if selected_has containers; then
|
if selected_has containers; then
|
||||||
systemctl enable podman.socket >/dev/null 2>&1 \
|
systemctl enable podman.socket >/dev/null 2>&1 \
|
||||||
&& ok "conteneurs : podman.socket activé" || ko "conteneurs : podman indisponible"
|
&& ok "$(t hardware.containers_enabled)" || ko "$(t hardware.containers_unavailable)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Outils invité VM -------------------------------------------------------
|
# --- Outils invité VM -------------------------------------------------------
|
||||||
if selected_has vm && [ -n "$VMSVC" ]; then
|
if selected_has vm && [ -n "$VMSVC" ]; then
|
||||||
systemctl enable $VMSVC >/dev/null 2>&1 \
|
systemctl enable $VMSVC >/dev/null 2>&1 \
|
||||||
&& ok "machine virtuelle : $VMSVC activés" || ko "machine virtuelle : activation partielle"
|
&& ok "$(t hardware.vm_services_enabled services="$VMSVC")" \
|
||||||
|
|| ko "$(t hardware.vm_services_partial)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Modules DKMS réellement compilés ---------------------------------------
|
# --- Modules DKMS réellement compilés ---------------------------------------
|
||||||
@@ -544,13 +554,13 @@ if command -v dkms >/dev/null 2>&1; then
|
|||||||
: # aucun module DKMS attendu sur cette machine
|
: # aucun module DKMS attendu sur cette machine
|
||||||
else
|
else
|
||||||
_NBOK="$(printf '%s\n' "$_DKMS" | grep -c 'installed')"
|
_NBOK="$(printf '%s\n' "$_DKMS" | grep -c 'installed')"
|
||||||
[ "$_NBOK" -gt 0 ] && ok "dkms : $_NBOK module(s) compilé(s) et installé(s)"
|
[ "$_NBOK" -gt 0 ] && ok "$(t hardware.dkms_built count="$_NBOK")"
|
||||||
printf '%s\n' "$_DKMS" | grep -v 'installed' | while read -r _l; do
|
printf '%s\n' "$_DKMS" | grep -v 'installed' | while read -r _l; do
|
||||||
[ -n "$_l" ] && ko "dkms : PAS compilé → $_l"
|
[ -n "$_l" ] && ko "$(t hardware.dkms_not_built module="$_l")"
|
||||||
done
|
done
|
||||||
if [ "$_NBOK" -eq 0 ]; then
|
if [ "$_NBOK" -eq 0 ]; then
|
||||||
ko "dkms : aucun module compilé — en-têtes du noyau absentes ?"
|
ko "$(t hardware.dkms_none_built)"
|
||||||
ko " réessaie avec : sudo dkms autoinstall"
|
ko " $(t hardware.dkms_retry command="sudo dkms autoinstall")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -562,9 +572,9 @@ fi
|
|||||||
if selected_has gpu; then
|
if selected_has gpu; then
|
||||||
_GMOD="$(lsmod 2>/dev/null | grep -oE '^(nvidia|amdgpu|i915|xe|radeon|nouveau)' | head -1)"
|
_GMOD="$(lsmod 2>/dev/null | grep -oE '^(nvidia|amdgpu|i915|xe|radeon|nouveau)' | head -1)"
|
||||||
if [ -n "$_GMOD" ]; then
|
if [ -n "$_GMOD" ]; then
|
||||||
ok "graphique : module chargé ($_GMOD)"
|
ok "$(t hardware.gpu_module_loaded module="$_GMOD")"
|
||||||
else
|
else
|
||||||
ko "graphique : aucun module noyau chargé — redémarre pour appliquer les pilotes"
|
ko "$(t hardware.gpu_no_module)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Un module chargé ne prouve RIEN sur le rendu : le loader Vulkan doit
|
# Un module chargé ne prouve RIEN sur le rendu : le loader Vulkan doit
|
||||||
@@ -574,26 +584,26 @@ if selected_has gpu; then
|
|||||||
# l'installateur. Sans module chargé ou sans /dev/dri, le test ne prouve
|
# l'installateur. Sans module chargé ou sans /dev/dri, le test ne prouve
|
||||||
# rien : on le dit plutôt que d'afficher un échec qui n'en est pas un.
|
# rien : on le dit plutôt que d'afficher un échec qui n'en est pas un.
|
||||||
if [ -z "$_GMOD" ] || [ ! -d /dev/dri ]; then
|
if [ -z "$_GMOD" ] || [ ! -d /dev/dri ]; then
|
||||||
log " … rendu non testé ici (pilote pas encore actif) — contrôle au prochain démarrage"
|
log " … $(t hardware.rendering_not_tested)"
|
||||||
else
|
else
|
||||||
if command -v vulkaninfo >/dev/null 2>&1; then
|
if command -v vulkaninfo >/dev/null 2>&1; then
|
||||||
_VK="$(vulkaninfo --summary 2>/dev/null \
|
_VK="$(vulkaninfo --summary 2>/dev/null \
|
||||||
| sed -n 's/^[[:space:]]*deviceName[[:space:]]*=[[:space:]]*//p')"
|
| sed -n 's/^[[:space:]]*deviceName[[:space:]]*=[[:space:]]*//p')"
|
||||||
if [ -z "$_VK" ]; then
|
if [ -z "$_VK" ]; then
|
||||||
ko "vulkan : aucun périphérique — ICD absent ou illisible"
|
ko "$(t hardware.vulkan_no_device)"
|
||||||
ko " ICD présents : $(ls /usr/share/vulkan/icd.d/ 2>/dev/null | tr '\n' ' ')"
|
ko " $(t hardware.vulkan_icds_present files="$(ls /usr/share/vulkan/icd.d/ 2>/dev/null | tr '\n' ' ')")"
|
||||||
elif ! printf '%s\n' "$_VK" | grep -qvi 'llvmpipe'; then
|
elif ! printf '%s\n' "$_VK" | grep -qvi 'llvmpipe'; then
|
||||||
# llvmpipe SEUL = rendu logiciel : ça « marche », mais au CPU.
|
# llvmpipe SEUL = rendu logiciel : ça « marche », mais au CPU.
|
||||||
# Le symptôme est un bureau qui rame et zéro jeu jouable, sans
|
# Le symptôme est un bureau qui rame et zéro jeu jouable, sans
|
||||||
# le moindre message d'erreur nulle part.
|
# le moindre message d'erreur nulle part.
|
||||||
ko "vulkan : rendu LOGICIEL seulement (llvmpipe) — le pilote matériel n'est pas actif"
|
ko "$(t hardware.vulkan_software_only)"
|
||||||
else
|
else
|
||||||
printf '%s\n' "$_VK" | while read -r _d; do
|
printf '%s\n' "$_VK" | while read -r _d; do
|
||||||
[ -n "$_d" ] && ok "vulkan : $_d"
|
[ -n "$_d" ] && ok "$(t hardware.vulkan_device device="$_d")"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ko "vulkan : vulkan-tools absent, impossible de vérifier le rendu"
|
ko "$(t hardware.vulkan_tools_missing)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# OpenGL : second avis, mais glxinfo EXIGE un affichage ouvert. Lancé
|
# OpenGL : second avis, mais glxinfo EXIGE un affichage ouvert. Lancé
|
||||||
@@ -602,7 +612,7 @@ if selected_has gpu; then
|
|||||||
if command -v glxinfo >/dev/null 2>&1 \
|
if command -v glxinfo >/dev/null 2>&1 \
|
||||||
&& [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then
|
&& [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then
|
||||||
_GL="$(glxinfo -B 2>/dev/null | sed -n 's/^OpenGL renderer string: //p')"
|
_GL="$(glxinfo -B 2>/dev/null | sed -n 's/^OpenGL renderer string: //p')"
|
||||||
[ -n "$_GL" ] && ok "opengl : $_GL"
|
[ -n "$_GL" ] && ok "$(t hardware.opengl_renderer renderer="$_GL")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -613,16 +623,16 @@ fi
|
|||||||
if selected_has wifi; then
|
if selected_has wifi; then
|
||||||
WIFI_IFACE="$(wifi_iface)"
|
WIFI_IFACE="$(wifi_iface)"
|
||||||
if [ -n "$WIFI_IFACE" ]; then
|
if [ -n "$WIFI_IFACE" ]; then
|
||||||
ok "wi-fi : interface $WIFI_IFACE présente"
|
ok "$(t hardware.wifi_interface_present interface="$WIFI_IFACE")"
|
||||||
rfkill unblock wifi 2>/dev/null && ok "wi-fi : radio débloquée"
|
rfkill unblock wifi 2>/dev/null && ok "$(t hardware.wifi_unblocked)"
|
||||||
elif [ -n "$WIFI_HW" ]; then
|
elif [ -n "$WIFI_HW" ]; then
|
||||||
ko "wi-fi : contrôleur détecté mais AUCUNE interface — pilote manquant"
|
ko "$(t hardware.wifi_no_interface)"
|
||||||
ko " $(printf '%s' "$WIFI_HW" | head -1 | cut -c1-72)"
|
ko " $(printf '%s' "$WIFI_HW" | head -1 | cut -c1-72)"
|
||||||
[ "$BROADCOM_WL" = 1 ] \
|
[ "$BROADCOM_WL" = 1 ] \
|
||||||
&& ko " pilote wl installé ? redémarre pour le charger"
|
&& ko " $(t hardware.wifi_restart_for_wl)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
log "terminé"
|
log "$(t hardware.done)"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -8,26 +8,28 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||||||
exec sudo "$0" "$@"
|
exec sudo "$0" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
say "Mise à jour du système (pacman -Syu)…"
|
. /usr/local/lib/fws/i18n.sh update common
|
||||||
pacman -Syu || { echo "Échec de la mise à jour (réseau ?)"; read -rp "Entrée pour fermer. " _; exit 1; }
|
|
||||||
|
say "$(t update.updating_system)"
|
||||||
|
pacman -Syu || { echo "$(t update.failed)"; read -rp "$(t common.press_enter_to_close) " _; exit 1; }
|
||||||
|
|
||||||
if command -v paccache >/dev/null 2>&1; then
|
if command -v paccache >/dev/null 2>&1; then
|
||||||
say "Nettoyage du cache des paquets (2 dernières versions gardées)…"
|
say "$(t update.cleaning_cache)"
|
||||||
paccache -rk2
|
paccache -rk2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ORPHANS="$(pacman -Qtdq 2>/dev/null)"
|
ORPHANS="$(pacman -Qtdq 2>/dev/null)"
|
||||||
if [ -n "$ORPHANS" ]; then
|
if [ -n "$ORPHANS" ]; then
|
||||||
say "Paquets orphelins (plus requis par rien) :"
|
say "$(t update.orphans)"
|
||||||
echo "$ORPHANS"
|
echo "$ORPHANS"
|
||||||
read -rp "Les supprimer ? [o/N] " _rm
|
read -rp "$(t update.remove_orphans) $(t common.yes_no) " _rm
|
||||||
case "$_rm" in o|O|oui) echo "$ORPHANS" | pacman -Rns --noconfirm - ;; esac
|
t_is_yes "$_rm" && echo "$ORPHANS" | pacman -Rns --noconfirm -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v flatpak >/dev/null 2>&1; then
|
if command -v flatpak >/dev/null 2>&1; then
|
||||||
say "Mise à jour des Flatpaks…"
|
say "$(t update.updating_flatpaks)"
|
||||||
flatpak update -y || true
|
flatpak update -y || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
say "Système à jour ✔"
|
say "$(t update.done)"
|
||||||
read -rp "Entrée pour fermer. " _
|
read -rp "$(t common.press_enter_to_close) " _
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
# FWS — configuration Hyprland par défaut.
|
|
||||||
# Le clavier (__KB_LAYOUT__ / __KB_VARIANT__) est injecté à l'installation,
|
|
||||||
# depuis le choix fait dans Anaconda. Édite ce fichier librement.
|
|
||||||
#
|
|
||||||
# Raccourcis : transposition de la config i3/sway FWS (mêmes touches).
|
|
||||||
# Couleurs : nuances de bleu (palette Catppuccin Mocha).
|
|
||||||
#
|
|
||||||
# Les raccourcis sont déclarés avec « bindd » (bind + description) : la
|
|
||||||
# description alimente l'écran « Raccourcis clavier » (bouton ⌨ de la barre
|
|
||||||
# ou SUPER+K → fws-keys, qui lit les binds RÉELS via hyprctl). Ajoute
|
|
||||||
# tes propres bindd : ils apparaîtront automatiquement dans la liste.
|
|
||||||
# ⚠ Pas de virgule dans les descriptions (séparateur de champs Hyprland).
|
|
||||||
|
|
||||||
monitor = , preferred, auto, 1
|
|
||||||
|
|
||||||
input {
|
|
||||||
kb_layout = __KB_LAYOUT__
|
|
||||||
kb_variant = __KB_VARIANT__
|
|
||||||
follow_mouse = 1
|
|
||||||
numlock_by_default = true
|
|
||||||
touchpad {
|
|
||||||
natural_scroll = true
|
|
||||||
tap-to-click = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
general {
|
|
||||||
gaps_in = 4
|
|
||||||
gaps_out = 8
|
|
||||||
border_size = 2
|
|
||||||
# Nuances de bleu : bleu → sapphire en dégradé sur la fenêtre active.
|
|
||||||
col.active_border = rgb(89b4fa) rgb(74c7ec) 45deg
|
|
||||||
col.inactive_border = rgb(313244)
|
|
||||||
layout = dwindle
|
|
||||||
}
|
|
||||||
|
|
||||||
decoration {
|
|
||||||
rounding = 8
|
|
||||||
# Flou et ombres COUPÉS : rendu logiciel (llvmpipe) en VM — cf. le
|
|
||||||
# wrapper fws-hyprland écrit par l'installateur. Sur un vrai GPU tu
|
|
||||||
# peux les réactiver (enabled = true).
|
|
||||||
blur {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
shadow {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
animations {
|
|
||||||
enabled = true
|
|
||||||
bezier = fws, 0.22, 1.0, 0.36, 1.0
|
|
||||||
animation = windows, 1, 3, fws
|
|
||||||
animation = workspaces, 1, 3, fws
|
|
||||||
animation = fade, 1, 2, default
|
|
||||||
}
|
|
||||||
|
|
||||||
misc {
|
|
||||||
disable_hyprland_logo = true
|
|
||||||
disable_splash_rendering = true # pas de « Thanks xxx! » en bas d'écran
|
|
||||||
force_default_wallpaper = 0
|
|
||||||
background_color = 0x1a1a2e # bleu nuit FWS (aucun fond requis)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Démarrage de session : barre d'état, notifications, réseau dans le tray,
|
|
||||||
# agent d'authentification GUI (indispensable pour les apps qui demandent
|
|
||||||
# les droits admin : gestionnaire de disques, blueman…).
|
|
||||||
# Fond d'écran FWS : image EMBARQUÉE dans l'ISO (aucun réseau requis) — swaybg
|
|
||||||
# la repose à chaque session, Hyprland n'ayant pas de réglage de fond persistant
|
|
||||||
# hors config. « background_color » ci-dessus reste le repli si swaybg manque.
|
|
||||||
exec-once = fws-wallpaper --session
|
|
||||||
exec-once = waybar
|
|
||||||
exec-once = mako
|
|
||||||
exec-once = nm-applet
|
|
||||||
# Applet Bluetooth : seulement si un adaptateur existe (en VM il n'y en a
|
|
||||||
# pas → blueman afficherait une erreur « Connection to BlueZ failed »).
|
|
||||||
exec-once = sh -c '[ -n "$(ls -A /sys/class/bluetooth 2>/dev/null)" ] && exec blueman-applet'
|
|
||||||
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
|
||||||
# Fenêtre de bienvenue (1er démarrage seulement — se retire ensuite).
|
|
||||||
exec-once = fws-hello --autostart
|
|
||||||
# Mise en route du matériel : ne s'ouvre que si elle n'a pas abouti à
|
|
||||||
# l'installation (pilotes, son, Bluetooth, VR…).
|
|
||||||
exec-once = fws-drivers --autostart
|
|
||||||
|
|
||||||
$mod = SUPER
|
|
||||||
|
|
||||||
# --- Applications ---------------------------------------------------------
|
|
||||||
bindd = $mod, Return, Ouvrir un terminal (kitty), exec, kitty
|
|
||||||
bindd = $mod SHIFT, Return, Terminal flottant, exec, kitty --class floating-term
|
|
||||||
bindd = $mod, R, Menu des applications, exec, wofi --show drun
|
|
||||||
bindd = $mod, E, Gestionnaire de fichiers, exec, dolphin
|
|
||||||
bindd = $mod, B, Ouvrir Firefox, exec, firefox
|
|
||||||
bindd = $mod, P, Gestionnaire de paquets (PacManager), exec, PacManager
|
|
||||||
bindd = $mod, K, Afficher les raccourcis clavier, exec, fws-keys
|
|
||||||
bindd = $mod, X, Menu d'alimentation (arrêt/redémarrage…), exec, fws-powermenu
|
|
||||||
|
|
||||||
# --- Fenêtres ---------------------------------------------------------------
|
|
||||||
bindd = $mod, Q, Fermer la fenêtre, killactive,
|
|
||||||
bindd = $mod, V, Fenêtre flottante ou ancrée, togglefloating,
|
|
||||||
bindd = $mod, F, Plein écran, fullscreen,
|
|
||||||
bindd = $mod, J, Basculer la découpe horizontale/verticale, layoutmsg, togglesplit
|
|
||||||
bindd = $mod, L, Verrouiller l'écran, exec, hyprlock
|
|
||||||
bindd = $mod SHIFT, E, Quitter la session (retour à SDDM), exit,
|
|
||||||
bindd = $mod SHIFT, C, Recharger la configuration Hyprland, exec, hyprctl reload
|
|
||||||
|
|
||||||
# --- Focus (flèches) ---------------------------------------------------------
|
|
||||||
bindd = $mod, left, Focus à gauche, movefocus, l
|
|
||||||
bindd = $mod, right, Focus à droite, movefocus, r
|
|
||||||
bindd = $mod, up, Focus en haut, movefocus, u
|
|
||||||
bindd = $mod, down, Focus en bas, movefocus, d
|
|
||||||
|
|
||||||
# --- Déplacer la fenêtre (Maj + flèches) ---------------------------------------
|
|
||||||
bindd = $mod SHIFT, left, Déplacer la fenêtre à gauche, movewindow, l
|
|
||||||
bindd = $mod SHIFT, right, Déplacer la fenêtre à droite, movewindow, r
|
|
||||||
bindd = $mod SHIFT, up, Déplacer la fenêtre en haut, movewindow, u
|
|
||||||
bindd = $mod SHIFT, down, Déplacer la fenêtre en bas, movewindow, d
|
|
||||||
|
|
||||||
# --- Redimensionner (Ctrl + flèches, maintien possible) ------------------------
|
|
||||||
binde = $mod CTRL, left, resizeactive, -30 0
|
|
||||||
binde = $mod CTRL, right, resizeactive, 30 0
|
|
||||||
binde = $mod CTRL, up, resizeactive, 0 -30
|
|
||||||
binde = $mod CTRL, down, resizeactive, 0 30
|
|
||||||
|
|
||||||
# --- Espaces de travail 1-10 (0 = espace 10, comme i3) --------------------------
|
|
||||||
bindd = $mod, 1, Aller à l'espace 1, workspace, 1
|
|
||||||
bindd = $mod, 2, Aller à l'espace 2, workspace, 2
|
|
||||||
bindd = $mod, 3, Aller à l'espace 3, workspace, 3
|
|
||||||
bindd = $mod, 4, Aller à l'espace 4, workspace, 4
|
|
||||||
bindd = $mod, 5, Aller à l'espace 5, workspace, 5
|
|
||||||
bindd = $mod, 6, Aller à l'espace 6, workspace, 6
|
|
||||||
bindd = $mod, 7, Aller à l'espace 7, workspace, 7
|
|
||||||
bindd = $mod, 8, Aller à l'espace 8, workspace, 8
|
|
||||||
bindd = $mod, 9, Aller à l'espace 9, workspace, 9
|
|
||||||
bindd = $mod, 0, Aller à l'espace 10, workspace, 10
|
|
||||||
bindd = $mod SHIFT, 1, Envoyer la fenêtre vers l'espace 1, movetoworkspace, 1
|
|
||||||
bindd = $mod SHIFT, 2, Envoyer la fenêtre vers l'espace 2, movetoworkspace, 2
|
|
||||||
bindd = $mod SHIFT, 3, Envoyer la fenêtre vers l'espace 3, movetoworkspace, 3
|
|
||||||
bindd = $mod SHIFT, 4, Envoyer la fenêtre vers l'espace 4, movetoworkspace, 4
|
|
||||||
bindd = $mod SHIFT, 5, Envoyer la fenêtre vers l'espace 5, movetoworkspace, 5
|
|
||||||
bindd = $mod SHIFT, 6, Envoyer la fenêtre vers l'espace 6, movetoworkspace, 6
|
|
||||||
bindd = $mod SHIFT, 7, Envoyer la fenêtre vers l'espace 7, movetoworkspace, 7
|
|
||||||
bindd = $mod SHIFT, 8, Envoyer la fenêtre vers l'espace 8, movetoworkspace, 8
|
|
||||||
bindd = $mod SHIFT, 9, Envoyer la fenêtre vers l'espace 9, movetoworkspace, 9
|
|
||||||
bindd = $mod SHIFT, 0, Envoyer la fenêtre vers l'espace 10, movetoworkspace, 10
|
|
||||||
|
|
||||||
# --- Multi-écrans (comme i3 : Super+Ctrl+1/2 = écran gauche/droit) -------------
|
|
||||||
bindd = $mod CTRL, 1, Envoyer la fenêtre vers l'écran de gauche, movewindow, mon:l
|
|
||||||
bindd = $mod CTRL, 2, Envoyer la fenêtre vers l'écran de droite, movewindow, mon:r
|
|
||||||
|
|
||||||
# --- Molette = changer d'espace de travail --------------------------------------
|
|
||||||
bindd = $mod, mouse_up, Espace de travail précédent, workspace, e-1
|
|
||||||
bindd = $mod, mouse_down, Espace de travail suivant, workspace, e+1
|
|
||||||
|
|
||||||
# --- Scratchpad (espace spécial) -------------------------------------------------
|
|
||||||
bindd = $mod, S, Afficher le scratchpad, togglespecialworkspace, magic
|
|
||||||
bindd = $mod SHIFT, S, Envoyer la fenêtre au scratchpad, movetoworkspace, special:magic
|
|
||||||
|
|
||||||
# --- Captures d'écran (grim/slurp → presse-papier ou ~/Images) -------------------
|
|
||||||
bindd = , Print, Capture plein écran vers le presse-papier, exec, grim - | wl-copy
|
|
||||||
bindd = $mod, Print, Capture d'une zone vers le presse-papier, exec, grim -g "$(slurp)" - | wl-copy
|
|
||||||
bindd = $mod SHIFT, Print, Capture d'une zone vers ~/Images, exec, sh -c 'mkdir -p ~/Images && grim -g "$(slurp)" ~/Images/capture_$(date +%Y-%m-%d_%H-%M-%S).png'
|
|
||||||
|
|
||||||
# --- Multimédia (touches XF86 : volume via PipeWire, lecture via playerctl) ------
|
|
||||||
bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
|
|
||||||
bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
|
||||||
bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
|
||||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioNext, exec, playerctl next
|
|
||||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
|
||||||
|
|
||||||
# --- Luminosité de l'écran (portables : touches Fn) ------------------------------
|
|
||||||
bindel = , XF86MonBrightnessUp, exec, brightnessctl set +5%
|
|
||||||
bindel = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
|
|
||||||
|
|
||||||
# --- Souris : déplacer / redimensionner les fenêtres -----------------------------
|
|
||||||
bindm = $mod, mouse:272, movewindow
|
|
||||||
bindm = $mod, mouse:273, resizewindow
|
|
||||||
|
|
||||||
# --- Règles de fenêtres (comme i3) ------------------------------------------------
|
|
||||||
# Syntaxe Hyprland ≥ 0.55 : champs « <règle> <valeur> » + cibles « match:… »
|
|
||||||
# (validé contre le binaire avec --verify-config).
|
|
||||||
windowrule = float on, match:class ^(floating-term)$
|
|
||||||
windowrule = size 900 550, match:class ^(floating-term)$
|
|
||||||
windowrule = float on, match:class ^([Pp]avucontrol|org.pulseaudio.pavucontrol)$
|
|
||||||
windowrule = float on, match:class ^(.?[Bb]lueman-manager.*)$
|
|
||||||
windowrule = float on, match:class ^([Ff]ws-hello)$
|
|
||||||
windowrule = float on, match:class ^([Ff]ws-drivers)$
|
|
||||||
windowrule = float on, match:class ^([Ff]ws-about)$
|
|
||||||
windowrule = float on, match:class ^([Ff]ws-bugreport)$
|
|
||||||
windowrule = float on, match:title ^(Picture-in-Picture)$
|
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
-- FWS — configuration Hyprland par défaut (format Lua, Hyprland ≥ 0.55).
|
||||||
|
--
|
||||||
|
-- Depuis Hyprland 0.57 le fichier hyprland.conf (syntaxe « hyprlang ») n'est
|
||||||
|
-- PLUS lu : seul hyprland.lua est chargé (0.55/0.56 le préfèrent aussi). C'est
|
||||||
|
-- donc le seul format que FWS livre.
|
||||||
|
--
|
||||||
|
-- Le clavier (__KB_LAYOUT__ / __KB_VARIANT__ / __KB_OPTIONS__) est injecté à
|
||||||
|
-- l'installation, depuis le choix fait dans Anaconda. Édite ce fichier
|
||||||
|
-- librement.
|
||||||
|
--
|
||||||
|
-- Raccourcis : transposition de la config i3/sway FWS (mêmes touches).
|
||||||
|
-- Couleurs : nuances de bleu (palette Catppuccin Mocha).
|
||||||
|
--
|
||||||
|
-- Les raccourcis sont décrits par des clés (binds.*) dans hl.bind() : la
|
||||||
|
-- description alimente l'écran « Raccourcis clavier » (bouton ⌨ de la barre
|
||||||
|
-- ou SUPER+K → fws-keys, qui lit les binds RÉELLEMENT chargés via hyprctl).
|
||||||
|
-- fws-keys affiche ces clés dans la langue de la session ; un texte en clair
|
||||||
|
-- s'affiche tel quel, sans virgule (séparateur de champs de Hyprland).
|
||||||
|
|
||||||
|
hl.monitor({
|
||||||
|
output = "",
|
||||||
|
mode = "preferred",
|
||||||
|
position = "auto",
|
||||||
|
scale = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
input = {
|
||||||
|
kb_layout = "__KB_LAYOUT__",
|
||||||
|
kb_variant = "__KB_VARIANT__",
|
||||||
|
kb_options = "__KB_OPTIONS__",
|
||||||
|
follow_mouse = 1,
|
||||||
|
numlock_by_default = true,
|
||||||
|
touchpad = {
|
||||||
|
natural_scroll = true,
|
||||||
|
tap_to_click = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
general = {
|
||||||
|
gaps_in = 4,
|
||||||
|
gaps_out = 8,
|
||||||
|
border_size = 2,
|
||||||
|
-- Nuances de bleu : bleu → sapphire en dégradé sur la fenêtre active.
|
||||||
|
col = {
|
||||||
|
active_border = {
|
||||||
|
colors = { "rgba(89b4faff)", "rgba(74c7ecff)" },
|
||||||
|
angle = 45,
|
||||||
|
},
|
||||||
|
inactive_border = "rgba(313244ff)",
|
||||||
|
},
|
||||||
|
layout = "dwindle",
|
||||||
|
},
|
||||||
|
|
||||||
|
decoration = {
|
||||||
|
rounding = 8,
|
||||||
|
-- Flou et ombres COUPÉS : rendu logiciel (llvmpipe) en VM — cf. le
|
||||||
|
-- wrapper fws-hyprland écrit par l'installateur. Sur un vrai GPU tu
|
||||||
|
-- peux les réactiver (enabled = true).
|
||||||
|
blur = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
shadow = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
animations = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
disable_hyprland_logo = true,
|
||||||
|
disable_splash_rendering = true, -- pas de « Thanks xxx! » en bas d'écran
|
||||||
|
force_default_wallpaper = 0,
|
||||||
|
background_color = "0x1a1a2e", -- bleu nuit FWS (aucun fond requis)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.curve("fws", { type = "bezier", points = { { 0.22, 1.0 }, { 0.36, 1.0 } } })
|
||||||
|
hl.animation({ leaf = "windows", enabled = true, speed = 3, bezier = "fws" })
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 3, bezier = "fws" })
|
||||||
|
hl.animation({ leaf = "fade", enabled = true, speed = 2, bezier = "default" })
|
||||||
|
|
||||||
|
-- Démarrage de session : barre d'état, notifications, réseau dans le tray,
|
||||||
|
-- agent d'authentification GUI (indispensable pour les apps qui demandent
|
||||||
|
-- les droits admin : gestionnaire de disques, blueman…).
|
||||||
|
-- Fond d'écran FWS : image EMBARQUÉE dans l'ISO (aucun réseau requis) — swaybg
|
||||||
|
-- la repose à chaque session, Hyprland n'ayant pas de réglage de fond persistant
|
||||||
|
-- hors config. « background_color » ci-dessus reste le repli si swaybg manque.
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
hl.exec_cmd("fws-wallpaper --session")
|
||||||
|
hl.exec_cmd("waybar")
|
||||||
|
hl.exec_cmd("mako")
|
||||||
|
hl.exec_cmd("nm-applet")
|
||||||
|
-- Applet Bluetooth : seulement si un adaptateur existe (en VM il n'y en a
|
||||||
|
-- pas → blueman afficherait une erreur « Connection to BlueZ failed »).
|
||||||
|
hl.exec_cmd('[ -n "$(ls -A /sys/class/bluetooth 2>/dev/null)" ] && exec blueman-applet')
|
||||||
|
hl.exec_cmd("/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1")
|
||||||
|
-- Fenêtre de bienvenue (1er démarrage seulement — se retire ensuite).
|
||||||
|
hl.exec_cmd("fws-hello --autostart")
|
||||||
|
-- Mise en route du matériel : ne s'ouvre que si elle n'a pas abouti à
|
||||||
|
-- l'installation (pilotes, son, Bluetooth, VR…).
|
||||||
|
hl.exec_cmd("fws-drivers --autostart")
|
||||||
|
end)
|
||||||
|
|
||||||
|
local mod = "SUPER"
|
||||||
|
|
||||||
|
-- --- Applications ---------------------------------------------------------
|
||||||
|
hl.bind(mod .. " + Return", hl.dsp.exec_cmd("kitty"), { description = "binds.open_terminal" })
|
||||||
|
hl.bind(mod .. " + SHIFT + Return", hl.dsp.exec_cmd("kitty --class floating-term"), { description = "binds.floating_terminal" })
|
||||||
|
hl.bind(mod .. " + R", hl.dsp.exec_cmd("wofi --show drun"), { description = "binds.app_menu" })
|
||||||
|
hl.bind(mod .. " + E", hl.dsp.exec_cmd("dolphin"), { description = "binds.file_manager" })
|
||||||
|
hl.bind(mod .. " + B", hl.dsp.exec_cmd("firefox"), { description = "binds.open_firefox" })
|
||||||
|
hl.bind(mod .. " + P", hl.dsp.exec_cmd("PacManager"), { description = "binds.package_manager" })
|
||||||
|
hl.bind(mod .. " + K", hl.dsp.exec_cmd("fws-keys"), { description = "binds.show_shortcuts" })
|
||||||
|
hl.bind(mod .. " + X", hl.dsp.exec_cmd("fws-powermenu"), { description = "binds.power_menu" })
|
||||||
|
|
||||||
|
-- --- Fenêtres ---------------------------------------------------------------
|
||||||
|
hl.bind(mod .. " + Q", hl.dsp.window.close(), { description = "binds.close_window" })
|
||||||
|
hl.bind(mod .. " + V", hl.dsp.window.float(), { description = "binds.toggle_floating" })
|
||||||
|
hl.bind(mod .. " + F", hl.dsp.window.fullscreen(), { description = "binds.fullscreen" })
|
||||||
|
hl.bind(mod .. " + J", hl.dsp.layout("togglesplit"), { description = "binds.toggle_split" })
|
||||||
|
hl.bind(mod .. " + L", hl.dsp.exec_cmd("hyprlock"), { description = "binds.lock_screen" })
|
||||||
|
hl.bind(mod .. " + SHIFT + E", hl.dsp.exit(), { description = "binds.exit_session" })
|
||||||
|
hl.bind(mod .. " + SHIFT + C", hl.dsp.reload_config(), { description = "binds.reload_config" })
|
||||||
|
|
||||||
|
-- --- Focus (flèches) ---------------------------------------------------------
|
||||||
|
hl.bind(mod .. " + left", hl.dsp.focus({ direction = "left" }), { description = "binds.focus_left" })
|
||||||
|
hl.bind(mod .. " + right", hl.dsp.focus({ direction = "right" }), { description = "binds.focus_right" })
|
||||||
|
hl.bind(mod .. " + up", hl.dsp.focus({ direction = "up" }), { description = "binds.focus_up" })
|
||||||
|
hl.bind(mod .. " + down", hl.dsp.focus({ direction = "down" }), { description = "binds.focus_down" })
|
||||||
|
|
||||||
|
-- --- Déplacer la fenêtre (Maj + flèches) ---------------------------------------
|
||||||
|
hl.bind(mod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" }), { description = "binds.move_window_left" })
|
||||||
|
hl.bind(mod .. " + SHIFT + right", hl.dsp.window.move({ direction = "right" }), { description = "binds.move_window_right" })
|
||||||
|
hl.bind(mod .. " + SHIFT + up", hl.dsp.window.move({ direction = "up" }), { description = "binds.move_window_up" })
|
||||||
|
hl.bind(mod .. " + SHIFT + down", hl.dsp.window.move({ direction = "down" }), { description = "binds.move_window_down" })
|
||||||
|
|
||||||
|
-- --- Redimensionner (Ctrl + flèches, maintien possible) ------------------------
|
||||||
|
hl.bind(mod .. " + CTRL + left", hl.dsp.window.resize({ x = -30, y = 0, relative = true }), { repeating = true })
|
||||||
|
hl.bind(mod .. " + CTRL + right", hl.dsp.window.resize({ x = 30, y = 0, relative = true }), { repeating = true })
|
||||||
|
hl.bind(mod .. " + CTRL + up", hl.dsp.window.resize({ x = 0, y = -30, relative = true }), { repeating = true })
|
||||||
|
hl.bind(mod .. " + CTRL + down", hl.dsp.window.resize({ x = 0, y = 30, relative = true }), { repeating = true })
|
||||||
|
|
||||||
|
-- --- Espaces de travail 1-10 (0 = espace 10, comme i3) --------------------------
|
||||||
|
for i = 1, 10 do
|
||||||
|
local key = i % 10 -- 10 s'écrit 0, comme sur le pavé numérique
|
||||||
|
hl.bind(mod .. " + " .. key, hl.dsp.focus({ workspace = i }), { description = "binds.go_to_workspace" })
|
||||||
|
hl.bind(mod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }), { description = "binds.send_window_to_workspace" })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- --- Multi-écrans (comme i3 : Super+Ctrl+1/2 = écran gauche/droit) -------------
|
||||||
|
hl.bind(mod .. " + CTRL + 1", hl.dsp.window.move({ monitor = "l" }), { description = "binds.send_window_to_left_screen" })
|
||||||
|
hl.bind(mod .. " + CTRL + 2", hl.dsp.window.move({ monitor = "r" }), { description = "binds.send_window_to_right_screen" })
|
||||||
|
|
||||||
|
-- --- Molette = changer d'espace de travail --------------------------------------
|
||||||
|
hl.bind(mod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }), { description = "binds.previous_workspace" })
|
||||||
|
hl.bind(mod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }), { description = "binds.next_workspace" })
|
||||||
|
|
||||||
|
-- --- Scratchpad (espace spécial) -------------------------------------------------
|
||||||
|
hl.bind(mod .. " + S", hl.dsp.workspace.toggle_special("magic"), { description = "binds.show_scratchpad" })
|
||||||
|
hl.bind(mod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }), { description = "binds.send_window_to_scratchpad" })
|
||||||
|
|
||||||
|
-- --- Captures d'écran (grim/slurp → presse-papier ou ~/Images) -------------------
|
||||||
|
hl.bind("Print", hl.dsp.exec_cmd("grim - | wl-copy"), { description = "binds.screenshot_screen_to_clipboard" })
|
||||||
|
hl.bind(mod .. " + Print", hl.dsp.exec_cmd('grim -g "$(slurp)" - | wl-copy'), { description = "binds.screenshot_area_to_clipboard" })
|
||||||
|
hl.bind(mod .. " + SHIFT + Print", hl.dsp.exec_cmd('mkdir -p ~/Images && grim -g "$(slurp)" ~/Images/capture_$(date +%Y-%m-%d_%H-%M-%S).png'), { description = "binds.screenshot_area_to_pictures" })
|
||||||
|
|
||||||
|
-- --- Multimédia (touches XF86 : volume via PipeWire, lecture via playerctl) ------
|
||||||
|
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 })
|
||||||
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||||
|
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true })
|
||||||
|
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
|
||||||
|
|
||||||
|
-- --- Luminosité de l'écran (portables : touches Fn) ------------------------------
|
||||||
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set +5%"), { locked = true, repeating = true })
|
||||||
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 5%-"), { locked = true, repeating = true })
|
||||||
|
|
||||||
|
-- --- Souris : déplacer / redimensionner les fenêtres -----------------------------
|
||||||
|
hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||||
|
hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
|
||||||
|
-- --- Règles de fenêtres (comme i3) ------------------------------------------------
|
||||||
|
hl.window_rule({ name = "fws-floating-term-float", match = { class = "^(floating-term)$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-floating-term-size", match = { class = "^(floating-term)$" }, size = "900 550" })
|
||||||
|
hl.window_rule({ name = "fws-pavucontrol", match = { class = "^([Pp]avucontrol|org.pulseaudio.pavucontrol)$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-blueman", match = { class = "^.?[Bb]lueman-manager.*$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-hello", match = { class = "^[Ff]ws-hello$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-drivers", match = { class = "^[Ff]ws-drivers$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-about", match = { class = "^[Ff]ws-about$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-bugreport", match = { class = "^[Ff]ws-bugreport$" }, float = true })
|
||||||
|
hl.window_rule({ name = "fws-picture-in-picture", match = { title = "^(Picture-in-Picture)$" }, float = true })
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# FWS — configuration i3 par défaut (session X11, COMPATIBLE VR).
|
# FWS — configuration i3 par défaut (session X11, COMPATIBLE VR).
|
||||||
# SteamVR fonctionne en X11 : c'est le bureau à choisir pour un casque VR
|
# SteamVR fonctionne en X11 : c'est le bureau à choisir pour un casque VR
|
||||||
# (HTC Vive, Valve Index…). Lance « fws-vr-setup » (Super+Shift+V, ou menu)
|
# (HTC Vive, Valve Index…). « Pilotes et matériel » (menu d'applications)
|
||||||
# pour installer les drivers/runtimes selon ton casque.
|
# installe la base VR (groupe « Réalité virtuelle ») et Steam (groupe « Jeux »).
|
||||||
# Le clavier X11 est configuré système via /etc/X11/xorg.conf.d/00-keyboard.conf
|
# Le clavier X11 est configuré système via /etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
# (écrit par l'installateur selon ton choix Anaconda) : rien à régler ici.
|
# (écrit par l'installateur selon ton choix Anaconda) : rien à régler ici.
|
||||||
|
|
||||||
@@ -40,7 +40,6 @@ bindsym $mod+r exec $menu
|
|||||||
bindsym $mod+e exec $filemanager
|
bindsym $mod+e exec $filemanager
|
||||||
bindsym $mod+b exec $browser
|
bindsym $mod+b exec $browser
|
||||||
# VR : installation des drivers/runtimes casque (HTC Vive, Index, Quest…)
|
# VR : installation des drivers/runtimes casque (HTC Vive, Index, Quest…)
|
||||||
bindsym $mod+Shift+v exec kitty -e fws-vr-setup
|
|
||||||
# Gestionnaire de paquets graphique (rechercher/installer/mettre à jour)
|
# Gestionnaire de paquets graphique (rechercher/installer/mettre à jour)
|
||||||
bindsym $mod+p exec PacManager
|
bindsym $mod+p exec PacManager
|
||||||
# Panneau des raccourcis clavier (aussi via le bouton ⌌ de la barre)
|
# Panneau des raccourcis clavier (aussi via le bouton ⌌ de la barre)
|
||||||
@@ -57,7 +56,7 @@ bindsym $mod+f fullscreen toggle
|
|||||||
bindsym $mod+j split toggle
|
bindsym $mod+j split toggle
|
||||||
bindsym $mod+l exec i3lock -c 1e1e2e
|
bindsym $mod+l exec i3lock -c 1e1e2e
|
||||||
# Quitter i3 → retour à SDDM
|
# Quitter i3 → retour à SDDM
|
||||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Quitter i3 et revenir à SDDM ?' -B 'Oui, quitter' 'i3-msg exit'"
|
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m '{{t:bar.i3_exit_question}}' -B '{{t:bar.i3_exit_button}}' 'i3-msg exit'"
|
||||||
bindsym $mod+Shift+c reload
|
bindsym $mod+Shift+c reload
|
||||||
|
|
||||||
# Focus (flèches)
|
# Focus (flèches)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ format-padding = 2
|
|||||||
|
|
||||||
[module/keyhelp]
|
[module/keyhelp]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = echo " Raccourcis"
|
exec = echo " {{t:bar.shortcuts}}"
|
||||||
interval = 3600
|
interval = 3600
|
||||||
click-left = fws-keys
|
click-left = fws-keys
|
||||||
format-background = ${colors.blue}
|
format-background = ${colors.blue}
|
||||||
@@ -118,7 +118,7 @@ label-volume = %percentage%%
|
|||||||
format-volume-background = ${colors.surface0}
|
format-volume-background = ${colors.surface0}
|
||||||
format-volume-foreground = ${colors.blue}
|
format-volume-foreground = ${colors.blue}
|
||||||
format-volume-padding = 2
|
format-volume-padding = 2
|
||||||
label-muted = muet
|
label-muted = {{t:bar.muted}}
|
||||||
format-muted-background = ${colors.surface0}
|
format-muted-background = ${colors.surface0}
|
||||||
format-muted-foreground = ${colors.subtext}
|
format-muted-foreground = ${colors.subtext}
|
||||||
format-muted-padding = 2
|
format-muted-padding = 2
|
||||||
@@ -133,7 +133,7 @@ format-connected-background = ${colors.surface0}
|
|||||||
format-connected-foreground = ${colors.teal}
|
format-connected-foreground = ${colors.teal}
|
||||||
format-connected-padding = 2
|
format-connected-padding = 2
|
||||||
format-disconnected = <label-disconnected>
|
format-disconnected = <label-disconnected>
|
||||||
label-disconnected = hors ligne
|
label-disconnected = {{t:bar.offline}}
|
||||||
format-disconnected-background = ${colors.surface0}
|
format-disconnected-background = ${colors.surface0}
|
||||||
format-disconnected-foreground = ${colors.red}
|
format-disconnected-foreground = ${colors.red}
|
||||||
format-disconnected-padding = 2
|
format-disconnected-padding = 2
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
"custom/power": {
|
"custom/power": {
|
||||||
"format": "",
|
"format": "",
|
||||||
"tooltip-format": "Alimentation (SUPER+X)",
|
"tooltip-format": "{{t:bar.power_menu}} (SUPER+X)",
|
||||||
"on-click": "fws-powermenu"
|
"on-click": "fws-powermenu"
|
||||||
},
|
},
|
||||||
|
|
||||||
"custom/updates": {
|
"custom/updates": {
|
||||||
"exec": "fws-updates-check",
|
"exec": "fws-updates-check",
|
||||||
"interval": 1800,
|
"interval": 1800,
|
||||||
"tooltip-format": "Mises à jour disponibles — clic pour installer",
|
"tooltip-format": "{{t:bar.updates_tooltip}}",
|
||||||
"on-click": "kitty -e fws-update"
|
"on-click": "kitty -e fws-update"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -44,8 +44,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"custom/keyhelp": {
|
"custom/keyhelp": {
|
||||||
"format": " Raccourcis",
|
"format": " {{t:bar.shortcuts}}",
|
||||||
"tooltip-format": "Raccourcis clavier (SUPER+K)",
|
"tooltip-format": "{{t:bar.keyboard_shortcuts}} (SUPER+K)",
|
||||||
"on-click": "fws-keys"
|
"on-click": "fws-keys"
|
||||||
},
|
},
|
||||||
"backlight": {
|
"backlight": {
|
||||||
@@ -53,17 +53,17 @@
|
|||||||
"format-icons": ["", "", ""],
|
"format-icons": ["", "", ""],
|
||||||
"on-scroll-up": "brightnessctl set +5%",
|
"on-scroll-up": "brightnessctl set +5%",
|
||||||
"on-scroll-down": "brightnessctl set 5%-",
|
"on-scroll-down": "brightnessctl set 5%-",
|
||||||
"tooltip-format": "Luminosité {percent}% (molette pour régler)"
|
"tooltip-format": "{{t:bar.brightness}} {percent}% ({{t:bar.scroll_to_adjust}})"
|
||||||
},
|
},
|
||||||
"pulseaudio": {
|
"pulseaudio": {
|
||||||
"format": "{icon} {volume}%",
|
"format": "{icon} {volume}%",
|
||||||
"format-muted": " muet",
|
"format-muted": " {{t:bar.muted}}",
|
||||||
"format-icons": { "default": ["", "", ""] },
|
"format-icons": { "default": ["", "", ""] },
|
||||||
"on-click": "pavucontrol",
|
"on-click": "pavucontrol",
|
||||||
"on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
"on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
||||||
"on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 2%+",
|
"on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 2%+",
|
||||||
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-",
|
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-",
|
||||||
"tooltip-format": "{desc} — clic : mixeur, clic droit : muet"
|
"tooltip-format": "{desc} — {{t:bar.volume_tooltip}}"
|
||||||
},
|
},
|
||||||
"bluetooth": {
|
"bluetooth": {
|
||||||
"format": "",
|
"format": "",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"network": {
|
"network": {
|
||||||
"format-wifi": " {essid}",
|
"format-wifi": " {essid}",
|
||||||
"format-ethernet": " {ipaddr}",
|
"format-ethernet": " {ipaddr}",
|
||||||
"format-disconnected": " hors ligne",
|
"format-disconnected": " {{t:bar.offline}}",
|
||||||
"tooltip-format": "{ifname} — {ipaddr}\n⇡ {bandwidthUpBytes} ⇣ {bandwidthDownBytes}"
|
"tooltip-format": "{ifname} — {ipaddr}\n⇡ {bandwidthUpBytes} ⇣ {bandwidthDownBytes}"
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
"memory": {
|
"memory": {
|
||||||
"format": " {percentage}%",
|
"format": " {percentage}%",
|
||||||
"interval": 3,
|
"interval": 3,
|
||||||
"tooltip-format": "{used:0.1f} / {total:0.1f} Gio"
|
"tooltip-format": "{used:0.1f} / {total:0.1f} {{t:bar.gib_unit}}"
|
||||||
},
|
},
|
||||||
"battery": {
|
"battery": {
|
||||||
"states": { "warning": 25, "critical": 10 },
|
"states": { "warning": 25, "critical": 10 },
|
||||||
|
|||||||
@@ -512,26 +512,75 @@ fws-install-step 28 fws:progress.keyboard_language
|
|||||||
# kb_layout). LOCALE : le locale choisi (ex. fr_CH.UTF-8) doit être GÉNÉRÉ —
|
# kb_layout). LOCALE : le locale choisi (ex. fr_CH.UTF-8) doit être GÉNÉRÉ —
|
||||||
# Anaconda vient de Fedora (locales pré-générées) et ne lance pas locale-gen →
|
# Anaconda vient de Fedora (locales pré-générées) et ne lance pas locale-gen →
|
||||||
# sans ça LANG casse et tout retombe en C.
|
# sans ça LANG casse et tout retombe en C.
|
||||||
XL=""; XV=""
|
# Every layout Anaconda chose, and its switch shortcut, not only the first one:
|
||||||
XKB="$(sed -n "s/.*--xlayouts=//p" /root/anaconda-ks.cfg 2>/dev/null | head -1)"
|
# a language whose own layout cannot type Latin letters (ru, bg, el, uk…) gets
|
||||||
XKB="${XKB#[\'\"]}"; XKB="${XKB%%[\'\"]*}"; XKB="${XKB%%,*}" # 1re dispo, ex. « ch (fr) »
|
# "us" first (user names and passwords are typed in Latin letters) and its own
|
||||||
if [ -z "$XKB" ]; then
|
# layout second. Keeping only the first one left those users without their
|
||||||
_loc="$(. /etc/locale.conf 2>/dev/null; printf '%s' "${LANG%%.*}")" # fr_CH
|
# keyboard on the installed system. XL/XV/XO: comma-separated, as XKB wants.
|
||||||
_lng="${_loc%%_*}"; _terr="${_loc#*_}"; [ "$_terr" = "$_loc" ] && _terr=""
|
XL=""; XV=""; XO=""
|
||||||
[ -n "$_terr" ] && XKB="$(python3 -c "import langtable; k=langtable.list_keyboards(languageId='$_lng', territoryId='$_terr'); print(k[0] if k else '')" 2>/dev/null)"
|
eval "$(python3 - 2>/dev/null <<'KBPY'
|
||||||
fi
|
import re, shlex
|
||||||
if [ -n "$XKB" ]; then
|
layouts, options = [], []
|
||||||
XL="${XKB%%(*}"; XL="${XL%% *}" # ch
|
try:
|
||||||
case "$XKB" in *'('*')') XV="${XKB#*(}"; XV="${XV%)}" ;; *) XV="" ;; esac # fr
|
with open("/root/anaconda-ks.cfg", encoding="utf-8") as fh:
|
||||||
|
for line in fh:
|
||||||
|
if line.startswith("keyboard"):
|
||||||
|
for token in shlex.split(line)[1:]:
|
||||||
|
name, _, value = token.partition("=")
|
||||||
|
items = [item.strip() for item in value.split(",") if item.strip()]
|
||||||
|
if name == "--xlayouts":
|
||||||
|
layouts = items
|
||||||
|
elif name == "--switch":
|
||||||
|
options = items
|
||||||
|
break
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
if not layouts:
|
||||||
|
# No layout in the generated kickstart: the same rule as Anaconda, from
|
||||||
|
# the installed locale (fr_CH -> ch(fr); ru_RU -> us + ru).
|
||||||
|
import langtable
|
||||||
|
locale = ""
|
||||||
|
try:
|
||||||
|
with open("/etc/locale.conf", encoding="utf-8") as fh:
|
||||||
|
for line in fh:
|
||||||
|
if line.startswith("LANG="):
|
||||||
|
locale = line.split("=", 1)[1].strip().strip("\"'").split(".")[0]
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
language, _, territory = locale.partition("_")
|
||||||
|
if language and territory:
|
||||||
|
keyboards = langtable.list_keyboards(languageId=language, territoryId=territory)
|
||||||
|
if keyboards:
|
||||||
|
layouts = [keyboards[0]]
|
||||||
|
if not langtable.supports_ascii(keyboards[0].replace(" ", "")):
|
||||||
|
layouts.insert(0, "us")
|
||||||
|
pairs = []
|
||||||
|
for item in layouts:
|
||||||
|
match = re.match(r"^([\w/-]+)\s*(?:\(\s*([^)]*?)\s*\))?$", item)
|
||||||
|
if match:
|
||||||
|
pairs.append((match.group(1), match.group(2) or ""))
|
||||||
|
if len(pairs) > 1 and not options:
|
||||||
|
options = ["grp:alt_shift_toggle"]
|
||||||
|
print("XL=" + shlex.quote(",".join(layout for layout, _ in pairs)))
|
||||||
|
print("XV=" + shlex.quote(",".join(variant for _, variant in pairs)))
|
||||||
|
print("XO=" + shlex.quote(",".join(options)))
|
||||||
|
KBPY
|
||||||
|
)"
|
||||||
|
# Two layouts without variants give XV="," — XKB then has no usable variant
|
||||||
|
# list, so "no variant" stays empty.
|
||||||
|
[ -n "${XV//,/}" ] || XV=""
|
||||||
|
if [ -n "$XL" ]; then
|
||||||
install -d /etc/X11/xorg.conf.d
|
install -d /etc/X11/xorg.conf.d
|
||||||
cat > /etc/X11/xorg.conf.d/00-keyboard.conf <<KBEOF
|
{
|
||||||
Section "InputClass"
|
printf 'Section "InputClass"\n'
|
||||||
Identifier "system-keyboard"
|
printf ' Identifier "system-keyboard"\n'
|
||||||
MatchIsKeyboard "on"
|
printf ' MatchIsKeyboard "on"\n'
|
||||||
Option "XkbLayout" "$XL"
|
printf ' Option "XkbLayout" "%s"\n' "$XL"
|
||||||
Option "XkbVariant" "$XV"
|
printf ' Option "XkbVariant" "%s"\n' "$XV"
|
||||||
EndSection
|
[ -n "$XO" ] && printf ' Option "XkbOptions" "%s"\n' "$XO"
|
||||||
KBEOF
|
printf 'EndSection\n'
|
||||||
|
} > /etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
|
echo "[FWS] clavier : $XL ($XV) ${XO:+— bascule $XO}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FWSLANG="$(. /etc/locale.conf 2>/dev/null; printf '%s' "${LANG:-}")"
|
FWSLANG="$(. /etc/locale.conf 2>/dev/null; printf '%s' "${LANG:-}")"
|
||||||
@@ -573,7 +622,7 @@ case "$DESK" in
|
|||||||
# i3 : session X11 → COMPATIBLE VR (SteamVR ne marche pas sous Wayland).
|
# i3 : session X11 → COMPATIBLE VR (SteamVR ne marche pas sous Wayland).
|
||||||
# xorg-server est requis (SDDM ne le tire pas) ; maim+xclip = captures X11,
|
# xorg-server est requis (SDDM ne le tire pas) ; maim+xclip = captures X11,
|
||||||
# dunst = notifications X11 (équivalent de mako), i3lock = verrouillage.
|
# dunst = notifications X11 (équivalent de mako), i3lock = verrouillage.
|
||||||
# fws-vr-setup (Super+Shift+V ou menu) installe les drivers du casque.
|
# « Pilotes et matériel » installe la base VR et Steam à la demande.
|
||||||
i3) PKGS="i3-wm i3lock xorg-server polybar picom feh rofi kitty dolphin kio-extras udisks2 sddm noto-fonts ttf-nerd-fonts-symbols maim xclip dunst libnotify polkit-gnome network-manager-applet playerctl brightnessctl pipewire pipewire-alsa pipewire-pulse wireplumber pavucontrol bluez bluez-utils blueman"; DM="sddm" ;;
|
i3) PKGS="i3-wm i3lock xorg-server polybar picom feh rofi kitty dolphin kio-extras udisks2 sddm noto-fonts ttf-nerd-fonts-symbols maim xclip dunst libnotify polkit-gnome network-manager-applet playerctl brightnessctl pipewire pipewire-alsa pipewire-pulse wireplumber pavucontrol bluez bluez-utils blueman"; DM="sddm" ;;
|
||||||
cli|*) PKGS="" ;;
|
cli|*) PKGS="" ;;
|
||||||
esac
|
esac
|
||||||
@@ -829,19 +878,36 @@ fi
|
|||||||
|
|
||||||
fws-install-step 76 fws:progress.desktop_config
|
fws-install-step 76 fws:progress.desktop_config
|
||||||
|
|
||||||
|
# Bar labels ({{t:key}} markers) in the installed system's language: waybar,
|
||||||
|
# polybar and i3 cannot look texts up themselves, so they are written in once.
|
||||||
|
for _f in waybar-config.json polybar-config.ini i3-config; do
|
||||||
|
_src="/usr/local/share/fws/$_f"
|
||||||
|
[ -f "$_src" ] || continue
|
||||||
|
if LANG="${FWSLANG:-en_US.UTF-8}" /usr/local/bin/fws-i18n --catalog system \
|
||||||
|
--render "$_src" > "$_src.fws" && [ -s "$_src.fws" ]; then
|
||||||
|
mv -f "$_src.fws" "$_src"
|
||||||
|
else
|
||||||
|
rm -f "$_src.fws"
|
||||||
|
echo "[FWS] traduction de $_f impossible — libellés laissés en clés"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# --- Config Hyprland (si choisi) : clavier + apps + waybar -------------------
|
# --- Config Hyprland (si choisi) : clavier + apps + waybar -------------------
|
||||||
# Hyprland (Wayland) NE lit PAS /etc/X11/xorg.conf.d/00-keyboard.conf : sa
|
# Hyprland (Wayland) NE lit PAS /etc/X11/xorg.conf.d/00-keyboard.conf : sa
|
||||||
# disposition est dans SA config (input { kb_layout }). Sans config il démarre nu
|
# disposition est dans SA config (input { kb_layout }). Sans config il démarre nu
|
||||||
# (QWERTY US, aucune touche utile). On déploie une config FWS (template +
|
# (QWERTY US, aucune touche utile). On déploie la config FWS (template Lua +
|
||||||
# clavier XL/XV injecté) dans /etc/skel ET le home de chaque utilisateur déjà
|
# clavier XL/XV injecté) dans /etc/skel ET le home de chaque utilisateur déjà
|
||||||
# créé par Anaconda (le %post tourne APRÈS la création de l'utilisateur).
|
# créé par Anaconda (le %post tourne APRÈS la création de l'utilisateur).
|
||||||
if [ "$DESK" = "hyprland" ] && [ -f /usr/local/share/fws/hyprland.conf.tmpl ]; then
|
if [ "$DESK" = "hyprland" ]; then
|
||||||
sed -e "s/__KB_LAYOUT__/${XL:-us}/" -e "s/__KB_VARIANT__/${XV}/" \
|
# Hyprland ≥ 0.57 ne lit plus hyprland.conf (syntaxe hyprlang supprimée) :
|
||||||
/usr/local/share/fws/hyprland.conf.tmpl > /tmp/fws-hyprland.conf
|
# seul hyprland.lua est chargé. Le template est rendu avec le clavier
|
||||||
install -Dm644 /tmp/fws-hyprland.conf /etc/skel/.config/hypr/hyprland.conf
|
# XL/XV/XO du choix Anaconda, puis posé dans le skel et chaque home.
|
||||||
|
sed -e "s/__KB_LAYOUT__/${XL:-us}/" -e "s/__KB_VARIANT__/${XV}/" -e "s/__KB_OPTIONS__/${XO}/" \
|
||||||
|
/usr/local/share/fws/hyprland.lua.tmpl > /tmp/fws-hyprland.lua
|
||||||
|
install -Dm644 /tmp/fws-hyprland.lua /etc/skel/.config/hypr/hyprland.lua
|
||||||
# Waybar FWS : barre assortie + bouton « ⌨ Raccourcis » (fws-keys,
|
# Waybar FWS : barre assortie + bouton « ⌨ Raccourcis » (fws-keys,
|
||||||
# aussi sur SUPER+K) qui liste les binds RÉELS chargés par Hyprland
|
# aussi sur SUPER+K) qui liste les binds RÉELS chargés par Hyprland
|
||||||
# (hyprctl binds -j) — les descriptions viennent des bindd de la config.
|
# (hyprctl binds -j) — les descriptions viennent des hl.bind de la config.
|
||||||
install -Dm644 /usr/local/share/fws/waybar-config.json /etc/skel/.config/waybar/config
|
install -Dm644 /usr/local/share/fws/waybar-config.json /etc/skel/.config/waybar/config
|
||||||
install -Dm644 /usr/local/share/fws/waybar-style.css /etc/skel/.config/waybar/style.css
|
install -Dm644 /usr/local/share/fws/waybar-style.css /etc/skel/.config/waybar/style.css
|
||||||
# wofi : style du menu d'applications (Super+R) — le panneau « Raccourcis »
|
# wofi : style du menu d'applications (Super+R) — le panneau « Raccourcis »
|
||||||
@@ -850,7 +916,7 @@ if [ "$DESK" = "hyprland" ] && [ -f /usr/local/share/fws/hyprland.conf.tmpl ]; t
|
|||||||
install -Dm644 /usr/local/share/fws/wofi-style.css /etc/skel/.config/wofi/style.css
|
install -Dm644 /usr/local/share/fws/wofi-style.css /etc/skel/.config/wofi/style.css
|
||||||
while IFS=: read -r _u _x _uid _g _gec _home _sh; do
|
while IFS=: read -r _u _x _uid _g _gec _home _sh; do
|
||||||
[ "$_uid" -ge 1000 ] && [ "$_uid" -le 60000 ] && [ -d "$_home" ] || continue
|
[ "$_uid" -ge 1000 ] && [ "$_uid" -le 60000 ] && [ -d "$_home" ] || continue
|
||||||
install -Dm644 /tmp/fws-hyprland.conf "$_home/.config/hypr/hyprland.conf"
|
install -Dm644 /tmp/fws-hyprland.lua "$_home/.config/hypr/hyprland.lua"
|
||||||
install -Dm644 /usr/local/share/fws/waybar-config.json "$_home/.config/waybar/config"
|
install -Dm644 /usr/local/share/fws/waybar-config.json "$_home/.config/waybar/config"
|
||||||
install -Dm644 /usr/local/share/fws/waybar-style.css "$_home/.config/waybar/style.css"
|
install -Dm644 /usr/local/share/fws/waybar-style.css "$_home/.config/waybar/style.css"
|
||||||
install -Dm644 /usr/local/share/fws/wofi-config "$_home/.config/wofi/config"
|
install -Dm644 /usr/local/share/fws/wofi-config "$_home/.config/wofi/config"
|
||||||
@@ -859,7 +925,7 @@ if [ "$DESK" = "hyprland" ] && [ -f /usr/local/share/fws/hyprland.conf.tmpl ]; t
|
|||||||
chown -R "$_u": "$_home/.config/hypr" "$_home/.config/waybar" \
|
chown -R "$_u": "$_home/.config/hypr" "$_home/.config/waybar" \
|
||||||
"$_home/.config/wofi" 2>/dev/null || true
|
"$_home/.config/wofi" 2>/dev/null || true
|
||||||
done < /etc/passwd
|
done < /etc/passwd
|
||||||
rm -f /tmp/fws-hyprland.conf
|
rm -f /tmp/fws-hyprland.lua
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Config i3 (si choisi) : raccourcis FWS + barre + autostart -------------
|
# --- Config i3 (si choisi) : raccourcis FWS + barre + autostart -------------
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=À propos de FWS
|
X-FWS-Translation=apps.about
|
||||||
Name[en]=About FWS
|
Name=About FWS
|
||||||
Comment=Informations sur le projet FWS et sur le système
|
Comment=Information about the FWS project and this system
|
||||||
Exec=fws-about
|
Exec=fws-about
|
||||||
Icon=help-about
|
Icon=help-about
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=System;
|
Categories=System;
|
||||||
Keywords=about;système;projet;info;FWS;
|
Keywords=about;system;project;info;FWS;
|
||||||
@@ -2,12 +2,10 @@
|
|||||||
# FWS — « Signaler un problème » : envoi OPTIONNEL et validé par l'utilisateur
|
# FWS — « Signaler un problème » : envoi OPTIONNEL et validé par l'utilisateur
|
||||||
# de logs/diagnostics à l'équipe FWS (via l'API bugs). Aucun envoi automatique.
|
# de logs/diagnostics à l'équipe FWS (via l'API bugs). Aucun envoi automatique.
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Signaler un problème
|
X-FWS-Translation=apps.bugreport
|
||||||
Name[en]=Report a problem
|
Name=Report a problem
|
||||||
GenericName=Envoyer des logs de diagnostic à l'équipe FWS
|
GenericName=Send diagnostic logs to the FWS team
|
||||||
GenericName[en]=Send diagnostic logs to the FWS team
|
Comment=Send logs to the OS creator when something goes wrong (optional, user-validated)
|
||||||
Comment=Envoyer des logs au créateur de l'OS en cas de problème (optionnel, validé par l'utilisateur)
|
|
||||||
Comment[en]=Send logs to the OS creator when something goes wrong (optional, user-validated)
|
|
||||||
Exec=fws-bugreport
|
Exec=fws-bugreport
|
||||||
Icon=fws-bugreport
|
Icon=fws-bugreport
|
||||||
# Associe la fenêtre (WM_CLASS via GLib.set_prgname) à ce lanceur → bonne
|
# Associe la fenêtre (WM_CLASS via GLib.set_prgname) à ce lanceur → bonne
|
||||||
@@ -15,5 +13,4 @@ Icon=fws-bugreport
|
|||||||
StartupWMClass=fws-bugreport
|
StartupWMClass=fws-bugreport
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=System;
|
Categories=System;
|
||||||
Keywords=bug;rapport;log;diagnostic;télémétrie;problème;signaler;
|
Keywords=bug;report;log;diagnostic;telemetry;problem;issue;
|
||||||
Keywords[en]=bug;report;log;diagnostic;telemetry;problem;issue;
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Pilotes et matériel (FWS)
|
X-FWS-Translation=apps.drivers
|
||||||
Name[en]=Drivers & Hardware (FWS)
|
Name=Drivers & Hardware (FWS)
|
||||||
Comment=Installer les pilotes graphiques, le son, le Bluetooth, les jeux, l'impression
|
Comment=Install graphics drivers, audio, Bluetooth, gaming and printing
|
||||||
Comment[en]=Install graphics drivers, audio, Bluetooth, gaming and printing
|
|
||||||
Exec=fws-drivers
|
Exec=fws-drivers
|
||||||
Icon=preferences-desktop-display
|
Icon=preferences-desktop-display
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Settings;HardwareSettings;
|
Categories=Settings;HardwareSettings;
|
||||||
Keywords=pilote;pilotes;driver;nvidia;amd;intel;gpu;son;audio;bluetooth;luminosité;imprimante;jeux;
|
Keywords=driver;drivers;nvidia;amd;intel;gpu;audio;sound;bluetooth;brightness;printer;games;
|
||||||
@@ -17,10 +17,10 @@
|
|||||||
<policyconfig>
|
<policyconfig>
|
||||||
<vendor>FWS</vendor>
|
<vendor>FWS</vendor>
|
||||||
<action id="org.fws.hardware">
|
<action id="org.fws.hardware">
|
||||||
<description>Installer les pilotes et configurer le matériel</description>
|
<!-- fws-i18n: polkit.hardware -->
|
||||||
<description xml:lang="en">Install drivers and set up hardware</description>
|
<!-- The translations are added at build time from system-translations.toml. -->
|
||||||
<message>Authentification requise pour installer les pilotes</message>
|
<description>Install drivers and set up hardware</description>
|
||||||
<message xml:lang="en">Authentication is required to install drivers</message>
|
<message>Authentication is required to install drivers</message>
|
||||||
<icon_name>preferences-desktop-display</icon_name>
|
<icon_name>preferences-desktop-display</icon_name>
|
||||||
<defaults>
|
<defaults>
|
||||||
<allow_any>auth_admin_keep</allow_any>
|
<allow_any>auth_admin_keep</allow_any>
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
// surchargé par theme.conf.user écrit par le %post : accent selon le DE).
|
// surchargé par theme.conf.user écrit par le %post : accent selon le DE).
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.Basic
|
||||||
|
// Texts by language, written at build time from system-translations.toml
|
||||||
|
// (sddm.* keys) by /usr/local/lib/fws/translate-static-files.py.
|
||||||
|
import "translations.js" as Translations
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -17,6 +20,46 @@ Rectangle {
|
|||||||
readonly property color accent: config.accent || "#3daee9"
|
readonly property color accent: config.accent || "#3daee9"
|
||||||
readonly property color fieldBg: "#2a2a44"
|
readonly property color fieldBg: "#2a2a44"
|
||||||
|
|
||||||
|
// The greeter's locale comes from the system's (/etc/locale.conf).
|
||||||
|
readonly property var languages: languageCandidates()
|
||||||
|
|
||||||
|
function languageCandidates() {
|
||||||
|
const names = Qt.locale().uiLanguages.concat([Qt.locale().name])
|
||||||
|
const out = []
|
||||||
|
for (let i = 0; i < names.length; i++) {
|
||||||
|
const parts = names[i].replace(/-/g, "_").split("_")
|
||||||
|
const language = parts[0]
|
||||||
|
let territory = "", modifier = ""
|
||||||
|
for (let j = 1; j < parts.length; j++) {
|
||||||
|
// A four-letter part is a script: only Latin Serbian has its
|
||||||
|
// own catalog entry (sr@latin, Cyrillic being plain sr).
|
||||||
|
if (parts[j].length === 4)
|
||||||
|
modifier = parts[j] === "Latn" ? "@latin" : ""
|
||||||
|
else
|
||||||
|
territory = parts[j]
|
||||||
|
}
|
||||||
|
if (territory)
|
||||||
|
out.push(language + "_" + territory + modifier)
|
||||||
|
out.push(language + modifier)
|
||||||
|
if (modifier) {
|
||||||
|
if (territory)
|
||||||
|
out.push(language + "_" + territory)
|
||||||
|
out.push(language)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.push("en")
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function t(key) {
|
||||||
|
const texts = Translations.messages[key]
|
||||||
|
if (texts)
|
||||||
|
for (let i = 0; i < languages.length; i++)
|
||||||
|
if (texts[languages[i]])
|
||||||
|
return texts[languages[i]]
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { position: 0.0; color: config.colorTop || "#1a1a2e" }
|
GradientStop { position: 0.0; color: config.colorTop || "#1a1a2e" }
|
||||||
GradientStop { position: 1.0; color: config.colorBottom || "#16213e" }
|
GradientStop { position: 1.0; color: config.colorBottom || "#16213e" }
|
||||||
@@ -25,7 +68,7 @@ Rectangle {
|
|||||||
Connections {
|
Connections {
|
||||||
target: sddm
|
target: sddm
|
||||||
function onLoginFailed() {
|
function onLoginFailed() {
|
||||||
errorLabel.text = "Échec de la connexion — vérifiez le mot de passe"
|
errorLabel.text = t("sddm.login_failed")
|
||||||
passwordField.text = ""
|
passwordField.text = ""
|
||||||
passwordField.forceActiveFocus()
|
passwordField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
@@ -45,9 +88,12 @@ Rectangle {
|
|||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
var now = new Date()
|
const now = new Date()
|
||||||
clockLabel.text = Qt.formatTime(now, "hh:mm")
|
clockLabel.text = now.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
|
||||||
dateLabel.text = Qt.formatDate(now, "dddd d MMMM yyyy")
|
// Only the first letter is raised: capitalizing every word gives
|
||||||
|
// "26 Ноября" or "26 Novembre", where months are lowercase.
|
||||||
|
const date = now.toLocaleDateString(Qt.locale(), Locale.LongFormat)
|
||||||
|
dateLabel.text = date.charAt(0).toLocaleUpperCase() + date.slice(1)
|
||||||
}
|
}
|
||||||
Component.onCompleted: triggered()
|
Component.onCompleted: triggered()
|
||||||
}
|
}
|
||||||
@@ -70,7 +116,6 @@ Rectangle {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: "#a0a0b8"
|
color: "#a0a0b8"
|
||||||
font.pixelSize: 20
|
font.pixelSize: 20
|
||||||
font.capitalization: Font.Capitalize
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +139,7 @@ Rectangle {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: config.greeting || "Bienvenue sur FWS"
|
text: config.greeting || t("sddm.greeting")
|
||||||
color: "#f0f0f5"
|
color: "#f0f0f5"
|
||||||
font.pixelSize: 22
|
font.pixelSize: 22
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -107,7 +152,7 @@ Rectangle {
|
|||||||
id: userField
|
id: userField
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: userModel.lastUser
|
text: userModel.lastUser
|
||||||
placeholderText: "Utilisateur"
|
placeholderText: t("sddm.username")
|
||||||
placeholderTextColor: "#7d7d95"
|
placeholderTextColor: "#7d7d95"
|
||||||
color: "#f0f0f5"
|
color: "#f0f0f5"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
@@ -124,7 +169,7 @@ Rectangle {
|
|||||||
TextField {
|
TextField {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
width: parent.width
|
width: parent.width
|
||||||
placeholderText: "Mot de passe"
|
placeholderText: t("sddm.password")
|
||||||
placeholderTextColor: "#7d7d95"
|
placeholderTextColor: "#7d7d95"
|
||||||
color: "#f0f0f5"
|
color: "#f0f0f5"
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
@@ -143,7 +188,7 @@ Rectangle {
|
|||||||
Text {
|
Text {
|
||||||
visible: keyboard.capsLock
|
visible: keyboard.capsLock
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: "⚠ Verrouillage majuscules activé"
|
text: "⚠ " + t("sddm.caps_lock")
|
||||||
color: "#e6c07b"
|
color: "#e6c07b"
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
}
|
}
|
||||||
@@ -163,7 +208,7 @@ Rectangle {
|
|||||||
height: 44
|
height: 44
|
||||||
onClicked: doLogin()
|
onClicked: doLogin()
|
||||||
contentItem: Text {
|
contentItem: Text {
|
||||||
text: "Se connecter"
|
text: t("sddm.login_button")
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -233,8 +278,8 @@ Rectangle {
|
|||||||
anchors.margins: 24
|
anchors.margins: 24
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
PowerButton { label: "Redémarrer"; onClicked: sddm.reboot() }
|
PowerButton { label: t("sddm.reboot"); onClicked: sddm.reboot() }
|
||||||
PowerButton { label: "Éteindre"; onClicked: sddm.powerOff() }
|
PowerButton { label: t("sddm.power_off"); onClicked: sddm.powerOff() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nom de la machine, discret, en bas à gauche.
|
// Nom de la machine, discret, en bas à gauche.
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
# Thème SDDM « fws » — valeurs par défaut, surchargées par theme.conf.user
|
# Thème SDDM « fws » — valeurs par défaut, surchargées par theme.conf.user
|
||||||
# (écrit par le %post du kickstart : accent différent selon le bureau choisi).
|
# (écrit par le %post du kickstart : accent différent selon le bureau choisi).
|
||||||
|
# "greeting" is not set here: the translated welcome text is used unless an
|
||||||
|
# administrator sets one in theme.conf.user.
|
||||||
[General]
|
[General]
|
||||||
accent=#3daee9
|
accent=#3daee9
|
||||||
colorTop=#1a1a2e
|
colorTop=#1a1a2e
|
||||||
colorBottom=#16213e
|
colorBottom=#16213e
|
||||||
greeting=Bienvenue sur FWS
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
.pragma library
|
||||||
|
// Replaced at build time by /usr/local/lib/fws/translate-static-files.py with
|
||||||
|
// the sddm.* texts of system-translations.toml, every language included.
|
||||||
|
var messages = {};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
title FWS install medium (%ARCH%, UEFI)
|
||||||
|
sort-key 01
|
||||||
|
linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux
|
||||||
|
initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img
|
||||||
|
options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% udev.event_timeout=45
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Mode graphique de secours : SANS KMS (nomodeset). Filet de sécurité
|
||||||
|
# standard pour les GPU/hyperviseurs dont le pilote KMS pose problème :
|
||||||
|
# X démarre alors sur le framebuffer VESA/EFI (plus lent mais fiable).
|
||||||
|
title FWS install medium (%ARCH%, UEFI, safe graphics)
|
||||||
|
sort-key 01b
|
||||||
|
linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux
|
||||||
|
initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img
|
||||||
|
options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% nomodeset udev.event_timeout=45
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# « Réparer FWS » : boote le live SANS installateur et lance l'assistant de
|
||||||
|
# réparation en console (fws-recovery, via le hook fws.recovery=1 du
|
||||||
|
# .zprofile) : réinstaller GRUB, régénérer l'initramfs, réparer pacman,
|
||||||
|
# shell chroot — le point de restauration FWS.
|
||||||
|
title FWS - Reparer une installation (recovery)
|
||||||
|
sort-key 01d
|
||||||
|
linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux
|
||||||
|
initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img
|
||||||
|
options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% udev.event_timeout=45 fws.recovery=1
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
title FWS install medium (%ARCH%, UEFI) with speech
|
||||||
|
sort-key 02
|
||||||
|
linux /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux
|
||||||
|
initrd /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img
|
||||||
|
options archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID% accessibility=on udev.event_timeout=45
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
title Memtest86+
|
||||||
|
sort-key 03
|
||||||
|
efi /boot/memtest86+/memtest.efi
|
||||||
|
architecture x64
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
timeout 15
|
||||||
|
default 01-archiso-linux.conf
|
||||||
|
beep on
|
||||||
@@ -5,6 +5,14 @@ ParallelDownloads = 5
|
|||||||
CheckSpace
|
CheckSpace
|
||||||
# Same exclusions as configs/baseline/pacman.conf (which overrides this file).
|
# Same exclusions as configs/baseline/pacman.conf (which overrides this file).
|
||||||
NoExtract = usr/share/doc/* usr/share/gtk-doc/* boot/intel-ucode.img boot/amd-ucode.img
|
NoExtract = usr/share/doc/* usr/share/gtk-doc/* boot/intel-ucode.img boot/amd-ucode.img
|
||||||
|
# Firmware of router and server chips, never found in a PC (~47 MiB): Qualcomm
|
||||||
|
# IPQ/QCN Wi-Fi SoCs, MediaTek Filogic access points (mt7996), NXP DPAA2,
|
||||||
|
# Chelsio and Broadcom NetXtreme II server cards, QLogic NetXen. build.sh adds
|
||||||
|
# the firmware versions the kernel never loads (scripts/firmware-noextract.py).
|
||||||
|
NoExtract = usr/lib/firmware/ath11k/IPQ* usr/lib/firmware/ath11k/QCN9074* usr/lib/firmware/ath12k/IPQ* usr/lib/firmware/ath12k/QCN9274* usr/lib/firmware/mediatek/mt7996/* usr/lib/firmware/dpaa2/* usr/lib/firmware/cxgb4/* usr/lib/firmware/bnx2x/* usr/lib/firmware/phanfw.bin*
|
||||||
|
# Bytecode for "python -O" only (~7 MiB): nothing runs Python that way, and
|
||||||
|
# the plain .pyc next to them stays.
|
||||||
|
NoExtract = usr/lib/python3*/__pycache__/*.opt-1.pyc usr/lib/python3*/__pycache__/*.opt-2.pyc
|
||||||
|
|
||||||
SigLevel = Required DatabaseOptional
|
SigLevel = Required DatabaseOptional
|
||||||
LocalFileSigLevel = Optional
|
LocalFileSigLevel = Optional
|
||||||
|
|||||||
Executable
+559
@@ -0,0 +1,559 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ============================================================
|
||||||
|
# FWS — Release officielle d'une nouvelle ligne de version
|
||||||
|
#
|
||||||
|
# Déclencheur : le fichier VERSION passe à une NOUVELLE LIGNE mineure
|
||||||
|
# (0.8.* → 0.9.*, ou un nouveau majeur). Tant que la version reste sur la
|
||||||
|
# ligne déjà publiée (0.8.1 → 0.8.2), rien n'est publié : ce n'est pas une
|
||||||
|
# release de ligne. --force passe outre (correctif à republier).
|
||||||
|
#
|
||||||
|
# Déroulé :
|
||||||
|
# 1. Pré-vol : VERSION, tag/commit, tokens, accès aux deux forges.
|
||||||
|
# Tout est vérifié AVANT le build, qui dure ~20 min.
|
||||||
|
# 2. Build : ./build-offi.sh (build officiel versionné) →
|
||||||
|
# out/v<MAJ>/v<MAJ>.<MIN>/fws-<version>-<variante>-<date>.iso
|
||||||
|
# 3. Publication : release Gitea (FWS/FWS-ISO), puis GitHub
|
||||||
|
# (fws-linux/ISO), l'ISO jointe en asset aux deux.
|
||||||
|
#
|
||||||
|
# Les tokens ne sont jamais versionnés : $GITEA_TOKEN / $GITHUB_TOKEN, sinon
|
||||||
|
# lus dans ~/nottte.txt (FWS_RELEASE_NOTES_FILE pour un autre chemin).
|
||||||
|
#
|
||||||
|
# Rejouable : une release déjà existante est mise à jour et l'asset n'est
|
||||||
|
# réenvoyé que s'il manque — un échec d'upload se corrige en relançant
|
||||||
|
# --skip-build, sans reconstruire l'ISO.
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
trap 'rc=$?; echo -e "\e[31mÉchec (release.sh) ligne $LINENO, code $rc.\e[0m" >&2; exit $rc' ERR
|
||||||
|
|
||||||
|
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[0;34m'; BOLD='\033[1m'; NC='\033[0m'
|
||||||
|
info() { echo -e "${BLUE}==>${NC} $1"; }
|
||||||
|
success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||||
|
warn() { echo -e "${YELLOW}[!!]${NC} $1"; }
|
||||||
|
die() { echo -e "${RED}[ERR]${NC} $1" >&2; exit 1; }
|
||||||
|
|
||||||
|
# ─── Paramètres (surchargables par l'environnement) ──────────────────────────
|
||||||
|
WORK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
GITEA_URL="${FWS_GITEA_URL:-https://gitea.nocode-var.tech}"
|
||||||
|
GITEA_REPO="${FWS_GITEA_REPO:-FWS/FWS-ISO}"
|
||||||
|
GH_REPO="${FWS_GITHUB_REPO:-fws-linux/ISO}"
|
||||||
|
GH_API="${FWS_GITHUB_API:-https://api.github.com}"
|
||||||
|
GH_UPLOAD="${FWS_GITHUB_UPLOAD:-https://uploads.github.com}"
|
||||||
|
TOKENS_FILE="${FWS_RELEASE_TOKENS_FILE:-$HOME/nottte.txt}"
|
||||||
|
|
||||||
|
VARIANT=""
|
||||||
|
ISO_ARG=""
|
||||||
|
SKIP_BUILD=0
|
||||||
|
DRY_RUN=0
|
||||||
|
FORCE=0
|
||||||
|
CHECK=0
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<'EOF'
|
||||||
|
Usage : ./release.sh [options]
|
||||||
|
|
||||||
|
--variant <nom> Variante de l'ISO (cli, kde, gnome…). Demandée si absente.
|
||||||
|
--skip-build Réutilise l'ISO déjà présente dans out/ (retry d'upload).
|
||||||
|
--iso <fichier> Publie cette ISO-là au lieu de la chercher dans out/.
|
||||||
|
Utile quand le build se fait sur une machine et la
|
||||||
|
publication sur une autre (ou depuis une CI sans
|
||||||
|
privilèges, cf. workflow release).
|
||||||
|
--force Publie même sans changement de ligne de version.
|
||||||
|
--dry-run N'exécute ni le build ni les appels réseau ; montre le plan.
|
||||||
|
--check Décide seulement s'il faut publier (code retour 0 dans tous
|
||||||
|
les cas ; 'publish=true|false' écrit dans $GITHUB_OUTPUT).
|
||||||
|
Mode utilisé par le workflow .gitea/workflows/release.yml.
|
||||||
|
-h, --help Cette aide.
|
||||||
|
|
||||||
|
Environnement :
|
||||||
|
GITEA_TOKEN / GITHUB_TOKEN Tokens d'API (sinon lus dans ~/nottte.txt).
|
||||||
|
FWS_RELEASE_TOKENS_FILE Autre fichier de notes.
|
||||||
|
FWS_GITEA_URL / FWS_GITEA_REPO / FWS_GITHUB_REPO Cibles.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--variant) VARIANT="${2:-}"; [ -n "$VARIANT" ] || die "--variant attend un nom."; shift 2 ;;
|
||||||
|
--variant=*) VARIANT="${1#*=}"; shift ;;
|
||||||
|
--skip-build) SKIP_BUILD=1; shift ;;
|
||||||
|
--iso) ISO_ARG="${2:-}"; [ -n "$ISO_ARG" ] || die "--iso attend un chemin."; SKIP_BUILD=1; shift 2 ;;
|
||||||
|
--iso=*) ISO_ARG="${1#*=}"; SKIP_BUILD=1; shift ;;
|
||||||
|
--force) FORCE=1; shift ;;
|
||||||
|
--dry-run) DRY_RUN=1; shift ;;
|
||||||
|
--check) CHECK=1; shift ;;
|
||||||
|
-h|--help) usage; exit 0 ;;
|
||||||
|
*) die "Option inconnue : $1 (voir --help)." ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# ─── VERSION ─────────────────────────────────────────────────────────────────
|
||||||
|
[ -f "$WORK_DIR/VERSION" ] || die "Fichier VERSION introuvable dans $WORK_DIR."
|
||||||
|
VERSION="$(tr -d ' \t\r\n' < "$WORK_DIR/VERSION")"
|
||||||
|
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|
||||||
|
|| die "VERSION '$VERSION' invalide (attendu major.minor.build, ex. 0.9.0)."
|
||||||
|
IFS='.' read -r MAJOR MINOR BUILD <<< "$VERSION"
|
||||||
|
TAG="v$VERSION"
|
||||||
|
|
||||||
|
# ─── Nouvelle ligne de version ? ─────────────────────────────────────────────
|
||||||
|
# Previous released version = highest tag, normalized (repo history has both
|
||||||
|
# "0.6.0" and "V0.8.1" spellings).
|
||||||
|
# sed, not grep: under `set -o pipefail` a tag list without a version would
|
||||||
|
# end the script here, before the "no tag" case below.
|
||||||
|
PREV_VERSION="$(git -C "$WORK_DIR" tag -l \
|
||||||
|
| sed -n 's/^[vV]\{0,1\}\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)$/\1/p' \
|
||||||
|
| sort -V | tail -1)"
|
||||||
|
|
||||||
|
if [ -z "$PREV_VERSION" ]; then
|
||||||
|
MODE="release"
|
||||||
|
warn "Aucun tag de version dans le dépôt : tout VERSION est traité comme une release."
|
||||||
|
elif [ "$PREV_VERSION" = "$VERSION" ] && [ "$FORCE" -eq 0 ]; then
|
||||||
|
# Same version already tagged: a previous run may have failed mid-upload.
|
||||||
|
MODE="retry"
|
||||||
|
info "Version $VERSION déjà taguée — reprise (release mise à jour, asset manquant réenvoyé)."
|
||||||
|
elif [ "${PREV_VERSION%.*}" = "${MAJOR}.${MINOR}" ] && [ "$FORCE" -eq 0 ]; then
|
||||||
|
# Not an error: the workflow calls --check on every VERSION change and
|
||||||
|
# must still get an explicit publish=false here.
|
||||||
|
MODE="skip"
|
||||||
|
info "VERSION $VERSION reste sur la ligne ${MAJOR}.${MINOR} (dernier tag : $PREV_VERSION)."
|
||||||
|
echo " Une release n'est publiée qu'au changement de ligne (0.8.* → 0.9.*). --force pour publier quand même."
|
||||||
|
[ "$CHECK" -eq 1 ] || exit 0
|
||||||
|
elif [ "${PREV_VERSION%.*}" = "${MAJOR}.${MINOR}" ]; then
|
||||||
|
MODE="release"
|
||||||
|
info "Publication forcée sur la ligne ${MAJOR}.${MINOR} (version publiée : $VERSION)."
|
||||||
|
else
|
||||||
|
MODE="release"
|
||||||
|
info "Nouvelle ligne de version : ${PREV_VERSION%.*} → ${MAJOR}.${MINOR} (version publiée : $VERSION)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The workflow asks here and nowhere else, so the rule lives in one place.
|
||||||
|
if [ "$CHECK" -eq 1 ]; then
|
||||||
|
if [ "$MODE" = "release" ] || [ "$MODE" = "retry" ]; then
|
||||||
|
PUBLISH=true
|
||||||
|
else
|
||||||
|
PUBLISH=false
|
||||||
|
fi
|
||||||
|
echo "publish=$PUBLISH"
|
||||||
|
[ -z "${GITHUB_OUTPUT:-}" ] || echo "publish=$PUBLISH" >> "$GITHUB_OUTPUT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ─── Contrôles locaux ────────────────────────────────────────────────────────
|
||||||
|
for cmd in git curl jq; do
|
||||||
|
command -v "$cmd" >/dev/null 2>&1 \
|
||||||
|
|| die "$cmd introuvable (Arch : sudo pacman -S --needed git curl jq)."
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -x "$WORK_DIR/build-offi.sh" ] || die "build-offi.sh absent ou non exécutable."
|
||||||
|
|
||||||
|
# The release tag is created remotely from target_commitish, so HEAD must
|
||||||
|
# already exist on the remote: tagging an unpushed commit fails at the API.
|
||||||
|
# In CI the workflow is triggered by the pushed commit itself, and a shallow
|
||||||
|
# runner checkout has no usable origin/Main to compare against.
|
||||||
|
if [ "$DRY_RUN" -eq 0 ] && [ -z "${CI:-}" ] && [ -z "${GITHUB_ACTIONS:-}" ]; then
|
||||||
|
info "Vérification que HEAD est publié sur origin/Main…"
|
||||||
|
git -C "$WORK_DIR" fetch -q origin Main 2>/dev/null || warn "git fetch impossible (réseau ?)."
|
||||||
|
if git -C "$WORK_DIR" rev-parse -q --verify origin/Main >/dev/null; then
|
||||||
|
git -C "$WORK_DIR" merge-base --is-ancestor HEAD origin/Main \
|
||||||
|
|| die "HEAD n'est pas sur origin/Main : pousse ton commit (git push) avant de publier."
|
||||||
|
success "HEAD est bien sur origin/Main."
|
||||||
|
else
|
||||||
|
warn "origin/Main inconnu localement — impossible de vérifier le commit publié."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
HEAD_SHA="$(git -C "$WORK_DIR" rev-parse HEAD)"
|
||||||
|
|
||||||
|
# ─── Tokens ──────────────────────────────────────────────────────────────────
|
||||||
|
# Never echo a token, not even a prefix: the output of a release ends up in
|
||||||
|
# CI logs and shells scrollback.
|
||||||
|
token_from_notes() { # regex → first match, empty when the file is unusable
|
||||||
|
[ -r "$TOKENS_FILE" ] || return 0
|
||||||
|
grep -oE "$1" "$TOKENS_FILE" 2>/dev/null | head -1 || true
|
||||||
|
}
|
||||||
|
|
||||||
|
GITEA_TOKEN="${GITEA_TOKEN:-$(token_from_notes '^[0-9a-f]{40}$')}"
|
||||||
|
# GitHub classic and fine-grained tokens share no prefix, so both are tried.
|
||||||
|
GITHUB_TOKEN="${GITHUB_TOKEN:-$(token_from_notes 'gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}')}"
|
||||||
|
|
||||||
|
# A dry run touches neither forge, so it must stay usable without secrets.
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
info "[dry-run] jetons non requis."
|
||||||
|
else
|
||||||
|
[ -n "$GITEA_TOKEN" ] \
|
||||||
|
|| die "Token Gitea absent : export GITEA_TOKEN=… ou ajoute-le à $TOKENS_FILE."
|
||||||
|
[ -n "$GITHUB_TOKEN" ] \
|
||||||
|
|| die "Token GitHub absent : export GITHUB_TOKEN=… ou ajoute-le à $TOKENS_FILE."
|
||||||
|
success "Tokens Gitea et GitHub chargés."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ─── Pré-vol des forges ──────────────────────────────────────────────────────
|
||||||
|
# --retry-all-errors: an ISO upload can fail on a DNS hiccup halfway through,
|
||||||
|
# which is not in curl's default "transient" list.
|
||||||
|
CURL=(curl -sS --connect-timeout 20 --retry 3 --retry-delay 2 --retry-all-errors)
|
||||||
|
HTTP_CODE=""; HTTP_BODY=""
|
||||||
|
|
||||||
|
request() { # <curl args…> → sets HTTP_CODE/HTTP_BODY
|
||||||
|
local out; out="$(mktemp)"
|
||||||
|
# curl still prints 000 through -w when it fails, so the "|| echo 000" it
|
||||||
|
# used to have produced a useless "000000".
|
||||||
|
HTTP_CODE="$("${CURL[@]}" "$@" -o "$out" -w '%{http_code}' 2>/dev/null)" || HTTP_CODE="000"
|
||||||
|
[ -n "$HTTP_CODE" ] || HTTP_CODE="000"
|
||||||
|
HTTP_BODY="$(cat "$out")"
|
||||||
|
rm -f "$out"
|
||||||
|
}
|
||||||
|
|
||||||
|
# What a failed asset upload actually means: the two forges fail for very
|
||||||
|
# different reasons, and neither is obvious from the bare status code.
|
||||||
|
upload_error() { # <forge> <status>
|
||||||
|
case "$2" in
|
||||||
|
413) echo "$1 : 413 Request Entity Too Large — c'est le reverse proxy (nginx, client_max_body_size), pas Gitea : monte-le à 2g ou plus puis recharge nginx." ;;
|
||||||
|
413*) echo "$1 : fichier trop gros pour le proxy (413)." ;;
|
||||||
|
000) echo "$1 : connexion interrompue (réseau/DNS) pendant l'envoi de l'ISO — relance avec --skip-build." ;;
|
||||||
|
401|403) echo "$1 : token sans droit d'écrire les assets (HTTP $2)." ;;
|
||||||
|
*) echo "$1 : envoi de l'ISO refusé (HTTP $2)." ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
preflight_forges() {
|
||||||
|
local perms
|
||||||
|
|
||||||
|
info "Pré-vol Gitea ($GITEA_URL/$GITEA_REPO)…"
|
||||||
|
request -H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
"$GITEA_URL/api/v1/repos/$GITEA_REPO"
|
||||||
|
case "$HTTP_CODE" in
|
||||||
|
200) ;;
|
||||||
|
401) die "Gitea : token refusé (401). Vérifie GITEA_TOKEN." ;;
|
||||||
|
403) die "Gitea : token sans accès au dépôt (403)." ;;
|
||||||
|
404) die "Gitea : dépôt $GITEA_REPO introuvable ou invisible avec ce token (404)." ;;
|
||||||
|
*) die "Gitea : réponse HTTP $HTTP_CODE — $(echo "$HTTP_BODY" | head -c 200)" ;;
|
||||||
|
esac
|
||||||
|
perms="$(echo "$HTTP_BODY" | jq -r '.permissions.push // empty')"
|
||||||
|
[ "$perms" = "true" ] || die "Gitea : le token n'a pas le droit d'écrire sur $GITEA_REPO."
|
||||||
|
success "Gitea accessible en écriture."
|
||||||
|
|
||||||
|
info "Pré-vol GitHub ($GH_REPO)…"
|
||||||
|
request -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H 'Accept: application/vnd.github+json' \
|
||||||
|
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||||
|
"$GH_API/repos/$GH_REPO"
|
||||||
|
case "$HTTP_CODE" in
|
||||||
|
200) ;;
|
||||||
|
401) die "GitHub : token refusé (401)." ;;
|
||||||
|
403) die "GitHub : token sans droits (403) — scope 'repo' ou permission Contents." ;;
|
||||||
|
404) die "GitHub : dépôt $GH_REPO introuvable ou invisible avec ce token (404)." ;;
|
||||||
|
*) die "GitHub : réponse HTTP $HTTP_CODE — $(echo "$HTTP_BODY" | head -c 200)" ;;
|
||||||
|
esac
|
||||||
|
perms="$(echo "$HTTP_BODY" | jq -r '.permissions.push // empty')"
|
||||||
|
if [ -n "$perms" ] && [ "$perms" != "true" ]; then
|
||||||
|
die "GitHub : le token n'a pas le droit d'écrire sur $GH_REPO."
|
||||||
|
fi
|
||||||
|
success "GitHub accessible."
|
||||||
|
|
||||||
|
# The GitHub repo mirrors releases only: its history is unrelated to this
|
||||||
|
# one, so the built commit may not exist there. The release API rejects an
|
||||||
|
# unknown target_commitish, so the tag is left on GitHub's default branch
|
||||||
|
# when ours is absent (the ISO asset is what users download either way).
|
||||||
|
request -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H 'Accept: application/vnd.github+json' \
|
||||||
|
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||||
|
"$GH_API/repos/$GH_REPO/commits/$HEAD_SHA"
|
||||||
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
GH_TARGET="$HEAD_SHA"
|
||||||
|
success "GitHub : le commit $HEAD_SHA y est présent, le tag le pointera."
|
||||||
|
else
|
||||||
|
GH_TARGET=""
|
||||||
|
warn "GitHub : commit $HEAD_SHA absent du dépôt — le tag y suivra sa branche par défaut."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
info "[dry-run] pré-vol des forges sauté."
|
||||||
|
else
|
||||||
|
preflight_forges
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ─── Build officiel ──────────────────────────────────────────────────────────
|
||||||
|
if [ "$SKIP_BUILD" -eq 1 ]; then
|
||||||
|
info "Build sauté (--skip-build) : réutilisation de l'ISO existante."
|
||||||
|
else
|
||||||
|
if [ -z "$VARIANT" ]; then
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
VARIANT="<variante>"
|
||||||
|
warn "[dry-run] variante non fournie (--variant)."
|
||||||
|
else
|
||||||
|
read -rp "==> Nom de la variante (ex. cli, kde, gnome) : " VARIANT || die "Entrée requise."
|
||||||
|
VARIANT="$(printf '%s' "$VARIANT" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9-')"
|
||||||
|
[ -n "$VARIANT" ] || die "Nom de variante invalide."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
info "Build officiel $VERSION ($VARIANT)…"
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
echo " ./build-offi.sh (FWS_ISO_VERSION=$VERSION FWS_ISO_TAG=$VARIANT)"
|
||||||
|
else
|
||||||
|
# build-offi.sh lit ces deux variables et ne les redemande pas : le
|
||||||
|
# release reste non interactif, y compris à travers sudo -E / podman.
|
||||||
|
FWS_ISO_VERSION="$VERSION" FWS_ISO_TAG="$VARIANT" "$WORK_DIR/build-offi.sh"
|
||||||
|
success "Build officiel terminé."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ─── ISO produite ────────────────────────────────────────────────────────────
|
||||||
|
ISO_DIR="$WORK_DIR/out/v${MAJOR}/v${MAJOR}.${MINOR}"
|
||||||
|
ISO_PATH=""
|
||||||
|
if [ -n "$ISO_ARG" ]; then
|
||||||
|
# An ISO built elsewhere: resolve it against the caller's cwd before any
|
||||||
|
# cd, and let the name stay whatever the build produced.
|
||||||
|
[ -f "$ISO_ARG" ] || die "ISO introuvable : $ISO_ARG"
|
||||||
|
ISO_PATH="$(cd "$(dirname "$ISO_ARG")" && pwd)/$(basename "$ISO_ARG")"
|
||||||
|
fi
|
||||||
|
if [ -z "$ISO_PATH" ] && [ -n "$VARIANT" ]; then
|
||||||
|
# Newest first: a retry the day after must pick the last build, not an old one.
|
||||||
|
ISO_PATH="$(ls -1t "$ISO_DIR"/fws-"$VERSION"-"$VARIANT"-*.iso 2>/dev/null | head -1 || true)"
|
||||||
|
fi
|
||||||
|
if [ -z "$ISO_PATH" ]; then
|
||||||
|
ISO_PATH="$(ls -1t "$ISO_DIR"/fws-"$VERSION"-*.iso 2>/dev/null | head -1 || true)"
|
||||||
|
fi
|
||||||
|
if [ -z "$ISO_PATH" ] || [ ! -f "$ISO_PATH" ]; then
|
||||||
|
# A dry run never builds: show where the ISO is expected instead of failing.
|
||||||
|
[ "$DRY_RUN" -eq 1 ] || die "Aucune ISO $VERSION dans $ISO_DIR (build absent ? lance sans --skip-build)."
|
||||||
|
ISO_PATH="$ISO_DIR/fws-$VERSION-$VARIANT-<AAAA.MM.JJ>.iso"
|
||||||
|
ISO_NAME="$(basename "$ISO_PATH")"
|
||||||
|
ISO_BYTES=0
|
||||||
|
warn "[dry-run] ISO pas encore construite : $ISO_PATH"
|
||||||
|
else
|
||||||
|
ISO_NAME="$(basename "$ISO_PATH")"
|
||||||
|
ISO_BYTES="$(stat -c %s "$ISO_PATH" 2>/dev/null || echo 0)"
|
||||||
|
[ "$ISO_BYTES" -gt 0 ] || die "ISO vide : $ISO_PATH"
|
||||||
|
info "ISO : $ISO_NAME ($(( ISO_BYTES / 1024 / 1024 )) Mio)"
|
||||||
|
|
||||||
|
# 2 GiB is GitHub's hard per-asset limit; Gitea's is configurable, so only
|
||||||
|
# GitHub is checked up front.
|
||||||
|
GH_LIMIT=2147483648
|
||||||
|
[ "$ISO_BYTES" -lt "$GH_LIMIT" ] \
|
||||||
|
|| warn "ISO > 2 Gio : GitHub refusera l'asset (limite 2147483648 octets)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ─── Notes de version ────────────────────────────────────────────────────────
|
||||||
|
# Inline RST literals are the only markup in the changelog; sections become
|
||||||
|
# "### Added" so the text reads correctly on both forge web UIs.
|
||||||
|
rst_to_markdown() {
|
||||||
|
awk '
|
||||||
|
{ line[NR] = $0 }
|
||||||
|
END {
|
||||||
|
for (i = 1; i <= NR; i++) {
|
||||||
|
cur = line[i]
|
||||||
|
if (cur ~ /^[=~-]{3,}[[:space:]]*$/) continue
|
||||||
|
if (i < NR && line[i+1] ~ /^[=~-]{3,}[[:space:]]*$/ && cur ~ /[^[:space:]]/) {
|
||||||
|
printf "### %s\n\n", cur
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
print cur
|
||||||
|
}
|
||||||
|
}' | sed -e 's/``\([^`]*\)``/`\1`/g'
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f "$WORK_DIR/changelog/RELEASE-NOTES-$VERSION.md" ]; then
|
||||||
|
BODY="$(cat "$WORK_DIR/changelog/RELEASE-NOTES-$VERSION.md")"
|
||||||
|
NOTES_SRC="changelog/RELEASE-NOTES-$VERSION.md"
|
||||||
|
elif awk -v v="$VERSION" 'index($0, "[" v "]") == 1 { found = 1 } END { exit !found }' \
|
||||||
|
"$WORK_DIR/CHANGELOG.rst" 2>/dev/null; then
|
||||||
|
BODY="# FWS $VERSION
|
||||||
|
|
||||||
|
$(awk -v v="$VERSION" '
|
||||||
|
index($0, "[" v "]") == 1 { keep = 1; next }
|
||||||
|
keep && $0 ~ /^\[[0-9]+\.[0-9]+/ { exit }
|
||||||
|
keep { print }
|
||||||
|
' "$WORK_DIR/CHANGELOG.rst" | rst_to_markdown)"
|
||||||
|
NOTES_SRC="CHANGELOG.rst ($VERSION)"
|
||||||
|
else
|
||||||
|
BODY="FWS $VERSION — $(date +%Y-%m-%d)"
|
||||||
|
NOTES_SRC="(aucune)"
|
||||||
|
warn "Aucune note de version pour $VERSION (ni RELEASE-NOTES, ni section CHANGELOG)."
|
||||||
|
fi
|
||||||
|
info "Notes de version : $NOTES_SRC ($(printf '%s\n' "$BODY" | wc -l) lignes)."
|
||||||
|
|
||||||
|
# ─── Publication ─────────────────────────────────────────────────────────────
|
||||||
|
GITEA_RESULT="échec"
|
||||||
|
GITHUB_RESULT="échec"
|
||||||
|
|
||||||
|
# A failing forge must not abort the script: both are attempted, and the
|
||||||
|
# summary says what is missing. Hence no `die` inside the publishers.
|
||||||
|
pub_err() { echo -e "${RED}[ERR]${NC} $1" >&2; }
|
||||||
|
|
||||||
|
gitea_api() { # <method> <path> [curl args…]
|
||||||
|
local method="$1" path="$2"; shift 2
|
||||||
|
request -X "$method" -H "Authorization: token $GITEA_TOKEN" "$@" \
|
||||||
|
"$GITEA_URL/api/v1/repos/$GITEA_REPO$path"
|
||||||
|
}
|
||||||
|
|
||||||
|
publish_gitea() {
|
||||||
|
local api="$GITEA_URL/api/v1/repos/$GITEA_REPO"
|
||||||
|
local release_id=""
|
||||||
|
|
||||||
|
info "Gitea : recherche d'une release $TAG…"
|
||||||
|
gitea_api GET "/releases/tags/$TAG"
|
||||||
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
release_id="$(echo "$HTTP_BODY" | jq -r '.id // empty')"
|
||||||
|
info "Gitea : release $TAG existante (id $release_id) — mise à jour."
|
||||||
|
local payload
|
||||||
|
payload="$(jq -n --arg name "FWS $VERSION" --arg body "$BODY" \
|
||||||
|
'{name:$name, body:$body, draft:false, prerelease:false}')"
|
||||||
|
gitea_api PATCH "/releases/$release_id" \
|
||||||
|
-H 'Content-Type: application/json' --data-binary "$payload"
|
||||||
|
[ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ] \
|
||||||
|
|| { pub_err "Gitea : mise à jour de la release impossible (HTTP $HTTP_CODE) — $(echo "$HTTP_BODY" | head -c 200)"; return 1; }
|
||||||
|
else
|
||||||
|
local payload
|
||||||
|
# target_commitish pins the remote tag to the exact commit that was
|
||||||
|
# built, instead of whatever the default branch points at later.
|
||||||
|
payload="$(jq -n --arg tag "$TAG" --arg target "$HEAD_SHA" \
|
||||||
|
--arg name "FWS $VERSION" --arg body "$BODY" \
|
||||||
|
'{tag_name:$tag, target_commitish:$target, name:$name, body:$body, draft:false, prerelease:false}')"
|
||||||
|
gitea_api POST "/releases" \
|
||||||
|
-H 'Content-Type: application/json' --data-binary "$payload"
|
||||||
|
[ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ] \
|
||||||
|
|| { pub_err "Gitea : création de la release impossible (HTTP $HTTP_CODE) — $(echo "$HTTP_BODY" | head -c 200)"; return 1; }
|
||||||
|
release_id="$(echo "$HTTP_BODY" | jq -r '.id // empty')"
|
||||||
|
success "Gitea : release $TAG créée."
|
||||||
|
fi
|
||||||
|
[ -n "$release_id" ] || { pub_err "Gitea : identifiant de release illisible."; return 1; }
|
||||||
|
|
||||||
|
local html_url
|
||||||
|
html_url="$(echo "$HTTP_BODY" | jq -r '.html_url // empty')"
|
||||||
|
|
||||||
|
info "Gitea : envoi de $ISO_NAME ($(( ISO_BYTES / 1024 / 1024 )) Mio)…"
|
||||||
|
gitea_api GET "/releases/$release_id/assets"
|
||||||
|
if echo "$HTTP_BODY" | jq -e --arg n "$ISO_NAME" 'any(.[]; .name == $n)' >/dev/null 2>&1; then
|
||||||
|
warn "Gitea : $ISO_NAME déjà joint à la release — envoi sauté."
|
||||||
|
else
|
||||||
|
# -F streams the file as multipart; nothing is loaded entirely in RAM.
|
||||||
|
gitea_api POST "/releases/$release_id/assets?name=$ISO_NAME" \
|
||||||
|
-F "attachment=@$ISO_PATH"
|
||||||
|
[ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ] \
|
||||||
|
|| { pub_err "$(upload_error Gitea "$HTTP_CODE")"; return 1; }
|
||||||
|
success "Gitea : ISO jointe."
|
||||||
|
fi
|
||||||
|
|
||||||
|
GITEA_RESULT="ok"
|
||||||
|
GITEA_URL_SHOWN="${html_url:-$GITEA_URL/$GITEA_REPO/releases/tag/$TAG}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gh_api() { # <method> <path> [curl args…]
|
||||||
|
local method="$1" path="$2"; shift 2
|
||||||
|
request -X "$method" -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H 'Accept: application/vnd.github+json' \
|
||||||
|
-H 'X-GitHub-Api-Version: 2022-11-28' "$@" "$GH_API$path"
|
||||||
|
}
|
||||||
|
|
||||||
|
publish_github() {
|
||||||
|
local release_id=""
|
||||||
|
|
||||||
|
info "GitHub : recherche d'une release $TAG…"
|
||||||
|
gh_api GET "/repos/$GH_REPO/releases/tags/$TAG"
|
||||||
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
release_id="$(echo "$HTTP_BODY" | jq -r '.id // empty')"
|
||||||
|
info "GitHub : release $TAG existante (id $release_id) — mise à jour."
|
||||||
|
local payload
|
||||||
|
payload="$(jq -n --arg name "FWS $VERSION" --arg body "$BODY" \
|
||||||
|
'{name:$name, body:$body, draft:false, prerelease:false}')"
|
||||||
|
gh_api PATCH "/repos/$GH_REPO/releases/$release_id" \
|
||||||
|
-H 'Content-Type: application/json' --data-binary "$payload"
|
||||||
|
[ "$HTTP_CODE" = "200" ] \
|
||||||
|
|| { pub_err "GitHub : mise à jour de la release impossible (HTTP $HTTP_CODE) — $(echo "$HTTP_BODY" | head -c 200)"; return 1; }
|
||||||
|
else
|
||||||
|
local payload
|
||||||
|
payload="$(jq -n --arg tag "$TAG" --arg target "${GH_TARGET:-}" \
|
||||||
|
--arg name "FWS $VERSION" --arg body "$BODY" \
|
||||||
|
'{tag_name:$tag, name:$name, body:$body, draft:false, prerelease:false}
|
||||||
|
+ (if $target != "" then {target_commitish:$target} else {} end)')"
|
||||||
|
gh_api POST "/repos/$GH_REPO/releases" \
|
||||||
|
-H 'Content-Type: application/json' --data-binary "$payload"
|
||||||
|
[ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ] \
|
||||||
|
|| { pub_err "GitHub : création de la release impossible (HTTP $HTTP_CODE) — $(echo "$HTTP_BODY" | head -c 200)"; return 1; }
|
||||||
|
release_id="$(echo "$HTTP_BODY" | jq -r '.id // empty')"
|
||||||
|
success "GitHub : release $TAG créée."
|
||||||
|
fi
|
||||||
|
[ -n "$release_id" ] || { pub_err "GitHub : identifiant de release illisible."; return 1; }
|
||||||
|
|
||||||
|
local html_url
|
||||||
|
html_url="$(echo "$HTTP_BODY" | jq -r '.html_url // empty')"
|
||||||
|
|
||||||
|
info "GitHub : envoi de $ISO_NAME ($(( ISO_BYTES / 1024 / 1024 )) Mio)…"
|
||||||
|
gh_api GET "/repos/$GH_REPO/releases/$release_id/assets"
|
||||||
|
local existing_id existing_state
|
||||||
|
existing_id="$(echo "$HTTP_BODY" | jq -r --arg n "$ISO_NAME" '[.[] | select(.name == $n)] | first | .id // empty' 2>/dev/null || true)"
|
||||||
|
existing_state="$(echo "$HTTP_BODY" | jq -r --arg n "$ISO_NAME" '[.[] | select(.name == $n)] | first | .state // empty' 2>/dev/null || true)"
|
||||||
|
if [ -n "$existing_id" ] && [ "$existing_state" = "uploaded" ]; then
|
||||||
|
warn "GitHub : $ISO_NAME déjà joint et complet — envoi sauté."
|
||||||
|
else
|
||||||
|
# A "starter" asset is a transfer that never finished: it holds the name
|
||||||
|
# without holding a usable file, so it has to go before the retry.
|
||||||
|
if [ -n "$existing_id" ]; then
|
||||||
|
warn "GitHub : $ISO_NAME présent mais incomplet (état '${existing_state:-?}') — suppression puis renvoi."
|
||||||
|
gh_api DELETE "/repos/$GH_REPO/releases/assets/$existing_id"
|
||||||
|
[ "$HTTP_CODE" = "204" ] \
|
||||||
|
|| { pub_err "GitHub : suppression de l'asset incomplet impossible (HTTP $HTTP_CODE)."; return 1; }
|
||||||
|
fi
|
||||||
|
# Assets are served by uploads.github.com, not api.github.com: the
|
||||||
|
# request goes to that host verbatim. -T streams the file, -X POST
|
||||||
|
# because GitHub accepts nothing else for an asset upload.
|
||||||
|
request -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H 'Accept: application/vnd.github+json' \
|
||||||
|
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||||
|
-H 'Content-Type: application/octet-stream' \
|
||||||
|
-T "$ISO_PATH" \
|
||||||
|
"$GH_UPLOAD/repos/$GH_REPO/releases/$release_id/assets?name=$ISO_NAME"
|
||||||
|
[ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ] \
|
||||||
|
|| { pub_err "$(upload_error GitHub "$HTTP_CODE")"; return 1; }
|
||||||
|
|
||||||
|
# An accepted request is not a stored file: GitHub keeps a "starter"
|
||||||
|
# asset when the transfer dies halfway, which is invisible in the UI
|
||||||
|
# until someone tries to download the ISO.
|
||||||
|
gh_api GET "/repos/$GH_REPO/releases/$release_id/assets"
|
||||||
|
if echo "$HTTP_BODY" | jq -e --arg n "$ISO_NAME" \
|
||||||
|
'any(.[]; .name == $n and .state == "uploaded")' >/dev/null 2>&1; then
|
||||||
|
success "GitHub : ISO jointe et finalisée."
|
||||||
|
else
|
||||||
|
pub_err "GitHub : l'asset $ISO_NAME n'est pas finalisé (état incomplet) — relance avec --skip-build."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
GITHUB_RESULT="ok"
|
||||||
|
GITHUB_URL_SHOWN="${html_url:-https://github.com/$GH_REPO/releases/tag/$TAG}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
|
echo ""
|
||||||
|
info "[dry-run] Aucun appel réseau, aucun build. Plan qui serait exécuté :"
|
||||||
|
echo " mode : $MODE"
|
||||||
|
echo " version : $VERSION → tag $TAG (commit $HEAD_SHA)"
|
||||||
|
echo " variante : ${VARIANT:-<demandée>}"
|
||||||
|
echo " ISO : $ISO_PATH"
|
||||||
|
echo " notes : $NOTES_SRC"
|
||||||
|
echo " Gitea : POST $GITEA_URL/api/v1/repos/$GITEA_REPO/releases"
|
||||||
|
echo " GitHub : POST $GH_API/repos/$GH_REPO/releases (+ $GH_UPLOAD)"
|
||||||
|
echo ""
|
||||||
|
info "Aperçu des notes de version :"
|
||||||
|
printf '%s\n' "$BODY" | head -12
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Both forges are attempted even if the first fails: a failed run must still
|
||||||
|
# deliver what it can, and the summary below says exactly what is missing.
|
||||||
|
publish_gitea || warn "Gitea : publication échouée (voir ci-dessus)."
|
||||||
|
publish_github || warn "GitHub : publication échouée (voir ci-dessus)."
|
||||||
|
|
||||||
|
# ─── Bilan ───────────────────────────────────────────────────────────────────
|
||||||
|
echo ""
|
||||||
|
echo -e "${BOLD}Release $VERSION${NC}"
|
||||||
|
echo " ISO : $ISO_NAME ($(( ISO_BYTES / 1024 / 1024 )) Mio)"
|
||||||
|
echo " Gitea : $GITEA_RESULT${GITEA_URL_SHOWN:+ — $GITEA_URL_SHOWN}"
|
||||||
|
echo " GitHub : $GITHUB_RESULT${GITHUB_URL_SHOWN:+ — $GITHUB_URL_SHOWN}"
|
||||||
|
|
||||||
|
if [ "$GITEA_RESULT" != "ok" ] || [ "$GITHUB_RESULT" != "ok" ]; then
|
||||||
|
die "Release incomplète — relance './release.sh --variant ${VARIANT:-<variante>} --skip-build' après correction."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${GREEN}Release $VERSION publiée sur les deux forges.${NC}"
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Check the FWS installer translations file.
|
|
||||||
|
|
||||||
Errors (exit status 1):
|
|
||||||
- the file is not valid TOML;
|
|
||||||
- a message has no "en" text (the fallback of every language);
|
|
||||||
- a language code does not look like an Anaconda one (fr, pt_BR, sr@latin);
|
|
||||||
- a translation does not use exactly the same {placeholders} as "en";
|
|
||||||
- the code asks for a key that the file does not define.
|
|
||||||
Warnings: keys defined but never used.
|
|
||||||
The summary lists how many messages each language translates.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import pathlib
|
|
||||||
import re
|
|
||||||
import string
|
|
||||||
import sys
|
|
||||||
import tomllib
|
|
||||||
|
|
||||||
REPO = pathlib.Path(__file__).resolve().parent.parent
|
|
||||||
DEFAULT_FILE = REPO / "configs/baseline/airootfs/usr/local/share/fws/installer-translations.toml"
|
|
||||||
CODE_ROOTS = [REPO / "configs/baseline/airootfs", REPO / "configs/releng/airootfs"]
|
|
||||||
|
|
||||||
LANGUAGE_CODE = re.compile(r"^[a-z]{2,3}(_[A-Z]{2})?(@[a-z]+)?$")
|
|
||||||
# t("key") in Python; in shell, the "fws:key" form that hands a key over to the
|
|
||||||
# installer's progress screen, and calls to the fws-i18n command.
|
|
||||||
PY_USAGE = re.compile(r"""\bt\(\s*["']([a-z0-9_]+(?:\.[a-z0-9_]+)+)["']""")
|
|
||||||
SHELL_USAGE = re.compile(r"""(?:\bfws:|\bfws-i18n\s+)([a-z0-9_]+(?:\.[a-z0-9_]+)+)\b""")
|
|
||||||
|
|
||||||
|
|
||||||
def flatten(table, prefix=""):
|
|
||||||
texts = {name: value for name, value in table.items() if not isinstance(value, dict)}
|
|
||||||
if texts and prefix:
|
|
||||||
yield prefix, texts
|
|
||||||
for name, value in table.items():
|
|
||||||
if isinstance(value, dict):
|
|
||||||
yield from flatten(value, f"{prefix}.{name}" if prefix else name)
|
|
||||||
|
|
||||||
|
|
||||||
def placeholders(text):
|
|
||||||
return {field for _, field, _, _ in string.Formatter().parse(text) if field is not None}
|
|
||||||
|
|
||||||
|
|
||||||
def used_keys():
|
|
||||||
keys = {}
|
|
||||||
for root in CODE_ROOTS:
|
|
||||||
for path in root.rglob("*"):
|
|
||||||
if not path.is_file() or "__pycache__" in path.parts:
|
|
||||||
continue
|
|
||||||
if path.suffix not in (".py", ".sh", ".ks", "") and path.name != ".xinitrc":
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
text = path.read_text(encoding="utf-8")
|
|
||||||
except (UnicodeDecodeError, OSError):
|
|
||||||
continue
|
|
||||||
for pattern in (PY_USAGE, SHELL_USAGE):
|
|
||||||
for match in pattern.finditer(text):
|
|
||||||
keys.setdefault(match.group(1), path.relative_to(REPO))
|
|
||||||
return keys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
|
||||||
parser.add_argument("--file", type=pathlib.Path, default=DEFAULT_FILE)
|
|
||||||
parser.add_argument("--skip-usage", action="store_true",
|
|
||||||
help="do not compare the keys with the code (checking a fragment)")
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
errors, warnings = [], []
|
|
||||||
try:
|
|
||||||
data = tomllib.loads(args.file.read_text(encoding="utf-8"))
|
|
||||||
except (OSError, tomllib.TOMLDecodeError) as exc:
|
|
||||||
print(f"ERROR: {args.file}: {exc}", file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
messages = dict(flatten(data))
|
|
||||||
coverage = {}
|
|
||||||
for key, texts in messages.items():
|
|
||||||
reference = texts.get("en")
|
|
||||||
if not isinstance(reference, str) or not reference:
|
|
||||||
errors.append(f"{key}: no \"en\" text")
|
|
||||||
continue
|
|
||||||
expected = placeholders(reference)
|
|
||||||
for language, text in texts.items():
|
|
||||||
if not LANGUAGE_CODE.match(language):
|
|
||||||
errors.append(f"{key}: unexpected language code {language!r}")
|
|
||||||
continue
|
|
||||||
if not isinstance(text, str) or not text:
|
|
||||||
errors.append(f"{key}.{language}: empty or not a string")
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
found = placeholders(text)
|
|
||||||
except ValueError as exc:
|
|
||||||
errors.append(f"{key}.{language}: {exc}")
|
|
||||||
continue
|
|
||||||
if found != expected:
|
|
||||||
errors.append(f"{key}.{language}: placeholders {sorted(found)} "
|
|
||||||
f"instead of {sorted(expected)}")
|
|
||||||
coverage[language] = coverage.get(language, 0) + 1
|
|
||||||
|
|
||||||
if not args.skip_usage:
|
|
||||||
used = used_keys()
|
|
||||||
for key, where in sorted(used.items()):
|
|
||||||
if key not in messages:
|
|
||||||
errors.append(f"{key}: used in {where} but not defined")
|
|
||||||
for key in sorted(set(messages) - set(used)):
|
|
||||||
warnings.append(f"{key}: defined but never used")
|
|
||||||
|
|
||||||
for line in warnings:
|
|
||||||
print(f"warning: {line}", file=sys.stderr)
|
|
||||||
for line in errors:
|
|
||||||
print(f"ERROR: {line}", file=sys.stderr)
|
|
||||||
total = len(messages)
|
|
||||||
summary = ", ".join(f"{lang} {count}/{total}" for lang, count in
|
|
||||||
sorted(coverage.items(), key=lambda item: (-item[1], item[0])))
|
|
||||||
print(f"{total} messages — {summary or 'no translation'}")
|
|
||||||
return 1 if errors else 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
sys.exit(main())
|
|
||||||
@@ -0,0 +1,229 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Check the FWS translations files.
|
||||||
|
|
||||||
|
Errors (exit status 1):
|
||||||
|
- a file is not valid TOML;
|
||||||
|
- a message has no "en" text (the fallback of every language);
|
||||||
|
- a language code does not look like an Anaconda one (fr, pt_BR, sr@latin);
|
||||||
|
- a translation does not use exactly the same {placeholders} as "en";
|
||||||
|
- two files share a namespace (the first part of a key), which would leave
|
||||||
|
the code unsure of where a key lives;
|
||||||
|
- the code asks for a key that no file defines;
|
||||||
|
- in anaconda-translations.toml (texts added to Anaconda's own catalogs), a
|
||||||
|
translation whose placeholders, markup, keyboard shortcut or line breaks
|
||||||
|
differ from the English text.
|
||||||
|
Warnings: keys defined but never used.
|
||||||
|
The summary lists how many messages each language translates, per file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import pathlib
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
import sys
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
REPO = pathlib.Path(__file__).resolve().parent.parent
|
||||||
|
TRANSLATIONS = REPO / "configs/baseline/airootfs/usr/local/share/fws"
|
||||||
|
DEFAULT_FILES = [TRANSLATIONS / "installer-translations.toml",
|
||||||
|
TRANSLATIONS / "system-translations.toml"]
|
||||||
|
ANACONDA_SUPPLEMENT = TRANSLATIONS / "anaconda-translations.toml"
|
||||||
|
CODE_ROOTS = [REPO / "configs/baseline/airootfs", REPO / "configs/releng/airootfs"]
|
||||||
|
CODE_SUFFIXES = {".py", ".sh", ".ks", ".qml", ".desktop", ".policy", ".json", ".ini", ".tmpl", ""}
|
||||||
|
|
||||||
|
KEY = r"[a-z0-9_]+(?:\.[a-z0-9_]+)+"
|
||||||
|
LANGUAGE_CODE = re.compile(r"^[a-z]{2,3}(_[A-Z]{2})?(@[a-z]+)?$")
|
||||||
|
USAGES = [
|
||||||
|
# t("key") in Python and QML.
|
||||||
|
re.compile(rf"""\bt\(\s*["']({KEY})["']"""),
|
||||||
|
# Shell: "fws:key" hands a key over to the installer's progress screen;
|
||||||
|
# fws-i18n prints one text; t comes from /usr/local/lib/fws/i18n.sh.
|
||||||
|
re.compile(rf"""\bfws:({KEY})\b"""),
|
||||||
|
re.compile(rf"""\bfws-i18n\s+(?:--catalog\s+\S+\s+)?({KEY})\b"""),
|
||||||
|
re.compile(rf"""(?:\$\(|^\s*)t\s+["']?({KEY})\b""", re.M),
|
||||||
|
# {{t:key}} markers of the configuration files rendered by the installer.
|
||||||
|
re.compile(rf"""\{{\{{t:({KEY})\}}\}}"""),
|
||||||
|
# Hyprland bind descriptions, translated by fws-keys when shown.
|
||||||
|
re.compile(rf"""^\s*bindd\s*=[^,\n]*,[^,\n]*,\s*({KEY})\s*,""", re.M),
|
||||||
|
]
|
||||||
|
# Whole prefixes: every key under them is used (translate-static-files.py).
|
||||||
|
PREFIX_USAGES = [
|
||||||
|
re.compile(rf"""^X-FWS-Translation=({KEY})\s*$""", re.M),
|
||||||
|
re.compile(rf"""<!--\s*fws-i18n:\s*({KEY})\s*-->"""),
|
||||||
|
]
|
||||||
|
# A quoted string that is exactly a key of a known namespace: a key kept in a
|
||||||
|
# table and passed to t() later.
|
||||||
|
QUOTED = re.compile(rf"""["']({KEY})["']""")
|
||||||
|
|
||||||
|
|
||||||
|
def flatten(table, prefix=""):
|
||||||
|
texts = {name: value for name, value in table.items() if not isinstance(value, dict)}
|
||||||
|
if texts and prefix:
|
||||||
|
yield prefix, texts
|
||||||
|
for name, value in table.items():
|
||||||
|
if isinstance(value, dict):
|
||||||
|
yield from flatten(value, f"{prefix}.{name}" if prefix else name)
|
||||||
|
|
||||||
|
|
||||||
|
def placeholders(text):
|
||||||
|
return {field for _, field, _, _ in string.Formatter().parse(text) if field is not None}
|
||||||
|
|
||||||
|
|
||||||
|
def code_files():
|
||||||
|
for root in CODE_ROOTS:
|
||||||
|
for path in root.rglob("*"):
|
||||||
|
if not path.is_file() or "__pycache__" in path.parts:
|
||||||
|
continue
|
||||||
|
if path.suffix not in CODE_SUFFIXES and path.name != ".xinitrc":
|
||||||
|
continue
|
||||||
|
if path.suffix == ".toml" or path.name == "translations.js":
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
yield path, path.read_text(encoding="utf-8")
|
||||||
|
except (UnicodeDecodeError, OSError):
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
def used_keys(namespaces):
|
||||||
|
"""({key: first file using it}, {prefix: first file using it})."""
|
||||||
|
keys, prefixes = {}, {}
|
||||||
|
for path, text in code_files():
|
||||||
|
where = path.relative_to(REPO)
|
||||||
|
for pattern in USAGES:
|
||||||
|
for match in pattern.finditer(text):
|
||||||
|
keys.setdefault(match.group(1), where)
|
||||||
|
for pattern in PREFIX_USAGES:
|
||||||
|
for match in pattern.finditer(text):
|
||||||
|
prefixes.setdefault(match.group(1), where)
|
||||||
|
for match in QUOTED.finditer(text):
|
||||||
|
if match.group(1).split(".", 1)[0] in namespaces:
|
||||||
|
keys.setdefault(match.group(1), where)
|
||||||
|
return keys, prefixes
|
||||||
|
|
||||||
|
|
||||||
|
def check_file(path, errors):
|
||||||
|
"""{key: texts} of one file, its errors appended to `errors`."""
|
||||||
|
try:
|
||||||
|
data = tomllib.loads(path.read_text(encoding="utf-8"))
|
||||||
|
except (OSError, tomllib.TOMLDecodeError) as exc:
|
||||||
|
errors.append(f"{path.name}: {exc}")
|
||||||
|
return {}, {}
|
||||||
|
messages = dict(flatten(data))
|
||||||
|
coverage = {}
|
||||||
|
for key, texts in messages.items():
|
||||||
|
reference = texts.get("en")
|
||||||
|
if not isinstance(reference, str) or not reference:
|
||||||
|
errors.append(f"{key}: no \"en\" text")
|
||||||
|
continue
|
||||||
|
expected = placeholders(reference)
|
||||||
|
for language, text in texts.items():
|
||||||
|
if not LANGUAGE_CODE.match(language):
|
||||||
|
errors.append(f"{key}: unexpected language code {language!r}")
|
||||||
|
continue
|
||||||
|
if not isinstance(text, str) or not text:
|
||||||
|
errors.append(f"{key}.{language}: empty or not a string")
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
found = placeholders(text)
|
||||||
|
except ValueError as exc:
|
||||||
|
errors.append(f"{key}.{language}: {exc}")
|
||||||
|
continue
|
||||||
|
if found != expected:
|
||||||
|
errors.append(f"{key}.{language}: placeholders {sorted(found)} "
|
||||||
|
f"instead of {sorted(expected)}")
|
||||||
|
coverage[language] = coverage.get(language, 0) + 1
|
||||||
|
return messages, coverage
|
||||||
|
|
||||||
|
|
||||||
|
# Anaconda's texts use printf and str.format placeholders, Pango markup and
|
||||||
|
# GTK keyboard shortcuts ("_Root Password:").
|
||||||
|
PRINTF = re.compile(r"%(?:\([^)]+\))?[-#0 +]*\d*(?:\.\d+)?[sdifgxXr]")
|
||||||
|
BRACES = re.compile(r"\{[^{}]*\}")
|
||||||
|
TAGS = re.compile(r"</?[a-zA-Z]+[^>]*>")
|
||||||
|
MNEMONIC = re.compile(r"_(?=\w)")
|
||||||
|
|
||||||
|
|
||||||
|
def anaconda_signature(text):
|
||||||
|
return (sorted(PRINTF.findall(text)), sorted(BRACES.findall(text)),
|
||||||
|
sorted(re.sub(r"\s+", " ", tag) for tag in TAGS.findall(text)),
|
||||||
|
bool(MNEMONIC.search(text)), text.count("\n"))
|
||||||
|
|
||||||
|
|
||||||
|
def check_anaconda_supplement(path, errors):
|
||||||
|
"""Summary line of anaconda-translations.toml, its errors appended."""
|
||||||
|
try:
|
||||||
|
messages = tomllib.loads(path.read_text(encoding="utf-8")).get("message", [])
|
||||||
|
except (OSError, tomllib.TOMLDecodeError) as exc:
|
||||||
|
errors.append(f"{path.name}: {exc}")
|
||||||
|
return f"{path.name}: unreadable"
|
||||||
|
coverage = {}
|
||||||
|
for number, message in enumerate(messages, 1):
|
||||||
|
msgid = message.get("msgid")
|
||||||
|
if not isinstance(msgid, str) or not msgid:
|
||||||
|
errors.append(f"{path.name}: message {number} has no msgid")
|
||||||
|
continue
|
||||||
|
expected = anaconda_signature(msgid)
|
||||||
|
for language, text in message.items():
|
||||||
|
if language in ("msgid", "context"):
|
||||||
|
continue
|
||||||
|
if not LANGUAGE_CODE.match(language) or not isinstance(text, str) or not text:
|
||||||
|
errors.append(f"{path.name}: {msgid[:40]!r}.{language}: bad language code or text")
|
||||||
|
continue
|
||||||
|
if anaconda_signature(text) != expected:
|
||||||
|
errors.append(f"{path.name}: {msgid[:40]!r}.{language}: placeholders, markup, "
|
||||||
|
"shortcut or line breaks differ from the English text")
|
||||||
|
coverage[language] = coverage.get(language, 0) + 1
|
||||||
|
summary = ", ".join(f"{lang} {count}" for lang, count in
|
||||||
|
sorted(coverage.items(), key=lambda item: (-item[1], item[0])))
|
||||||
|
return f"{path.name}: {len(messages)} texts — {summary or 'none'}"
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
parser.add_argument("--file", type=pathlib.Path, action="append",
|
||||||
|
help="file to check (repeatable; default: both catalogs)")
|
||||||
|
parser.add_argument("--skip-usage", action="store_true",
|
||||||
|
help="do not compare the keys with the code (checking a fragment)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
errors, warnings, summaries = [], [], []
|
||||||
|
messages, owner = {}, {}
|
||||||
|
for path in args.file or DEFAULT_FILES:
|
||||||
|
file_messages, coverage = check_file(path, errors)
|
||||||
|
for key in file_messages:
|
||||||
|
namespace = key.split(".", 1)[0]
|
||||||
|
if owner.setdefault(namespace, path.name) != path.name:
|
||||||
|
errors.append(f"{key}: namespace {namespace!r} already used by {owner[namespace]}")
|
||||||
|
messages.update(file_messages)
|
||||||
|
total = len(file_messages)
|
||||||
|
summary = ", ".join(f"{lang} {count}/{total}" for lang, count in
|
||||||
|
sorted(coverage.items(), key=lambda item: (-item[1], item[0])))
|
||||||
|
summaries.append(f"{path.name}: {total} messages — {summary or 'no translation'}")
|
||||||
|
|
||||||
|
if not args.file and ANACONDA_SUPPLEMENT.exists():
|
||||||
|
summaries.append(check_anaconda_supplement(ANACONDA_SUPPLEMENT, errors))
|
||||||
|
|
||||||
|
if not args.skip_usage:
|
||||||
|
used, prefixes = used_keys(set(owner))
|
||||||
|
for prefix, where in prefixes.items():
|
||||||
|
covered = [key for key in messages if key.startswith(prefix + ".")]
|
||||||
|
if not covered:
|
||||||
|
errors.append(f"{prefix}: used in {where} but no key starts with it")
|
||||||
|
for key in covered:
|
||||||
|
used.setdefault(key, where)
|
||||||
|
for key, where in sorted(used.items()):
|
||||||
|
if key not in messages:
|
||||||
|
errors.append(f"{key}: used in {where} but not defined")
|
||||||
|
for key in sorted(set(messages) - set(used)):
|
||||||
|
warnings.append(f"{key}: defined but never used")
|
||||||
|
|
||||||
|
for line in warnings:
|
||||||
|
print(f"warning: {line}", file=sys.stderr)
|
||||||
|
for line in errors:
|
||||||
|
print(f"ERROR: {line}", file=sys.stderr)
|
||||||
|
print("\n".join(summaries))
|
||||||
|
return 1 if errors else 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Print pacman NoExtract lines for firmware the ISO's kernel never loads.
|
||||||
|
|
||||||
|
usage: firmware-noextract.py <linux pkg> <linux-firmware-intel pkg> <linux-firmware-nvidia pkg>
|
||||||
|
|
||||||
|
Two drivers ship several versions of the same firmware and load one:
|
||||||
|
- iwlwifi (Intel Wi-Fi) tries, for each chip, its highest supported API
|
||||||
|
version first and goes down until a file exists: every version below the
|
||||||
|
highest one present is never read (~55 MiB).
|
||||||
|
- nouveau (NVIDIA GSP) takes the newest GSP release it supports: older
|
||||||
|
releases are never read when the newest one is present (~38 MiB).
|
||||||
|
The versions a driver supports are its MODULE_FIRMWARE declarations, read from
|
||||||
|
the .modinfo of the very kernel package the ISO installs, so the result
|
||||||
|
follows kernel and firmware updates. Only versions below one that is kept are
|
||||||
|
excluded: a newer kernel would load the same file or a newer one, never an
|
||||||
|
excluded one.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PER_LINE = 12
|
||||||
|
|
||||||
|
|
||||||
|
def package_files(package):
|
||||||
|
return subprocess.run(["bsdtar", "-tf", package], check=True,
|
||||||
|
capture_output=True, text=True).stdout.split()
|
||||||
|
|
||||||
|
|
||||||
|
def module_firmware(linux_package, module):
|
||||||
|
"""MODULE_FIRMWARE entries of `module`, read from its .modinfo strings."""
|
||||||
|
members = [path for path in package_files(linux_package)
|
||||||
|
if re.search(rf"/{module}\.ko(\.[a-z]+)?$", path)]
|
||||||
|
if not members:
|
||||||
|
sys.exit(f"firmware-noextract: {module} not found in {linux_package}")
|
||||||
|
data = subprocess.run(["bsdtar", "-xOf", linux_package, members[0]],
|
||||||
|
check=True, capture_output=True).stdout
|
||||||
|
if members[0].endswith(".zst"):
|
||||||
|
data = subprocess.run(["zstd", "-dcq"], input=data, check=True,
|
||||||
|
capture_output=True).stdout
|
||||||
|
elif members[0].endswith(".xz"):
|
||||||
|
data = subprocess.run(["xz", "-dcq"], input=data, check=True,
|
||||||
|
capture_output=True).stdout
|
||||||
|
return {match.decode() for match in re.findall(rb"firmware=([^\0]+)\0", data)}
|
||||||
|
|
||||||
|
|
||||||
|
def iwlwifi_unused(declared, files):
|
||||||
|
# iwlwifi-<chip>-<api>.ucode, where <api> is a number or c<number>.
|
||||||
|
name = re.compile(r"^usr/lib/firmware/intel/iwlwifi/iwlwifi-(.+)-(c?)(\d+)\.ucode(\.\w+)?$")
|
||||||
|
highest = {}
|
||||||
|
for entry in declared:
|
||||||
|
match = re.match(r"^iwlwifi-(.+)-(c?)(\d+)\.ucode$", entry)
|
||||||
|
if match:
|
||||||
|
highest[match.group(1, 2)] = int(match.group(3))
|
||||||
|
present = {}
|
||||||
|
for path in files:
|
||||||
|
match = name.match(path)
|
||||||
|
# Chips the module does not declare are left alone: their file names
|
||||||
|
# are built at run time and nothing says which version is loaded.
|
||||||
|
if match and match.group(1, 2) in highest:
|
||||||
|
present.setdefault(match.group(1, 2), []).append((int(match.group(3)), path))
|
||||||
|
unused = []
|
||||||
|
for chip, versions in present.items():
|
||||||
|
loadable = [version for version, _ in versions if version <= highest[chip]]
|
||||||
|
if loadable:
|
||||||
|
kept = max(loadable)
|
||||||
|
unused += [path for version, path in versions if version < kept]
|
||||||
|
return unused
|
||||||
|
|
||||||
|
|
||||||
|
def nouveau_unused(declared, files):
|
||||||
|
releases = {match.group(1) for entry in declared
|
||||||
|
if (match := re.search(r"/gsp/[a-z_]+-([0-9.]+)\.bin$", entry))}
|
||||||
|
if len(releases) < 2:
|
||||||
|
return []
|
||||||
|
def key(release):
|
||||||
|
return tuple(int(part) for part in release.split("."))
|
||||||
|
newest = max(releases, key=key)
|
||||||
|
older = [release for release in releases if key(release) < key(newest)]
|
||||||
|
# Per GPU: an older release goes only where the newest one is present.
|
||||||
|
with_newest = {path.split("/gsp/")[0] for path in files
|
||||||
|
if "/gsp/" in path and f"-{newest}.bin" in path}
|
||||||
|
return [path for path in files
|
||||||
|
if "/gsp/" in path and path.split("/gsp/")[0] in with_newest
|
||||||
|
and any(f"-{release}.bin" in path for release in older)]
|
||||||
|
|
||||||
|
|
||||||
|
def main(linux_package, intel_package, nvidia_package):
|
||||||
|
patterns = iwlwifi_unused(module_firmware(linux_package, "iwlwifi"),
|
||||||
|
package_files(intel_package))
|
||||||
|
patterns += nouveau_unused(module_firmware(linux_package, "nouveau"),
|
||||||
|
package_files(nvidia_package))
|
||||||
|
patterns.sort()
|
||||||
|
# pacman reads its configuration in lines of at most 4 KiB: a longer one
|
||||||
|
# is cut and the rest taken for an unknown directive.
|
||||||
|
for start in range(0, len(patterns), PER_LINE):
|
||||||
|
print("NoExtract = " + " ".join(patterns[start:start + PER_LINE]))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
sys.exit(__doc__.strip().splitlines()[2])
|
||||||
|
main(*sys.argv[1:])
|
||||||
+6
-41
@@ -1,7 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# FWS — Build des paquets AUR + PKGBUILD locaux (deps Anaconda, fws-dnd,
|
# FWS — Build des paquets AUR et création du repo pacman local fws-local/.
|
||||||
# fws-pacmanage) et création du repo pacman local fws-local/.
|
#
|
||||||
|
# Les paquets FWS (anaconda et ses deps, fws-dnd, fws-pacmanage) ne sont plus
|
||||||
|
# construits ici : ils viennent du dépôt distant [fws] (cf. pacman.conf du
|
||||||
|
# profil).
|
||||||
#
|
#
|
||||||
# Rejoue-le si tu changes la liste AUR_PACKAGES ou pour
|
# Rejoue-le si tu changes la liste AUR_PACKAGES ou pour
|
||||||
# rafraîchir le repo local.
|
# rafraîchir le repo local.
|
||||||
@@ -14,12 +17,7 @@ trap 'rc=$?; echo -e "\033[0;31m[ERR] Échec (setup-aur.sh) ligne $LINENO, code
|
|||||||
# - libxmlrpc, satyr : deps de libreport (deps officielles uniquement)
|
# - libxmlrpc, satyr : deps de libreport (deps officielles uniquement)
|
||||||
# - libreport : tiré par python-meh ; chaîne AUR→AUR → APRÈS satyr+libxmlrpc
|
# - libreport : tiré par python-meh ; chaîne AUR→AUR → APRÈS satyr+libxmlrpc
|
||||||
# - python-* : deps Anaconda présentes dans l'AUR (deps officielles only)
|
# - python-* : deps Anaconda présentes dans l'AUR (deps officielles only)
|
||||||
# python-blivet est packagé en LOCAL (pkgbuilds/, patché sans libselinux).
|
|
||||||
# gnome-kiosk (WM de la session GUI) est différé au chantier C.
|
# gnome-kiosk (WM de la session GUI) est différé au chantier C.
|
||||||
# NB : python-iso639 RETIRÉ de l'AUR (mauvais projet homonyme, API sans find()) →
|
|
||||||
# packagé en LOCAL (pkgbuilds/python-iso639, projet PyPI « iso639 » 0.1.4).
|
|
||||||
# NB : python-langtable RETIRÉ de l'AUR (figé 0.0.51, sans list_common_languages) →
|
|
||||||
# packagé en LOCAL (pkgbuilds/python-langtable, 0.0.71).
|
|
||||||
# NB : broadcom-wl-dkms n'est PAS dans packages.x86_64 — il blackliste
|
# NB : broadcom-wl-dkms n'est PAS dans packages.x86_64 — il blackliste
|
||||||
# b43/bcma/ssb pour tout le système. build.sh l'embarque dans l'image et
|
# b43/bcma/ssb pour tout le système. build.sh l'embarque dans l'image et
|
||||||
# fws-setup-hardware ne l'installe que sur une Broadcom réellement muette.
|
# fws-setup-hardware ne l'installe que sur une Broadcom réellement muette.
|
||||||
@@ -404,7 +402,7 @@ is_noinstall() {
|
|||||||
|
|
||||||
# Construit OU saute <name> (source déjà déposée dans $BUILD_DIR/<name>).
|
# Construit OU saute <name> (source déjà déposée dans $BUILD_DIR/<name>).
|
||||||
# Installe le résultat (depuis local-repo si sauté) pour que les paquets
|
# Installe le résultat (depuis local-repo si sauté) pour que les paquets
|
||||||
# dépendants suivants résolvent leurs deps (chaînes AUR→AUR, anaconda…) —
|
# dépendants suivants résolvent leurs deps (chaînes AUR→AUR) —
|
||||||
# sauf pour les NOINSTALL_PACKAGES ci-dessus, qui sont seulement publiés.
|
# sauf pour les NOINSTALL_PACKAGES ci-dessus, qui sont seulement publiés.
|
||||||
build_or_skip() {
|
build_or_skip() {
|
||||||
# NB : référencer "$1" et PAS "$name" ici — dans un `local a=… b=…` à une
|
# NB : référencer "$1" et PAS "$name" ici — dans un `local a=… b=…` à une
|
||||||
@@ -481,39 +479,6 @@ for pkg in "${AUR_PACKAGES[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# --- PKGBUILD locaux FWS (ordre explicite, feuilles d'abord, anaconda dernier) ---
|
|
||||||
LOCAL_PKGBUILDS_DIR="$SCRIPT_DIR/pkgbuilds"
|
|
||||||
LOCAL_BUILD_ORDER=(
|
|
||||||
fws-pacmanage
|
|
||||||
fws-dnd
|
|
||||||
pykickstart python-productmd python-requests-file python-simpleline
|
|
||||||
python-iso639 python-langtable python-meh python-blivet
|
|
||||||
anaconda-widgets anaconda
|
|
||||||
)
|
|
||||||
BUILT_LOCAL=()
|
|
||||||
|
|
||||||
prepare_and_build_local() {
|
|
||||||
local name="$1" dir="$LOCAL_PKGBUILDS_DIR/$1"
|
|
||||||
[ -f "$dir/PKGBUILD" ] || return 1
|
|
||||||
rm -rf "$BUILD_DIR/$name"
|
|
||||||
cp -a "$dir" "$BUILD_DIR/$name"
|
|
||||||
build_or_skip "$name"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -d "$LOCAL_PKGBUILDS_DIR" ]; then
|
|
||||||
# 1) Ordre explicite (deps avant dépendants).
|
|
||||||
for name in "${LOCAL_BUILD_ORDER[@]}"; do
|
|
||||||
if prepare_and_build_local "$name"; then BUILT_LOCAL+=("$name"); fi
|
|
||||||
done
|
|
||||||
# 2) Repli : tout PKGBUILD présent mais non listé (futur ajout oublié).
|
|
||||||
for dir in "$LOCAL_PKGBUILDS_DIR"/*/; do
|
|
||||||
[ -f "$dir/PKGBUILD" ] || continue
|
|
||||||
name="$(basename "$dir")"
|
|
||||||
printf '%s\n' "${BUILT_LOCAL[@]}" | grep -qx "$name" && continue
|
|
||||||
prepare_and_build_local "$name" || true
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
step "4/4 — (Re)génération de la base du repo local fws-local"
|
step "4/4 — (Re)génération de la base du repo local fws-local"
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|||||||
Reference in new issue
Block a user