mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-12-24 14:06:47 +01:00
test: improve vm image generation
This commit is contained in:
parent
b4311dac65
commit
3393d8f649
9 changed files with 47 additions and 8 deletions
|
@ -21,7 +21,7 @@ $(PACKERS):
|
|||
make --directory=../ package dist=${@}
|
||||
packer build -force -var version=${VERSION} \
|
||||
-var disk_size=${disk} -var flavor="${flavor}" \
|
||||
-only=main.qemu.${@}-${flavor} packer/
|
||||
-only=qemu.${@}-${flavor} packer/
|
||||
|
||||
lint:
|
||||
@packer fmt packer/
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#cloud-config
|
||||
|
||||
hostname: ${hostname}
|
||||
locale: en_IE
|
||||
keyboard:
|
||||
layout: ie
|
||||
|
||||
ssh_pwauth: true
|
||||
users:
|
||||
|
@ -45,6 +48,7 @@ packages:
|
|||
|
||||
# Install Applications
|
||||
- firefox
|
||||
- chromium
|
||||
- terminator
|
||||
|
||||
runcmd:
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#cloud-config
|
||||
|
||||
hostname: ${hostname}
|
||||
locale: en_IE
|
||||
keyboard:
|
||||
layout: ie
|
||||
|
||||
ssh_pwauth: true
|
||||
users:
|
||||
|
@ -38,14 +41,14 @@ packages:
|
|||
- networkmanager
|
||||
|
||||
# Install Graphical Interface
|
||||
- xorg-server
|
||||
- plasma
|
||||
- plasma-meta
|
||||
- plasma-wayland-session
|
||||
- sddm
|
||||
- konsole
|
||||
- kde-applications
|
||||
|
||||
# Install Applications
|
||||
- firefox
|
||||
- chromium
|
||||
- terminator
|
||||
|
||||
runcmd:
|
||||
|
|
|
@ -61,7 +61,9 @@ clean_arch() {
|
|||
_msg "Pacman clean configuration"
|
||||
|
||||
pacman -Syu --noconfirm
|
||||
pacman -Rsccn --noconfirm "$(pacman -Qdtq)"
|
||||
pacman -Qdtq | while IFS='' read -r pkg; do
|
||||
pacman -Rsccn --noconfirm "$pkg"
|
||||
done
|
||||
pacman -Scc --noconfirm
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ readonly DISTRIBUTION
|
|||
main() {
|
||||
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/.config/"
|
||||
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
|
||||
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
|
||||
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
|
||||
install -Dm0644 $SRC/parser.conf /etc/apparmor/parser.conf
|
||||
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
|
||||
|
@ -28,7 +29,7 @@ main() {
|
|||
debian | ubuntu)
|
||||
apt-get update -y
|
||||
apt-get install -y apparmor-profiles build-essential config-package-dev \
|
||||
debhelper devscripts htop qemu-guest-agent rsync vim
|
||||
debhelper devscripts htop rsync vim
|
||||
dpkg -i $SRC/apparmor.d_*_all.deb
|
||||
;;
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#cloud-config
|
||||
|
||||
hostname: ${hostname}
|
||||
locale: en_IE
|
||||
keyboard:
|
||||
layout: ie
|
||||
|
||||
ssh_pwauth: true
|
||||
users:
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
build {
|
||||
name = "main"
|
||||
sources = [
|
||||
"source.qemu.archlinux-gnome",
|
||||
"source.qemu.archlinux-kde",
|
||||
|
@ -12,6 +11,7 @@ build {
|
|||
"source.qemu.ubuntu-server",
|
||||
]
|
||||
|
||||
# Upload local files
|
||||
provisioner "file" {
|
||||
destination = "/tmp"
|
||||
sources = ["${path.cwd}/packer/src"]
|
||||
|
@ -29,6 +29,7 @@ build {
|
|||
sources = ["${path.cwd}/../apparmor.d_${var.version}_all.deb"]
|
||||
}
|
||||
|
||||
# Wait for cloud-init to finish
|
||||
provisioner "shell" {
|
||||
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = [
|
||||
|
@ -37,11 +38,13 @@ build {
|
|||
]
|
||||
}
|
||||
|
||||
# Install local files and config
|
||||
provisioner "shell" {
|
||||
script = "${path.cwd}/packer/init/init.sh"
|
||||
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
}
|
||||
|
||||
# Minimize the image
|
||||
provisioner "shell" {
|
||||
script = "${path.cwd}/packer/init/clean.sh"
|
||||
execute_command = "echo '${var.password}' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
|
|
23
tests/packer/src/monitors.xml
Normal file
23
tests/packer/src/monitors.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<monitors version="2">
|
||||
<configuration>
|
||||
<logicalmonitor>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<scale>1</scale>
|
||||
<primary>yes</primary>
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>Virtual-1</connector>
|
||||
<vendor>RHT</vendor>
|
||||
<product>QEMU Monitor</product>
|
||||
<serial>0x00000000</serial>
|
||||
</monitorspec>
|
||||
<mode>
|
||||
<width>1920</width>
|
||||
<height>1080</height>
|
||||
<rate>60</rate>
|
||||
</mode>
|
||||
</monitor>
|
||||
</logicalmonitor>
|
||||
</configuration>
|
||||
</monitors>
|
|
@ -22,7 +22,7 @@ source "qemu" "ubuntu-server" {
|
|||
output_directory = "${var.output}/"
|
||||
vm_name = "${var.prefix}${source.name}.qcow2"
|
||||
boot_wait = "10s"
|
||||
firmware = "/usr/share/edk2-ovmf/x64/OVMF_CODE.fd"
|
||||
firmware = "${var.firmware}"
|
||||
shutdown_command = "echo ${var.password} | sudo -S /sbin/shutdown -hP now"
|
||||
cd_label = "cidata"
|
||||
cd_content = {
|
||||
|
|
Loading…
Reference in a new issue