diff --git a/README.md b/README.md index bc9553c..f279643 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,21 @@ -# linux VM for dev +# VM linux pour dev @ epita Toulouse -- create installation ISO - - write ISO RC +## Utiliser + +1. installer VirtualBox https://www.virtualbox.org/wiki/Downloads +2. télécharger la vm au format .ova +3. importer la vm dans + +## Contribuer + +### Fabrication + +La fabrication du vdi est assez farfelue mais ça marche assez bien. +Les étapes de la fabrication sont les suivantes : + +- création d'un ISO d'installation archlinux + - généré à partir du profil dans `./profile` + - contient un script d'installation automatisé qui est exécuté au boot - create empty VM - start VM on ISO diff --git a/build.sh b/build.sh index 59913b9..3530c89 100755 --- a/build.sh +++ b/build.sh @@ -5,16 +5,18 @@ cd "$(dirname "$(realpath "$0")")" alias log='echo [build.sh]' +ETH_DEV=$(route | grep '^default' | grep -o '[^ ]*$') +VM_NAME="epitls_build" + + log "creating iso" - sudo rm -fr tmp + sudo rm -fr tmp/* mkdir -p tmp output 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 -VM_NAME="epitls_build" - - if VBoxManage showvminfo $VM_NAME 2> /dev/null then log "disposing old VM" VBoxManage unregistervm $VM_NAME --delete-all @@ -22,13 +24,25 @@ fi log "creating VM" - VBoxManage createvm --name=$VM_NAME --register + VBoxManage createvm --name=$VM_NAME --ostype=ArchLinux_64 --register + VBoxManage modifyvm $VM_NAME --cpus=4 --memory=4096 --vram=12 + 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 log "running VM with iso" - virtualboxvm --startvm $VM_NAME --dvd output/install.iso + virtualboxvm --startvm $VM_NAME --dvd $PWD/output/install.iso + VBoxManage storageattach $VM_NAME --storagectl=IDE --port=0 --device=0 --medium=none + + +log "exporting VM" + 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 - diff --git a/profile/airootfs/root/.automated_script.sh b/profile/airootfs/root/.automated_script.sh deleted file mode 100755 index 0d95012..0000000 --- a/profile/airootfs/root/.automated_script.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -script_cmdline() { - local param - for param in $(