working state
This commit is contained in:
parent
d94113878f
commit
46cea63aae
12 changed files with 241 additions and 61 deletions
20
README.md
20
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
|
||||
|
|
28
build.sh
28
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
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
script_cmdline() {
|
||||
local param
|
||||
for param in $(</proc/cmdline); do
|
||||
case "${param}" in
|
||||
script=*)
|
||||
echo "${param#*=}"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
automated_script() {
|
||||
local script rt
|
||||
script="$(script_cmdline)"
|
||||
if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then
|
||||
if [[ "${script}" =~ ^((http|https|ftp|tftp)://) ]]; then
|
||||
# there's no synchronization for network availability before executing this script
|
||||
printf '%s: waiting for network-online.target\n' "$0"
|
||||
until systemctl --quiet is-active network-online.target; do
|
||||
sleep 1
|
||||
done
|
||||
printf '%s: downloading %s\n' "$0" "${script}"
|
||||
curl "${script}" --location --retry-connrefused --retry 10 -s -o /tmp/startup_script
|
||||
rt=$?
|
||||
else
|
||||
cp "${script}" /tmp/startup_script
|
||||
rt=$?
|
||||
fi
|
||||
if [[ ${rt} -eq 0 ]]; then
|
||||
chmod +x /tmp/startup_script
|
||||
printf '%s: executing automated script\n' "$0"
|
||||
# note that script is executed when other services (like pacman-init) may be still in progress, please
|
||||
# synchronize to "systemctl is-system-running --wait" when your script depends on other services
|
||||
/tmp/startup_script
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $(tty) == "/dev/tty1" ]]; then
|
||||
automated_script
|
||||
fi
|
|
@ -3,4 +3,14 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
|||
setopt SINGLE_LINE_ZLE
|
||||
fi
|
||||
|
||||
~/.automated_script.sh
|
||||
loadkeys fr
|
||||
|
||||
echo "[.zlogin] ____ starting auto install ____"
|
||||
archinstall --config ./user_configuration.json --creds ./user_credentials.json
|
||||
echo "[.zlogin] ____ finished auto install ____"
|
||||
echo "[.zlogin] ____ starting post install ____"
|
||||
sh post_install.sh
|
||||
echo "[.zlogin] ____ finished post install ____"
|
||||
|
||||
# echo "[.zlogin] shutting down ..."
|
||||
# # shutdown now
|
||||
|
|
22
profile/airootfs/root/post_install.sh
Normal file
22
profile/airootfs/root/post_install.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
alias log='echo [post_install.sh]'
|
||||
|
||||
|
||||
ROOT=/mnt/archinstall
|
||||
|
||||
|
||||
log "altering linux confs"
|
||||
sed -i 's|# %wheel ALL=(ALL:ALL) NOPASSWD: ALL|%wheel ALL=(ALL:ALL) NOPASSWD: ALL|g' "$ROOT/etc/sudoers"
|
||||
sed -i 's|@includedir /etc/sudoers.d|# @includedir /etc/sudoers.d|g' "$ROOT/etc/sudoers"
|
||||
sed -i 's|#ParallelDownloads = 5|ParallelDownloads = 5|g' "$ROOT/etc/pacman.conf"
|
||||
sed -i 's|SigLevel = Required DatabaseOptional|SigLevel = Never|g' "$ROOT/etc/pacman.conf"
|
||||
|
||||
|
||||
log "installing paru"
|
||||
echo "
|
||||
cd /tmp
|
||||
git clone https://aur.archlinux.org/paru-bin.git
|
||||
cd paru-bin
|
||||
makepkg -si
|
||||
" | arch-chroot "$ROOT" su user sh
|
153
profile/airootfs/root/user_configuration.json
Normal file
153
profile/airootfs/root/user_configuration.json
Normal file
|
@ -0,0 +1,153 @@
|
|||
{
|
||||
"additional-repositories": [],
|
||||
"archinstall-language": "English",
|
||||
"audio_config": {
|
||||
"audio": "pulseaudio"
|
||||
},
|
||||
"bootloader": "Limine",
|
||||
"config_version": "2.7.1",
|
||||
"debug": false,
|
||||
"disk_config": {
|
||||
"config_type": "default_layout",
|
||||
"device_modifications": [
|
||||
{
|
||||
"device": "/dev/sda",
|
||||
"partitions": [
|
||||
{
|
||||
"btrfs": [],
|
||||
"dev_path": null,
|
||||
"flags": [
|
||||
"Boot"
|
||||
],
|
||||
"fs_type": "fat32",
|
||||
"mount_options": [],
|
||||
"mountpoint": "/boot",
|
||||
"obj_id": "d0c249bc-34fb-4e40-9211-25bef99178f3",
|
||||
"size": {
|
||||
"sector_size": {
|
||||
"unit": "B",
|
||||
"value": 512
|
||||
},
|
||||
"unit": "MiB",
|
||||
"value": 203
|
||||
},
|
||||
"start": {
|
||||
"sector_size": {
|
||||
"unit": "B",
|
||||
"value": 512
|
||||
},
|
||||
"unit": "MiB",
|
||||
"value": 3
|
||||
},
|
||||
"status": "create",
|
||||
"type": "primary"
|
||||
},
|
||||
{
|
||||
"btrfs": [],
|
||||
"dev_path": null,
|
||||
"flags": [],
|
||||
"fs_type": "ext4",
|
||||
"mount_options": [],
|
||||
"mountpoint": "/",
|
||||
"obj_id": "32195d81-ab74-4bf3-b653-f7b23f774dae",
|
||||
"size": {
|
||||
"sector_size": {
|
||||
"unit": "B",
|
||||
"value": 512
|
||||
},
|
||||
"unit": "B",
|
||||
"value": 21258829824
|
||||
},
|
||||
"start": {
|
||||
"sector_size": {
|
||||
"unit": "B",
|
||||
"value": 512
|
||||
},
|
||||
"unit": "B",
|
||||
"value": 216006656
|
||||
},
|
||||
"status": "create",
|
||||
"type": "primary"
|
||||
}
|
||||
],
|
||||
"wipe": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"disk_encryption": null,
|
||||
"hostname": "epitls",
|
||||
"kernels": [
|
||||
"linux"
|
||||
],
|
||||
"locale_config": {
|
||||
"kb_layout": "fr",
|
||||
"sys_enc": "UTF-8",
|
||||
"sys_lang": "en_US"
|
||||
},
|
||||
"mirror_config": {
|
||||
"custom_mirrors": [],
|
||||
"mirror_regions": {
|
||||
"France": [
|
||||
"https://mirrors.jtremesay.org/archlinux/$repo/os/$arch",
|
||||
"https://mirrors.gandi.net/archlinux/$repo/os/$arch",
|
||||
"https://mirrors.eric.ovh/arch/$repo/os/$arch",
|
||||
"https://mirrors.celianvdb.fr/archlinux/$repo/os/$arch",
|
||||
"https://mirror.wormhole.eu/archlinux/$repo/os/$arch",
|
||||
"https://mirror.theo546.fr/archlinux/$repo/os/$arch",
|
||||
"https://mirror.thekinrar.fr/archlinux/$repo/os/$arch",
|
||||
"https://mirror.sysa.tech/archlinux/$repo/os/$arch",
|
||||
"https://mirror.oldsql.cc/archlinux/$repo/os/$arch",
|
||||
"https://mirror.its-tps.fr/archlinux/$repo/os/$arch",
|
||||
"https://mirror.ibakerserver.pt/Arch/$repo/os/$arch",
|
||||
"https://mirror.cyberbits.eu/archlinux/$repo/os/$arch",
|
||||
"https://archlinux.mirrors.ovh.net/archlinux/$repo/os/$arch",
|
||||
"https://archlinux.mailtunnel.eu/$repo/os/$arch",
|
||||
"https://arch.yourlabs.org/$repo/os/$arch",
|
||||
"http://mirrors.gandi.net/archlinux/$repo/os/$arch",
|
||||
"http://mirrors.celianvdb.fr/archlinux/$repo/os/$arch",
|
||||
"http://mirror.theo546.fr/archlinux/$repo/os/$arch",
|
||||
"http://mirror.oldsql.cc/archlinux/$repo/os/$arch",
|
||||
"http://mirror.lastmikoi.net/archlinux/$repo/os/$arch",
|
||||
"http://mirror.its-tps.fr/archlinux/$repo/os/$arch",
|
||||
"http://mirror.cyberbits.eu/archlinux/$repo/os/$arch",
|
||||
"http://mirror.archlinux.ikoula.com/archlinux/$repo/os/$arch",
|
||||
"http://mir.archlinux.fr/$repo/os/$arch",
|
||||
"http://ftp.u-strasbg.fr/linux/distributions/archlinux/$repo/os/$arch",
|
||||
"http://archlinux.mirrors.ovh.net/archlinux/$repo/os/$arch",
|
||||
"http://archlinux.mailtunnel.eu/$repo/os/$arch",
|
||||
"http://archlinux.datagr.am/$repo/os/$arch",
|
||||
"http://arch.yourlabs.org/$repo/os/$arch"
|
||||
]
|
||||
}
|
||||
},
|
||||
"network_config": {},
|
||||
"no_pkg_lookups": false,
|
||||
"ntp": true,
|
||||
"offline": false,
|
||||
"packages": [
|
||||
"git",
|
||||
"virtualbox-guest-utils"
|
||||
],
|
||||
"parallel downloads": 0,
|
||||
"profile_config": {
|
||||
"gfx_driver": "All open-source",
|
||||
"greeter": "lightdm-gtk-greeter",
|
||||
"profile": {
|
||||
"custom_settings": {
|
||||
"Xfce4": {}
|
||||
},
|
||||
"details": [
|
||||
"Xfce4"
|
||||
],
|
||||
"main": "Desktop"
|
||||
}
|
||||
},
|
||||
"script": "guided",
|
||||
"silent": false,
|
||||
"skip_ntp": false,
|
||||
"skip_version_check": false,
|
||||
"swap": true,
|
||||
"timezone": "Europe/Paris",
|
||||
"uki": false,
|
||||
"version": "2.7.1"
|
||||
}
|
10
profile/airootfs/root/user_credentials.json
Normal file
10
profile/airootfs/root/user_credentials.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"!root-password": "root",
|
||||
"!users": [
|
||||
{
|
||||
"!password": "user",
|
||||
"sudo": true,
|
||||
"username": "user"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
timeout 15
|
||||
timeout 3
|
||||
default 01-archiso-x86_64-linux.conf
|
||||
beep on
|
||||
|
|
|
@ -54,7 +54,7 @@ fi
|
|||
|
||||
# Set default menu entry
|
||||
default=archlinux
|
||||
timeout=15
|
||||
timeout=3
|
||||
timeout_style=menu
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Set default menu entry
|
||||
default=archlinux
|
||||
timeout=15
|
||||
timeout=3
|
||||
timeout_style=menu
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Architecture = auto
|
|||
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
Color
|
||||
#NoProgressBar
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
|
@ -39,7 +39,8 @@ ParallelDownloads = 5
|
|||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
SigLevel = Required DatabaseOptional
|
||||
SigLevel = Never
|
||||
#SigLevel = Required DatabaseOptional
|
||||
LocalFileSigLevel = Optional
|
||||
#RemoteFileSigLevel = Required
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
INCLUDE archiso_head.cfg
|
||||
|
||||
DEFAULT arch64
|
||||
TIMEOUT 150
|
||||
TIMEOUT 30
|
||||
|
||||
INCLUDE archiso_sys-linux.cfg
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue