Commit initial
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
generated
|
84
README.md
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
# cubic-linuxmint
|
||||||
|
|
||||||
|
Préparation d'une image iso personnalisée pour l'installation de postes Linux Mint par Libretic.
|
||||||
|
|
||||||
|
Le but de cette image est de proposer une image iso amorçable, permettant d'installer rapidement des
|
||||||
|
ordinateurs basés sur Linux Mint et équipés d'un minimum de logiciels et de configuration.
|
||||||
|
|
||||||
|
|
||||||
|
## Création de l'image iso
|
||||||
|
|
||||||
|
* Sur un poste linux-mint, installer le logiciel [Cubic](https://github.com/PJ-Singh-001/Cubic) :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-add-repository universe
|
||||||
|
sudo apt-add-repository ppa:cubic-wizard/release
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install --no-install-recommends cubic
|
||||||
|
```
|
||||||
|
|
||||||
|
* Télécharger l'image linux mint officielle (édition cinnamon)
|
||||||
|
|
||||||
|
* Cloner ce pojet
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.libretic.fr/libretic/cubic-linuxmint.git
|
||||||
|
```
|
||||||
|
|
||||||
|
* Adapter le projet selon ses besoins, notamment :
|
||||||
|
* `vars/main.yml`
|
||||||
|
* le fichier de preseed `libretic.ks.j2`
|
||||||
|
|
||||||
|
|
||||||
|
* Se placer dans le dossier ansible de ce projet et exécuter la génération des fichiers preseed qui seront utiles plus tard, et qui se trouveront dans le dossier `generated` après exécution de la commande :
|
||||||
|
```bash
|
||||||
|
cd cubic-linuxmint/ansible
|
||||||
|
ansible-playbook configure-preseed.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
* Lancer cubic et créer un nouveau dossier projet
|
||||||
|
|
||||||
|
![Dossier de projet Cubic](doc/cubic-folder.png)
|
||||||
|
|
||||||
|
* Paramétrage de la personnalisation de l'image ; choisir l'image linux mint téléchargée et personnalisé comme suit :
|
||||||
|
|
||||||
|
![Écran de personnalisation de l'image](doc/original_disk_customization.png)
|
||||||
|
|
||||||
|
* On arrive sur un shell qui permet de taper des commandes de personnalisation
|
||||||
|
|
||||||
|
![Shell](doc/shell.png)
|
||||||
|
|
||||||
|
* Dans ce shell, taper les commandes suivantes :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt install -y git python3-poetry
|
||||||
|
cd /opt
|
||||||
|
git clone https://git.libretic.fr/libretic/libreticmenu.git
|
||||||
|
cd libreticmenu
|
||||||
|
./libreticmenu.sh --cubic
|
||||||
|
```
|
||||||
|
|
||||||
|
* Une fois exécutées les commandes ci-dessus, passer à l'écran qui suit, qui propose de modifier la liste des packages qui doivent être supprimés dans l'image. Ne rien changer.
|
||||||
|
|
||||||
|
* L'écran suivant propose de modifier les options de démarrage. Dans l'onglet preseed de cet écran, créer plusieurs fichiers et y copier/coller les contenus des mêmes fichiers générés par ansible :
|
||||||
|
* `libretic-nvme.ks`
|
||||||
|
* `libretic-sda.ks`
|
||||||
|
* `libretic-vda.ks`
|
||||||
|
|
||||||
|
![L'onglet preseed une fois renseigné](doc/preseed.png)
|
||||||
|
|
||||||
|
* Dans l'onglet Boot, remplacer les contenus des fichiers grub.cfg et live.cfg par les contenus des fichiers générés par ansible :
|
||||||
|
|
||||||
|
![L'onglet boot une fois renseignée la zone grub.cfg](doc/boot-grub.png)
|
||||||
|
|
||||||
|
![L'onglet boot une fois renseignée la zone live.cfg](doc/boot-live.png)
|
||||||
|
|
||||||
|
* Les écrans suivant permettent de valider le taux de compression puis de générer l'image.
|
||||||
|
|
||||||
|
* Une fois générée, on obtient un écran de synthèse :
|
||||||
|
|
||||||
|
![Synthèse de l'image construite](doc/last.png)
|
||||||
|
|
||||||
|
* Le bouton "test" permet de tester l'image obtenue, mais il est préférable de tester avec virt-manager pour une meilleure simulation de ce qu'on obtiendra après sur un ordinateur.
|
||||||
|
|
||||||
|
* Une fois obtenu le résultat souhaité, il ne reste plus qu'à déposer l'image dans une clé usb (conseil : utiliser [Ventoy](https://www.ventoy.net)), puis amorcer un PC avec cette image.
|
34
ansible/configure-preseed.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# code: language=ansible
|
||||||
|
|
||||||
|
- name: Configure preseed
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
vars_files:
|
||||||
|
- main.yml
|
||||||
|
tasks:
|
||||||
|
- name: Dossier generated
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: generated
|
||||||
|
state: directory
|
||||||
|
mode: u=rwx,g=rx,o=rx
|
||||||
|
|
||||||
|
- name: Fichiers preseed
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: libretic.ks.j2
|
||||||
|
dest: generated/libretic-{{ item.boot_entry_name }}.ks
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
with_items: "{{ preseed_versions }}"
|
||||||
|
vars:
|
||||||
|
diskdevice: "{{ item.diskdevice }}"
|
||||||
|
|
||||||
|
- name: Fichier grub.cfg
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: grub.cfg.j2
|
||||||
|
dest: generated/grub.cfg
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
|
||||||
|
- name: Fichier live.cfg
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: live.cfg.j2
|
||||||
|
dest: generated/live.cfg
|
||||||
|
mode: u=rw,g=r,o=r
|
33
ansible/templates/grub.cfg.j2
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
loadfont unicode
|
||||||
|
|
||||||
|
set color_normal=white/black
|
||||||
|
set color_highlight=black/light-gray
|
||||||
|
|
||||||
|
menuentry "Linux Mint 22 Cinnamon Libretic - Live" --class linuxmint {
|
||||||
|
set gfxpayload=keep
|
||||||
|
linux /casper/vmlinuz boot=casper username=mint hostname=mint iso-scan/filename=${iso_path} quiet splash --
|
||||||
|
initrd /casper/initrd.gz
|
||||||
|
}
|
||||||
|
menuentry "Linux Mint 22 Cinnamon Libretic - Live (compatibility mode)" {
|
||||||
|
linux /casper/vmlinuz boot=casper username=mint hostname=mint iso-scan/filename=${iso_path} noapic noacpi nosplash irqpoll nomodeset --
|
||||||
|
initrd /casper/initrd.gz
|
||||||
|
}
|
||||||
|
{% for item in preseed_versions %}
|
||||||
|
menuentry "Linux Mint 22 Cinnamon Libretic - Autoinstall {{ item.boot_entry_name }}" --class linuxmint {
|
||||||
|
set gfxpayload=keep
|
||||||
|
linux /casper/vmlinuz file=/cdrom/preseed/libretic-{{ item.boot_entry_name }}.ks auto=true priority=critical debian-installer/locale=fr_FR keyboard-configuration/layoutcode=fr ubiquity/reboot=casper languagechooser/language-name=French countrychooser/shortlist=FR localechooser/supported-locales=fr_FR.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.gz quiet splash noprompt noshell --
|
||||||
|
initrd /casper/initrd.gz
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
grub_platform
|
||||||
|
if [ "$grub_platform" = "efi" ]; then
|
||||||
|
menuentry 'Boot from next volume' {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
menuentry 'UEFI Firmware Settings' {
|
||||||
|
fwsetup
|
||||||
|
}
|
||||||
|
menuentry 'Memory test' {
|
||||||
|
linux /boot/memtest.efi
|
||||||
|
}
|
||||||
|
fi
|
131
ansible/templates/libretic.ks.j2
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
#ubiquity partman-auto/method string crypto
|
||||||
|
#ubiquity partman-crypto/confirm boolean false
|
||||||
|
#ubiquity partman-crypto/passphrase password Ubuntu123
|
||||||
|
#ubiquity partman-crypto/passphrase-again password Ubuntu123
|
||||||
|
#ubiquity partman-crypto/warn_erase boolean true
|
||||||
|
#ubiquity partman-crypto/weak_passphrase boolean false
|
||||||
|
ubiquity ubiquity/use_nonfree boolean true
|
||||||
|
|
||||||
|
|
||||||
|
# Enable extras.ubuntu.com.
|
||||||
|
d-i apt-setup/extras boolean true
|
||||||
|
|
||||||
|
# -------- Localization --------
|
||||||
|
d-i debian-installer/locale string fr_FR.UTF-8
|
||||||
|
|
||||||
|
# -------- Keyboard --------
|
||||||
|
d-i console-setup/ask_detect boolean false
|
||||||
|
d-i console-setup/layoutcode string fr
|
||||||
|
d-i keyboard-configuration/xkb-keymap select fr
|
||||||
|
|
||||||
|
# -------- Network --------
|
||||||
|
d-i netcfg/choose_interface select auto
|
||||||
|
d-i netcfg/link_wait_timeout string 10
|
||||||
|
d-i netcfg/dhcp_timeout string 10
|
||||||
|
d-i netcfg/dhcpv6_timeout string 1
|
||||||
|
|
||||||
|
|
||||||
|
# Set default names to prevent prompts, overwritten by DHCP names.
|
||||||
|
d-i netcfg/get_hostname string unassigned-hostname
|
||||||
|
d-i netcfg/get_domain string unassigned-domain
|
||||||
|
|
||||||
|
|
||||||
|
# Disable that annoying WEP key dialog.
|
||||||
|
d-i netcfg/wireless_wep string
|
||||||
|
|
||||||
|
# -------- Hardware Firmware --------
|
||||||
|
d-i hw-detect/load_firmware boolean true
|
||||||
|
|
||||||
|
# -------- Accounts --------
|
||||||
|
# disable root user
|
||||||
|
d-i passwd/root-login boolean false
|
||||||
|
|
||||||
|
|
||||||
|
# base user for system
|
||||||
|
d-i passwd/user-fullname string
|
||||||
|
d-i passwd/username string {{ installer_username }}
|
||||||
|
# Generate with "openssl passwd -6"
|
||||||
|
d-i passwd/user-password-crypted password {{ installer_password }}
|
||||||
|
d-i passwd/user-default-groups string adm audio cdrom dip lpadmin sudo plugdev sambashare video
|
||||||
|
d-i passwd/root-login boolean false
|
||||||
|
d-i user-setup/encrypt-home boolean false
|
||||||
|
|
||||||
|
# -------- Clock and Timezone --------
|
||||||
|
d-i clock-setup/utc boolean true
|
||||||
|
d-i clock-setup/utc-auto boolean true
|
||||||
|
d-i clock-setup/ntp boolean true
|
||||||
|
d-i time/zone string Europe/Paris
|
||||||
|
|
||||||
|
# Partitioning
|
||||||
|
d-i partman-auto/disk string {{ diskdevice }}
|
||||||
|
d-i partman-auto/method string lvm
|
||||||
|
d-i partman-auto/purge_lvm_from_device boolean true
|
||||||
|
d-i partman-lvm/confirm boolean true
|
||||||
|
d-i partman-lvm/device_remove_lvm boolean true
|
||||||
|
d-i partman-lvm/device_remove_lvm_span boolean true
|
||||||
|
|
||||||
|
# Pour tout mettre dans une seule partition
|
||||||
|
d-i partman-auto/choose_recipe select atomic
|
||||||
|
|
||||||
|
d-i partman/confirm_write_new_label boolean true
|
||||||
|
d-i partman/choose_partition select finish
|
||||||
|
d-i partman/confirm boolean true
|
||||||
|
|
||||||
|
#d-i partman-auto/init_automatically_partition select biggest_free
|
||||||
|
d-i partman/confirm_nooverwrite boolean true
|
||||||
|
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||||
|
d-i partman-auto-lvm/guided_size string max
|
||||||
|
|
||||||
|
# Set to true if you want to encrypt the first user's home directory.
|
||||||
|
d-i user-setup/encrypt-home boolean false
|
||||||
|
|
||||||
|
# -------- Package Selection --------
|
||||||
|
# Main tasksel server packages
|
||||||
|
tasksel tasksel/first multiselect server, openssh-server
|
||||||
|
|
||||||
|
|
||||||
|
# Additional packages to install
|
||||||
|
d-i pkgsel/include string openssh-server python-software-properties inotify-tools curl unattended-upgrades sysstat nmon tmux ssh vim haveged
|
||||||
|
|
||||||
|
|
||||||
|
# Upgrade packages after bootstrap
|
||||||
|
d-i pkgsel/upgrade select full-upgrade
|
||||||
|
|
||||||
|
|
||||||
|
# Install security updates automatically
|
||||||
|
d-i pkgsel/update-policy select unattended-upgrades
|
||||||
|
|
||||||
|
# -------- Console Setup --------
|
||||||
|
|
||||||
|
# Verbose startup output, drop to console (text) login by default.
|
||||||
|
d-i debian-installer/quiet boolean false
|
||||||
|
d-i debian-installer/splash boolean false
|
||||||
|
|
||||||
|
# Grub
|
||||||
|
d-i grub-installer/bootdev string {{ diskdevice }}
|
||||||
|
#d-i grub-installer/bootdev string default
|
||||||
|
d-i grub-installer/grub2_instead_of_grub_legacy boolean true
|
||||||
|
d-i grub-installer/only_debian boolean true
|
||||||
|
d-i grub-installer/timeout string 5
|
||||||
|
d-i finish-install/reboot_in_progress note
|
||||||
|
|
||||||
|
|
||||||
|
# -------- Finish Installation --------
|
||||||
|
d-i cdrom-detect/eject boolean true
|
||||||
|
d-i finish-install/reboot_in_progress note
|
||||||
|
|
||||||
|
# Custom Commands
|
||||||
|
ubiquity ubiquity/success_command string in-target apt update;\
|
||||||
|
|
||||||
|
# Poweroff after install
|
||||||
|
ubiquity ubiquity/poweroff boolean true
|
||||||
|
# Reboot after install (nécessite poweroff)
|
||||||
|
ubiquity ubiquity/reboot boolean true
|
||||||
|
|
||||||
|
# -------- Post Installation --------
|
||||||
|
|
||||||
|
# After system is setup (before reboot), run post-install script.
|
||||||
|
#
|
||||||
|
# This command is run just before the install finishes, but when there is
|
||||||
|
# still a usable /target directory. You can chroot to /target and use it
|
||||||
|
# directly, or use the apt-install and in-target commands to easily install
|
57
ansible/templates/live.cfg.j2
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
timeout 100
|
||||||
|
|
||||||
|
menu background splash.png
|
||||||
|
menu title Bienvenue sur Linux Mint 22 64-bit - Libretic
|
||||||
|
|
||||||
|
menu color screen 37;40 #80ffffff #00000000 std
|
||||||
|
MENU COLOR border 30;44 #40ffffff #a0000000 std
|
||||||
|
MENU COLOR title 1;36;44 #ffffffff #a0000000 std
|
||||||
|
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
|
||||||
|
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
|
||||||
|
MENU COLOR help 37;40 #c0ffffff #a0000000 std
|
||||||
|
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
|
||||||
|
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
|
||||||
|
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
|
||||||
|
MENU COLOR tabmsg 31;40 #ffDEDEDE #00000000 std
|
||||||
|
MENU WIDTH 78
|
||||||
|
MENU MARGIN 15
|
||||||
|
MENU ROWS 6
|
||||||
|
MENU VSHIFT 10
|
||||||
|
MENU TABMSGROW 12
|
||||||
|
MENU CMDLINEROW 12
|
||||||
|
MENU HELPMSGROW 16
|
||||||
|
MENU HELPMSGENDROW 29
|
||||||
|
|
||||||
|
|
||||||
|
label live
|
||||||
|
menu label Linux Mint 22 Libretic - Live
|
||||||
|
menu default
|
||||||
|
kernel /casper/vmlinuz
|
||||||
|
append boot=casper initrd=/casper/initrd.gz username=mint hostname=mint quiet splash --
|
||||||
|
|
||||||
|
label compat
|
||||||
|
menu label Linux Mint 22 Libretic - Live (compatibility mode)
|
||||||
|
linux /casper/vmlinuz
|
||||||
|
append boot=casper initrd=/casper/initrd.gz username=mint hostname=mint noapic noacpi nosplash irqpoll nomodeset --
|
||||||
|
|
||||||
|
{% for item in preseed_versions %}
|
||||||
|
label libretic{{ item.boot_entry_name }}
|
||||||
|
menu label Linux Mint 22 Libretic - Autoinstall {{ item.boot_entry_name }}
|
||||||
|
kernel /casper/vmlinuz
|
||||||
|
append file=/cdrom/preseed/libretic-{{ item.boot_entry_name }}.ks auto=true priority=critical debian-installer/locale=fr_FR keyboard-configuration/layoutcode=fr ubiquity/reboot=casper languagechooser/language-name=French countrychooser/shortlist=FR localechooser/supported-locales=fr_FR.UTF-8 boot=casper automatic-ubiquity initrd=/casper/initrd.gz quiet splash noprompt noshell --
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
label hdt
|
||||||
|
menu label Hardware Detection
|
||||||
|
kernel hdt.c32
|
||||||
|
|
||||||
|
label local
|
||||||
|
menu label Boot from local drive
|
||||||
|
COM32 chain.c32
|
||||||
|
APPEND hd0
|
||||||
|
|
||||||
|
label memtest
|
||||||
|
menu label Memory test
|
||||||
|
linux /boot/memtest.bin
|
||||||
|
|
16
ansible/vars/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Définit, dans le cas d'une installation automatisée, les divers types
|
||||||
|
# de disque dur pour lesquels créer une section dans le menu de démarrage
|
||||||
|
preseed_versions:
|
||||||
|
- boot_entry_name: nvme
|
||||||
|
diskdevice: /dev/nvme0n1
|
||||||
|
- boot_entry_name: sda
|
||||||
|
diskdevice: /dev/sda
|
||||||
|
- boot_entry_name: vda
|
||||||
|
diskdevice: /dev/vda
|
||||||
|
|
||||||
|
# Définit, dans le cas d'une installation automatisée, le nom de l'utilisateur
|
||||||
|
# non root autorisé à lancer le menu libreticmenu
|
||||||
|
installer_username: installer
|
||||||
|
|
||||||
|
# Le mot de passe de cet utilisateur
|
||||||
|
installer_password: "{{ 'achanger' | password_hash('sha512', rounds=5000) }}"
|
BIN
doc/boot-grub.png
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
doc/boot-live.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
doc/cubic-folder.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
doc/last.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
doc/original_disk_customization.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
doc/preseed.png
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
doc/shell.png
Normal file
After Width: | Height: | Size: 22 KiB |