Commit eab76956 authored by Erwan BOUSSE's avatar Erwan BOUSSE
Browse files

Various small changes

parent 9a214bdb
......@@ -5,3 +5,5 @@ isos
output
pid
.vscode
output.bad
output.bak
\ No newline at end of file
......@@ -19,6 +19,10 @@ echo "XSession=mate" >> /var/lib/AccountsService/users/etudiant
# Fix network
mkdir -p /etc/NetworkManager/conf.d/
touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
TPMFILESETC=/usr/lib/tmpfiles.d/etc.conf
if [[ ! -f "$TPMFILESETC" ]]; then
echo "L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf" > $TPMFILESETC
fi
# Install VBox additions
apt-get -y install "linux-headers-$(uname -r)"
......@@ -31,5 +35,11 @@ apt-get -y install firefox-locale-fr gnome-user-docs-fr language-pack-fr languag
# Upgrade everything
apt-get -y dist-upgrade
##### Saving space
# Clean cache
rm -rf /var/lib/apt/lists
\ No newline at end of file
apt-get -y clean
rm -rf /var/lib/apt/lists
# Remove firmware (useless since virtual machine)
rm -rf /usr/lib/firmware
\ No newline at end of file
......@@ -3,7 +3,8 @@ autoinstall:
version: 1
identity:
hostname: mini-ubuntu
# printf 'ubuntu' | openssl passwd -6 -salt 'exDY1mhS4KUYCE/2' -stdin
# password generated with:
# printf 'etudiant' | openssl passwd -6 -salt 'exDY1mhS4KUYCE/2' -stdin
password: "$6$exDY1mhS4KUYCE/2$1bL3MtsjHt17fE3ZOq4eLwVlHh4ZM/VICNvTWfXlkDBI9FnPdIgnZLpSZIudqfzKYedhoH3Zvte/hpcyl2yaS0"
username: etudiant
keyboard:
......@@ -14,16 +15,17 @@ autoinstall:
- dkms
- linux-headers-generic
locale: fr_FR.UTF-8
# Prepare everything we need in the /mnt/stuff folder
early-commands:
# Mount VBox additions iso
- mkdir /mnt/vboxiso
- mount /dev/vdb /mnt/vboxiso
- mkdir /mnt/stuff
- wget http://_gateway:3003/late-commands.sh
- mv ./late-commands.sh /mnt/stuff
# Retrieve everything from /mnt/stuff, and apply last changes (late-commands.sh + VBoxLinuxAdditions)
late-commands:
- cp /mnt/stuff/late-commands.sh /target/root
- cp /mnt/vboxiso/VBoxLinuxAdditions.run /target/root
- curtin in-target -t /target -- /bin/bash /root/late-commands.sh
- ln -sf /run/systemd/resolve/stub-resolv.conf /target/etc/resolv.conf
\ No newline at end of file
- curtin in-target -t /target -- /bin/bash /root/late-commands.sh
\ No newline at end of file
......@@ -18,6 +18,7 @@ IMG_BASENAME=$(basename -s .img $IMG)
OUTPUT_FOLDER=output
OUTPUT_VDI=$OUTPUT_FOLDER/${IMG_BASENAME}.vdi
OUTPUT_OVA=$OUTPUT_FOLDER/${IMG_BASENAME}.ova
OUTPUT_VBOX=$HOME/.config/VirtualBox/output/${IMG_BASENAME}.vbox
VM_NAME=$IMG_BASENAME
......@@ -26,6 +27,7 @@ VBoxManage unregistervm "$VM_NAME" --delete || true
mkdir -p $OUTPUT_FOLDER
rm $OUTPUT_VDI || true
rm $OUTPUT_OVA || true
rm $OUTPUT_VBOX || true
VBoxManage convertfromraw --format vdi $IMG $OUTPUT_VDI
VBoxManage createvm --name "$VM_NAME" --ostype "Ubuntu_64" --register --basefolder $OUTPUT_FOLDER
......
......@@ -63,9 +63,11 @@ if [ -f "$CUSTOMIZATION_FOLDER/run.sh" ]; then
# Chroot
sudo mount -t proc /proc /mnt/proc
sudo mount --rbind /sys /mnt/sys
sudo mount --bind /dev/pts /mnt/dev/pts
sudo chroot /mnt /bin/bash /root/run.sh
sudo umount -f -l /mnt/proc
sudo umount -f -l /mnt/sys
sudo umount -f -l /mnt/dev/pts
# Disable DNS in chroot
sudo rm /mnt/etc/resolv.conf || true
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment