Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc69333054 |
@@ -1,4 +1,4 @@
|
||||
.PHONY: default base vagrant clean
|
||||
.PHONY: base vagrant clean
|
||||
|
||||
HEADLESS ?= true
|
||||
|
||||
@@ -11,8 +11,5 @@ base:
|
||||
vagrant:
|
||||
PKR_VAR_headless="$(HEADLESS)" packer build x86_64-qemu-vagrant.pkr.hcl
|
||||
|
||||
package:
|
||||
./scripts/package.sh
|
||||
|
||||
clean:
|
||||
rm -rf ./builds
|
||||
|
||||
@@ -1,34 +1,24 @@
|
||||
# Debian Trixie Builds
|
||||
|
||||
This directory contains Packer configuration for building Debian 13 (Trixie)
|
||||
images
|
||||
|
||||
### Overview
|
||||
## Usage
|
||||
|
||||
These builds use a multi-stage Packer workflow:
|
||||
Build the image:
|
||||
|
||||
- The first stage creates a minimal base image from the installer ISO
|
||||
- The second stage reuses that base image to produce a Vagrant-ready box
|
||||
```
|
||||
make
|
||||
```
|
||||
|
||||
### Usage
|
||||
Remove build artifacts:
|
||||
|
||||
Build the base qemu image:
|
||||
```
|
||||
make clean
|
||||
```
|
||||
|
||||
make base
|
||||
Build with a visible VM console for debugging:
|
||||
|
||||
Build vagrant image:
|
||||
|
||||
make vagrant
|
||||
|
||||
Package vagrant box:
|
||||
|
||||
make package
|
||||
|
||||
Build with visible console:
|
||||
|
||||
make base HEADLESS=false
|
||||
|
||||
### Publishing
|
||||
|
||||
Built boxes from this configuration are published at
|
||||
[krislamo.org/debian13](https://portal.cloud.hashicorp.com/vagrant/discover/krislamo.org/debian13)
|
||||
on Vagrant Cloud
|
||||
```
|
||||
make HEADLESS=false
|
||||
```
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
|
||||
install -d -m 755 -o root -g root /etc/systemd/network
|
||||
cat > /etc/systemd/network/lan0.network << 'EOF'
|
||||
[Match]
|
||||
Name=e*
|
||||
Type=ether
|
||||
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
EOF
|
||||
|
||||
chown root:root /etc/systemd/network/lan0.network
|
||||
chmod 644 /etc/systemd/network/lan0.network
|
||||
|
||||
mv /etc/network/interfaces /etc/network/interfaces.save
|
||||
mv /etc/network/interfaces.d /etc/network/interfaces.d.save
|
||||
systemctl enable systemd-networkd
|
||||
systemctl disable networking
|
||||
|
||||
printf "nameserver %s\n" 9.9.9.9 8.8.8.8 >/etc/resolv.conf
|
||||
cat /etc/resolv.conf
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -xu
|
||||
|
||||
IMG_DIR="./builds/qemu/debian-13-64-vagrant"
|
||||
if [ ! -f "$IMG_DIR/debian-13-64-vagrant" ]; then
|
||||
echo "[ERROR]: debian-13-64-vagrant doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > "$IMG_DIR/metadata.json" <<EOF
|
||||
{"provider":"libvirt","format":"qcow2","virtual_size":100}
|
||||
EOF
|
||||
|
||||
cat > "$IMG_DIR/Vagrantfile" <<'EOF'
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_version: 4
|
||||
end
|
||||
EOF
|
||||
|
||||
mkdir -p ./builds/vagrant
|
||||
|
||||
if [ ! -f ./builds/vagrant/box.img ]; then
|
||||
cp -l $IMG_DIR/debian-13-64-vagrant \
|
||||
$IMG_DIR/box.img
|
||||
fi
|
||||
|
||||
if [ ! -f ./builds/vagrant/debian-13-64-vagrant.box ]; then
|
||||
tar -C "$IMG_DIR" -cvzf ./builds/vagrant/debian-13-64-vagrant.box \
|
||||
box.img metadata.json Vagrantfile
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[ERROR]: debian-13-64-vagrant.box already exists"
|
||||
exit 1
|
||||
@@ -3,16 +3,9 @@ set -eu
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y \
|
||||
qemu-guest-agent \
|
||||
nfs-common \
|
||||
openssl \
|
||||
curl \
|
||||
sudo \
|
||||
vim \
|
||||
python3-apt
|
||||
apt-get install -y openssl curl sudo
|
||||
|
||||
useradd -m -s /bin/bash -p "$(openssl passwd -1 vagrant)" vagrant
|
||||
useradd -m -p "$(openssl passwd -1 vagrant)" vagrant
|
||||
|
||||
echo "vagrant ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/vagrant
|
||||
chmod 440 /etc/sudoers.d/vagrant
|
||||
@@ -22,7 +15,6 @@ BASE_GH_URL="https://raw.githubusercontent.com/hashicorp/vagrant/refs/heads"
|
||||
curl -fsSL "${BASE_GH_URL}/main/keys/vagrant.pub" \
|
||||
-o /home/vagrant/.ssh/authorized_keys
|
||||
chmod 600 /home/vagrant/.ssh/authorized_keys
|
||||
chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys
|
||||
|
||||
sed -i 's/PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||
passwd -d root
|
||||
|
||||
@@ -69,8 +69,7 @@ build {
|
||||
|
||||
provisioner "shell" {
|
||||
scripts = [
|
||||
"scripts/upgrade.sh",
|
||||
"scripts/networkd.sh",
|
||||
"scripts/aptupdate.sh",
|
||||
"scripts/clean.sh"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ source "qemu" "debian-13-64-vagrant" {
|
||||
iso_url = "builds/qemu/debian-13-64-base/debian-13-64-base"
|
||||
disk_image = true
|
||||
iso_checksum = "none"
|
||||
output_directory = "builds/qemu/debian-13-64-vagrant"
|
||||
output_directory = "builds/qemu"
|
||||
shutdown_command = "/usr/bin/systemctl poweroff"
|
||||
disk_interface = "virtio"
|
||||
disk_size = var.disk_size
|
||||
|
||||
Reference in New Issue
Block a user