From 5337ee2aed892cc32139a0c36ea3bf6d62f81611 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Fri, 8 Mar 2024 02:12:02 +0100 Subject: [PATCH] add dvi optimization --- build.sh | 20 ++++++++++++++++++-- profile/airootfs/root/post_install.sh | 9 ++++++++- profile/packages.x86_64 | 1 + profile/pacman.conf | 6 +++--- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 0fffd3d..12b80b9 100755 --- a/build.sh +++ b/build.sh @@ -18,6 +18,21 @@ log "updating environment" 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 @@ -44,11 +59,12 @@ log "creating VM" log "running VM with iso" virtualboxvm --startvm $VM_NAME --dvd $PWD/output/install.iso - 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 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." diff --git a/profile/airootfs/root/post_install.sh b/profile/airootfs/root/post_install.sh index 6345e66..2b3a7e7 100644 --- a/profile/airootfs/root/post_install.sh +++ b/profile/airootfs/root/post_install.sh @@ -33,7 +33,7 @@ log "installing virtualbox guest additions" echo " cd /mnt/cdrom echo yes | sudo ./VBoxLinuxAdditions.run - " | arch-chroot -u user "$ROOT" + " | arch-chroot -u user "$ROOT" || true # will fail to reload modules since running in a chroot, but installation still successful log "installing paru" @@ -94,3 +94,10 @@ log "configuring home" do code --install-extension $ext done ' | arch-chroot -u user "$ROOT" + + +log "optimizing drive" + umount "$ROOT/mnt/crdom" + umount "$ROOT/boot" + umount "$ROOT" + zerofree -v /dev/sda2 # note : sda2 is the 20Gb drive, sda1 is the boot partition diff --git a/profile/packages.x86_64 b/profile/packages.x86_64 index 7fc9dff..7d099d9 100644 --- a/profile/packages.x86_64 +++ b/profile/packages.x86_64 @@ -132,3 +132,4 @@ xl2tpd zsh # mb packages +zerofree diff --git a/profile/pacman.conf b/profile/pacman.conf index 48b05be..8962416 100644 --- a/profile/pacman.conf +++ b/profile/pacman.conf @@ -94,6 +94,6 @@ Include = /etc/pacman.d/mirrorlist # An example of a custom package repository. See the pacman manpage for # tips on creating your own repositories. -#[custom] -#SigLevel = Optional TrustAll -#Server = file:///home/custompkgs +[custom] +SigLevel = Optional TrustAll +Server = file:///tmp/custom-db