This commit is contained in:
maride 2024-07-09 16:10:04 +02:00
commit 4230cb2880
8 changed files with 101 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
builds/

33
arch.pkr.hcl Normal file
View File

@ -0,0 +1,33 @@
source "virtualbox-iso" "arch-vbox-efi" {
guest_os_type = "Linux_64"
iso_urls = ["https://packages.oth-regensburg.de/archlinux/iso/2024.07.01/archlinux-2024.07.01-x86_64.iso"]
iso_checksum = "sha256:398dceea2d04767fbb8b61a9e824f2c8f5eacf62b2cb5006fd63321d978d48bc"
firmware = "efi"
memory = "1024"
cpus = "2"
disk_size = "5000"
boot_wait = "5s"
boot_command = [
"<enter>",
"<wait30s>passwd<enter><wait>packer<enter><wait>packer<enter><wait>",
"top<enter>"
]
ssh_username = "root"
ssh_password = "packer"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
output_directory = "builds/${source.name}-${source.type}"
}
build {
sources = ["sources.virtualbox-iso.arch-vbox-efi"]
provisioner "file" {
source = "deliver"
destination = "/tmp/"
}
provisioner "shell" {
scripts = [ "scripts/00-packeys.sh", "scripts/10-disk.sh", "scripts/20-install.sh", "scripts/30-configure.sh", "scripts/40-bootloader.sh" ]
expect_disconnect = "true"
}
}

6
deliver/00-wired.network Normal file
View File

@ -0,0 +1,6 @@
[Match]
Name=enp* ens*
[Network]
DHCP=yes
DNS=1.1.1.1

5
scripts/00-packeys.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
dirmngr &
pacman-key --init
pacman-key --populate

20
scripts/10-disk.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# Partition
echo -e 'g\nn\n1\n2048\n+300M\nn\n2\n\n\np\nw' | fdisk /dev/sda
sync
# Format
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
sync
# Mount
mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
sync
# Display
df -h
mount

4
scripts/20-install.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
pacstrap -K /mnt base linux-hardened linux-firmware grub efibootmgr sudo vim

27
scripts/30-configure.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
# Set time
arch-chroot /mnt ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
arch-chroot /mnt hwclock --systohc
# Localize
echo -e 'en_US.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8' > /mnt/etc/locale.gen
arch-chroot /mnt locale-gen
echo 'LANG=de_DE.UTF-8' > /mnt/etc/locale.conf
echo 'KEYMAP=de-latin1' > /mnt/etc/vconsole.conf
# pacman easter egg :)
sed -i 's/\[options\]/\[options\]\nILoveCandy/g' /mnt/etc/pacman.conf
# set user and password, setup sudo
arch-chroot /mnt groupadd sudo
sed -i 's/# \%sudo/\%sudo/g' /mnt/etc/sudoers
arch-chroot /mnt useradd --create-home --password '$1$yChoD0uK$A606S7MGjw5OBvH4ZpIXO/' -G sudo user # user:user
# network
cp /tmp/deliver/00-wired.network /mnt/etc/systemd/network/00-wired.network
chmod 644 /mnt/etc/systemd/network/00-wired.network
arch-chroot /mnt systemctl enable systemd-networkd

5
scripts/40-bootloader.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=BOOT
cp /mnt/boot/EFI/BOOT/{grubx64.efi,BOOTX64.EFI} 2>&1 || true
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg