Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
e4db7ff961 | |||
e316a27520 | |||
74ba0b70fe | |||
0d9dc6c780 | |||
e286f130ed | |||
6a460938c2 | |||
6d2d43203a | |||
2850a87f82 | |||
1426b740a3 |
28
README.md
|
@ -3,37 +3,51 @@
|
||||||
## Utiliser
|
## Utiliser
|
||||||
|
|
||||||
1. installer VirtualBox https://www.virtualbox.org/wiki/Downloads
|
1. installer VirtualBox https://www.virtualbox.org/wiki/Downloads
|
||||||
2. télécharger la vm au format .ova
|
2. télécharger la vm au format .ova ici : https://git.barnulf.net/epita/epitls_vm/releases/download/latest/epitls.ova
|
||||||
3. importer la vm dans virtualbox (double cliquer le fichier)
|
3. importer la vm dans virtualbox (double cliquer le fichier)
|
||||||
|
|
||||||
## Contribuer
|
## Contribuer
|
||||||
|
|
||||||
|
Vous pouvez améliorer cette machine virtuelle en contribuant à ce dépot.
|
||||||
|
|
||||||
|
- Pour ajouter des logiciels, les rajouter dans la liste `packages` dans `src/iso_root/user_configuration.json`.
|
||||||
|
- Pour ajouter des fichiers à l'installation par défaut :
|
||||||
|
- Les intégrer dans `src/iso_root/content`.
|
||||||
|
- Modifier `src/iso_root/post_install.sh` pour installer les fichiers au bon endroit.
|
||||||
|
|
||||||
|
Pour publier vos changements, ouvrez une PR.
|
||||||
|
Si je ne réagis pas, me contacter par discord (@majorbarnulf) ou mail (matthieu@imagevo.fr).
|
||||||
|
|
||||||
### Dépendances
|
### Dépendances
|
||||||
|
|
||||||
|
Les logiciels suivants sont nécessaires pour générer la VM à partir de ce dépot.
|
||||||
|
|
||||||
- pacman
|
- pacman
|
||||||
- wget
|
- wget
|
||||||
- net-tools
|
- net-tools
|
||||||
- archiso
|
- archiso
|
||||||
- virtualbox
|
- virtualbox
|
||||||
|
|
||||||
|
Archlinux est recommandé comme OS host pour générer la VM.
|
||||||
|
|
||||||
### Fabrication
|
### Fabrication
|
||||||
|
|
||||||
La fabrication de la machine virtuelle est assez farfelue mais ça marche assez bien.
|
La fabrication de la machine virtuelle est assez farfelue mais ça marche assez bien.
|
||||||
Les étapes de la fabrication sont les suivantes :
|
Les étapes de la fabrication sont les suivantes :
|
||||||
|
|
||||||
- création d'un ISO d'installation archlinux
|
- création d'un ISO d'installation archlinux
|
||||||
- généré à partir du profil dans `./profile`
|
- généré à partir du profil dans `./src/profile`
|
||||||
- contient un script d'installation automatisé qui est exécuté au boot `./profile/airootfs/root/.zlogin`
|
- contient un script d'installation automatisé qui est exécuté au boot `./src/profile/airootfs/root/.zlogin`
|
||||||
|
|
||||||
- création d'une VM vide avec VirtualBox
|
- création d'une VM vide avec VirtualBox
|
||||||
- bloc de commandes dans `./build.sh`
|
- bloc de commandes dans `./src/build.sh`
|
||||||
|
|
||||||
- Boot de la VM sur l'ISO
|
- Boot de la VM sur l'ISO
|
||||||
- aussi dans `./build.sh`
|
- aussi dans `./src/build.sh`
|
||||||
|
|
||||||
- l'ISO installe la distribution
|
- l'ISO installe la distribution
|
||||||
- installe arch `archinstall` avec la configuration `./profile/airootfs/root/user_*.json`
|
- installe arch `archinstall` avec la configuration `./src/profile/airootfs/root/user_*.json`
|
||||||
- quelques ajustements avec `./profile/airootfs/root/post_install.sh`
|
- quelques ajustements avec `./src/profile/airootfs/root/post_install.sh`
|
||||||
- stop une fois la machine virtuelle configurée
|
- stop une fois la machine virtuelle configurée
|
||||||
|
|
||||||
- exporte la VM au format OVA dans `./output/epitls.ova`
|
- exporte la VM au format OVA dans `./output/epitls.ova`
|
||||||
|
|
73
build.sh
|
@ -1,73 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
cd "$(dirname "$(realpath "$0")")"
|
|
||||||
|
|
||||||
alias log='echo [build.sh]'
|
|
||||||
|
|
||||||
|
|
||||||
VBOX_VERSION=$(VBoxManage --version | cut -d 'r' -f 1)
|
|
||||||
ETH_DEV=$(route | grep '^default' | grep -o '[^ ]*$')
|
|
||||||
VM_NAME="epitls_build"
|
|
||||||
|
|
||||||
|
|
||||||
log "updating environment"
|
|
||||||
sudo rm -fr tmp
|
|
||||||
mkdir -p tmp output
|
|
||||||
if ! [ -f output/guest_add.iso ]
|
|
||||||
then wget -O output/guest_add.iso "https://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
AURS="zerofree"
|
|
||||||
|
|
||||||
|
|
||||||
log "creating package db"
|
|
||||||
rm -fr /tmp/custom-db
|
|
||||||
mkdir /tmp/custom-db
|
|
||||||
for aur in $AURS
|
|
||||||
do
|
|
||||||
git clone "https://aur.archlinux.org/$aur.git" "/tmp/custom-db/$aur"
|
|
||||||
( cd "/tmp/custom-db/$aur" && makepkg; )
|
|
||||||
mv /tmp/custom-db/$aur/$aur-* /tmp/custom-db/
|
|
||||||
repo-add /tmp/custom-db/custom.db.tar.gz /tmp/custom-db/$aur-*.pkg.tar.zst
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
log "creating iso"
|
|
||||||
sudo mkarchiso -v -w $PWD/tmp/wdir -r -o $PWD/output $PWD/profile
|
|
||||||
rm -f output/install.iso
|
|
||||||
mv output/archlinux-*.iso output/install.iso
|
|
||||||
|
|
||||||
|
|
||||||
if VBoxManage showvminfo $VM_NAME 2> /dev/null
|
|
||||||
then log "disposing old VM"
|
|
||||||
VBoxManage unregistervm $VM_NAME --delete-all
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
log "creating VM"
|
|
||||||
VBoxManage createvm --name=$VM_NAME --ostype=ArchLinux_64 --register
|
|
||||||
VBoxManage modifyvm $VM_NAME --cpus=4 --memory=4096 --vram=12 --firmware=efi
|
|
||||||
VBoxManage modifyvm $VM_NAME --nic1=bridged --bridgeadapter1=$ETH_DEV
|
|
||||||
VBoxManage createhd --filename=$PWD/tmp/drive.vdi --size=$((1024 * 20)) --variant=Standard
|
|
||||||
VBoxManage storagectl $VM_NAME --name=SATA --add sata --bootable on
|
|
||||||
VBoxManage storageattach $VM_NAME --storagectl=SATA --port=0 --device=0 --type=hdd --medium=$PWD/tmp/drive.vdi
|
|
||||||
VBoxManage storagectl $VM_NAME --name=IDE --add ide
|
|
||||||
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=0 --device=0 --type=dvddrive --medium=$PWD/output/install.iso
|
|
||||||
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=1 --device=1 --type=dvddrive --medium=$PWD/output/guest_add.iso
|
|
||||||
|
|
||||||
|
|
||||||
log "running VM with iso"
|
|
||||||
virtualboxvm --startvm $VM_NAME --dvd $PWD/output/install.iso
|
|
||||||
|
|
||||||
|
|
||||||
log "exporting VM"
|
|
||||||
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=0 --device=0 --medium=none # removes iso after run
|
|
||||||
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=1 --device=1 --medium=none # removes iso after run
|
|
||||||
VBoxManage modifyhd $PWD/tmp/drive.vdi -compact
|
|
||||||
rm -f $PWD/output/epitls.ova
|
|
||||||
VBoxManage export $VM_NAME --output=$PWD/output/epitls.ova --vsys=0 --vmname=epitls --description="VM pour le développement à EPITA Toulouse."
|
|
||||||
|
|
||||||
|
|
||||||
log "disposing VM"
|
|
||||||
VBoxManage unregistervm $VM_NAME --delete-all
|
|
75
src/build.sh
Executable file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$(realpath "$0")")"
|
||||||
|
|
||||||
|
alias log='echo [build.sh]'
|
||||||
|
|
||||||
|
|
||||||
|
TMP_DIR="${TMP_DIR:-"$PWD/../tmp"}"
|
||||||
|
OUT_DIR="${OUT_DIR:-"$PWD/../output"}"
|
||||||
|
VBOX_VERSION=$(VBoxManage --version | cut -d 'r' -f 1)
|
||||||
|
VM_NAME="epitls_build"
|
||||||
|
|
||||||
|
|
||||||
|
log "updating environment"
|
||||||
|
sudo rm -fr "$TMP_DIR"
|
||||||
|
mkdir -p "$TMP_DIR" "$OUT_DIR"
|
||||||
|
if ! [ -f "$OUT_DIR/guest_add.iso" ]
|
||||||
|
then wget -O "$OUT_DIR/guest_add.iso" "https://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
AURS="zerofree"
|
||||||
|
|
||||||
|
|
||||||
|
log "creating package db"
|
||||||
|
rm -fr "$TMP_DIR/custom-db"
|
||||||
|
mkdir "$TMP_DIR/custom-db"
|
||||||
|
for aur in $AURS
|
||||||
|
do
|
||||||
|
git clone "https://aur.archlinux.org/$aur.git" "$TMP_DIR/custom-db/$aur"
|
||||||
|
( cd "$TMP_DIR/custom-db/$aur" && makepkg; )
|
||||||
|
mv "$TMP_DIR"/custom-db/$aur/$aur-* "$TMP_DIR/custom-db/"
|
||||||
|
repo-add "$TMP_DIR/custom-db/custom.db.tar.gz" "$TMP_DIR/custom-db"/$aur-*.pkg.tar.zst
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
log "creating iso"
|
||||||
|
sudo mkarchiso -v -w "$TMP_DIR/wdir" -r -o "$OUT_DIR" "$PWD/profile"
|
||||||
|
rm -f "$OUT_DIR/install.iso"
|
||||||
|
mv "$OUT_DIR"/archlinux-*.iso "$OUT_DIR/install.iso"
|
||||||
|
|
||||||
|
|
||||||
|
if VBoxManage showvminfo $VM_NAME 2> /dev/null
|
||||||
|
then log "disposing old VM"
|
||||||
|
VBoxManage unregistervm $VM_NAME --delete-all
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
log "creating VM"
|
||||||
|
VBoxManage createvm --name=$VM_NAME --ostype=ArchLinux_64 --register
|
||||||
|
VBoxManage modifyvm $VM_NAME --cpus=16 --memory=8192 --vram=32 --firmware=efi
|
||||||
|
VBoxManage modifyvm $VM_NAME --nic1=nat
|
||||||
|
VBoxManage createhd --filename="$TMP_DIR/drive.vdi" --size=$((50 * 1024)) --variant=Standard
|
||||||
|
VBoxManage storagectl $VM_NAME --name=SATA --add sata --bootable on
|
||||||
|
VBoxManage storageattach $VM_NAME --storagectl=SATA --port=0 --device=0 --type=hdd --medium="$TMP_DIR/drive.vdi"
|
||||||
|
VBoxManage storagectl $VM_NAME --name=IDE --add ide
|
||||||
|
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=0 --device=0 --type=dvddrive --medium="$OUT_DIR/install.iso"
|
||||||
|
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=1 --device=1 --type=dvddrive --medium="$OUT_DIR/guest_add.iso"
|
||||||
|
|
||||||
|
|
||||||
|
log "running VM with iso"
|
||||||
|
virtualboxvm --startvm $VM_NAME --dvd "$OUT_DIR/install.iso"
|
||||||
|
|
||||||
|
|
||||||
|
log "exporting VM"
|
||||||
|
VBoxManage modifyvm $VM_NAME --cpus=4 --memory=4096 --vram=24
|
||||||
|
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=0 --device=0 --medium=none # removes iso after run
|
||||||
|
VBoxManage storageattach $VM_NAME --storagectl=IDE --port=1 --device=1 --medium=none # removes iso after run
|
||||||
|
VBoxManage modifyhd "$TMP_DIR/drive.vdi" -compact
|
||||||
|
rm -f "$OUT_DIR/epitls.ova"
|
||||||
|
VBoxManage export $VM_NAME --output="$OUT_DIR/epitls.ova" --vsys=0 --vmname=epitls --description="VM pour le développement à EPITA Toulouse."
|
||||||
|
|
||||||
|
|
||||||
|
log "disposing VM"
|
||||||
|
VBoxManage unregistervm $VM_NAME --delete-all
|
|
@ -1 +1 @@
|
||||||
../profile/airootfs/root/content/home
|
profile/airootfs/root/content/home
|
|
@ -1 +1 @@
|
||||||
../profile/airootfs/root
|
profile/airootfs/root
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 790 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 676 B |