commit d6e1fa69208f7c0820c028a77e988e3d4f64f211 Author: greg Date: Tue Feb 3 13:22:20 2026 +0100 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..7d129cb --- /dev/null +++ b/README.md @@ -0,0 +1,218 @@ +# 📩 CrĂ©er un paquet Debian (.deb) + +Ce document explique **pas Ă  pas** comment crĂ©er un paquet Debian propre, avec : + +* l’arborescence correcte +* les dĂ©pendances +* les scripts d’installation +* la construction du fichier `.deb` + +Ce guide s’adresse aux systĂšmes **Debian / Ubuntu et dĂ©rivĂ©s**. + +--- + +## đŸ§± 1. PrĂ©requis + +Outils nĂ©cessaires : +```bash +sudo apt install build-essential dpkg-dev lintian +``` + +Optionnel mais recommandĂ© : +```bash +sudo apt install fakeroot +``` + +--- + +## 📁 2. Arborescence minimale d’un paquet Debian + +Un paquet Debian est **une simple arborescence de fichiers**. + +Exemple pour un paquet `mon-paquet` version `1.0` : + +```text +mon-paquet-1.0/ +├── DEBIAN +│ └── control +└── usr + └── bin + └── mon-paquet +``` + +### CrĂ©ation des dossiers + +```bash +mkdir -p mon-paquet-1.0/DEBIAN +mkdir -p mon-paquet-1.0/usr/bin +``` + +--- + +## 📄 3. Le fichier DEBIAN/control + +Le fichier `control` est **obligatoire**. + +```bash +nano mon-paquet-1.0/DEBIAN/control +``` + +### Exemple complet + +```text +Package: mon-paquet +Version: 1.0 +Section: utils +Priority: optional +Architecture: amd64 +Maintainer: Le Garage NumĂ©rique +Depends: bash (>= 5.0), curl +Description: Exemple de paquet Debian + Description longue sur plusieurs lignes. + Chaque ligne doit commencer par un espace. +``` + +### Champs importants + +| Champ | Description | +| ------------ | ---------------------------- | +| Package | Nom du paquet | +| Version | Version du paquet | +| Architecture | `amd64`, `all`, `arm64`, etc | +| Depends | DĂ©pendances APT | +| Description | Description courte + longue | + +--- + +## 🔗 4. GĂ©rer les dĂ©pendances + +Les dĂ©pendances sont listĂ©es dans `Depends:`. + +### Syntaxe + +```text +Depends: paquet1, paquet2 (>= 1.2), paquet3 | alternative +``` + +### Exemples + +```text +Depends: python3, python3-requests +Depends: systemd | sysvinit +``` + +APT installera automatiquement les dĂ©pendances lors de l’installation. + +--- + +## đŸ§© 5. Arborescence complĂšte recommandĂ©e + +```text +mon-paquet-1.0/ +├── DEBIAN +│ ├── control +│ ├── postinst +│ ├── prerm +│ └── postrm +├── usr +│ ├── bin +│ │ └── mon-paquet +│ └── share +│ ├── doc +│ │ └── mon-paquet +│ │ └── README.md +│ └── applications +│ └── mon-paquet.desktop +└── etc + └── mon-paquet + └── config.conf +``` + +### CrĂ©ation rapide + +```bash +mkdir -p mon-paquet-1.0/{DEBIAN,usr/bin,etc/mon-paquet} +mkdir -p mon-paquet-1.0/usr/share/{doc/mon-paquet,applications} +``` + +--- + +## ⚙ 6. Scripts Debian (postinst, prerm, postrm) + +Ces scripts sont exĂ©cutĂ©s automatiquement. + +### postinst (aprĂšs installation) + +```bash +#!/bin/sh +set -e + +echo "Installation terminĂ©e" +``` + +### prerm (avant suppression) + +```bash +#!/bin/sh +set -e + +echo "Suppression du paquet" +``` + +### Permissions obligatoires + +```bash +chmod 755 mon-paquet-1.0/DEBIAN/postinst +chmod 755 mon-paquet-1.0/DEBIAN/prerm +chmod 755 mon-paquet-1.0/DEBIAN/postrm +``` + +--- + +## 📩 7. Construire le paquet `.deb` + +```bash +dpkg-deb --build --root-owner-group mon-paquet-1.0 +``` + +RĂ©sultat : + +```text +mon-paquet-1.0.deb +``` + +--- + +## đŸ§Ș 8. Tester le paquet + +### Installation + +```bash +sudo apt install ./mon-paquet-1.0.deb +``` + +### VĂ©rification + +```bash +dpkg -l mon-paquet +``` + +### Analyse qualitĂ© + +```bash +lintian mon-paquet-1.0.deb +``` + +--- + +## 📚 9. Bonnes pratiques + +* ✔ Respecter le FHS (`/usr`, `/etc`, `/var`) +* ❌ Ne jamais utiliser `/usr/local` +* ✔ Utiliser `Architecture: all` pour scripts +* ✔ Versionner correctement +* ✔ Tester sur une VM propre + +--- + +✉ Maintenu par **Le Garage NumĂ©rique** diff --git a/paquet/DEBIAN/control b/paquet/DEBIAN/control new file mode 100644 index 0000000..3d378ee --- /dev/null +++ b/paquet/DEBIAN/control @@ -0,0 +1,7 @@ +Package: geo +Version: 1.2 +Section: base +Priority: optional +Architecture: all +Maintainer: Greg +Description: Geographical Adventures installation pour Linux. diff --git a/paquet/DEBIAN/postinst b/paquet/DEBIAN/postinst new file mode 100755 index 0000000..4249dcd --- /dev/null +++ b/paquet/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/bash + +chmod +x /opt/Geographical-Adventures/Geographical-Adventures.x86_64 +echo "installation TerminĂ©e" +echo "Tu peux dĂ©sormais jouer Ă  Geographical Adventures" \ No newline at end of file diff --git a/paquet/DEBIAN/prerm b/paquet/DEBIAN/prerm new file mode 100755 index 0000000..97b035a --- /dev/null +++ b/paquet/DEBIAN/prerm @@ -0,0 +1,5 @@ +#!/bin/bash + +rm -rf '/opt/Geographical-Adventures/unity.lock' +rm -rf /usr/share/applications/geographical-adventures.desktop +echo "Application dĂ©sinstallĂ©e avec succĂšs" \ No newline at end of file diff --git a/paquet/usr/share/applications/geographical-adventures.desktop b/paquet/usr/share/applications/geographical-adventures.desktop new file mode 100644 index 0000000..dab65fe --- /dev/null +++ b/paquet/usr/share/applications/geographical-adventures.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Geographical Adventures +Comment=Une application pour apprendre la gĂ©ographie +Exec=/opt/Geographical-Adventures/Geographical-Adventures.x86_64 +Icon=/opt/Geographical-Adventures/Geographical-Adventures_Data/Resources/UnityPlayer.png +Terminal=false +Type=Application +Categories=Games; \ No newline at end of file