mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-14 23:43:56 +01:00
test: improve VM image creation.
This commit is contained in:
parent
62cb1d9b96
commit
537e34739d
2
tests/Vagrantfile
vendored
2
tests/Vagrantfile
vendored
@ -24,10 +24,12 @@ Vagrant.configure("2") do |config|
|
|||||||
srv.vm.box_check_update = false
|
srv.vm.box_check_update = false
|
||||||
srv.vm.post_up_message = instance.to_yaml
|
srv.vm.post_up_message = instance.to_yaml
|
||||||
srv.vm.synced_folder '../', '/home/user/Projects/apparmor.d', type: 'virtiofs'
|
srv.vm.synced_folder '../', '/home/user/Projects/apparmor.d', type: 'virtiofs'
|
||||||
|
srv.vm.synced_folder '.', '/vagrant', disabled: true
|
||||||
|
|
||||||
# Configure Libvirt provider
|
# Configure Libvirt provider
|
||||||
srv.vm.provider 'libvirt' do |libvirt|
|
srv.vm.provider 'libvirt' do |libvirt|
|
||||||
libvirt.driver = 'kvm'
|
libvirt.driver = 'kvm'
|
||||||
|
libvirt.default_prefix = 'aa-'
|
||||||
libvirt.connect_via_ssh = false
|
libvirt.connect_via_ssh = false
|
||||||
libvirt.storage_pool_name = 'default'
|
libvirt.storage_pool_name = 'default'
|
||||||
libvirt.memory = instance['ram']
|
libvirt.memory = instance['ram']
|
||||||
|
@ -22,7 +22,7 @@ source "qemu" "debian-server" {
|
|||||||
output_directory = "${var.output}/"
|
output_directory = "${var.output}/"
|
||||||
vm_name = "${var.prefix}${source.name}.qcow2"
|
vm_name = "${var.prefix}${source.name}.qcow2"
|
||||||
boot_wait = "10s"
|
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"
|
shutdown_command = "echo ${var.password} | sudo -S /sbin/shutdown -hP now"
|
||||||
cd_label = "cidata"
|
cd_label = "cidata"
|
||||||
cd_content = {
|
cd_content = {
|
||||||
|
2
tests/packer/init/clean.sh
Executable file → Normal file
2
tests/packer/init/clean.sh
Executable file → Normal file
@ -122,7 +122,7 @@ impersonalize() {
|
|||||||
# Remove itself
|
# Remove itself
|
||||||
"$(readlink -f "$SELF")"
|
"$(readlink -f "$SELF")"
|
||||||
)
|
)
|
||||||
rm -rvf "${remove[@]}"
|
rm -rf "${remove[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ main() {
|
|||||||
install -Dm0644 $SRC/parser.conf /etc/apparmor/parser.conf
|
install -Dm0644 $SRC/parser.conf /etc/apparmor/parser.conf
|
||||||
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
|
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
|
||||||
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
|
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
|
||||||
|
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
|
||||||
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
|
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
|
||||||
case "$DISTRIBUTION" in
|
case "$DISTRIBUTION" in
|
||||||
arch) pacman --noconfirm -U $SRC/apparmor.d-*-x86_64.pkg.tar.zst ;;
|
arch) pacman --noconfirm -U $SRC/apparmor.d-*-x86_64.pkg.tar.zst ;;
|
||||||
|
@ -28,7 +28,7 @@ source "qemu" "opensuse-kde" {
|
|||||||
output_directory = "${var.iso_dir}/packer/"
|
output_directory = "${var.iso_dir}/packer/"
|
||||||
vm_name = "${var.prefix}${source.name}.qcow2"
|
vm_name = "${var.prefix}${source.name}.qcow2"
|
||||||
boot_wait = "10s"
|
boot_wait = "10s"
|
||||||
firmware = "/usr/share/edk2-ovmf/x64/OVMF_CODE.fd"
|
firmware = "${var.firmware}"
|
||||||
shutdown_command = "echo ${var.password} | sudo shutdown -hP now"
|
shutdown_command = "echo ${var.password} | sudo shutdown -hP now"
|
||||||
cd_label = "cidata"
|
cd_label = "cidata"
|
||||||
cd_content = {
|
cd_content = {
|
||||||
|
4
tests/packer/src/aa-log-clean
Normal file
4
tests/packer/src/aa-log-clean
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
rm -rf /var/log/audit/*
|
||||||
|
touch /var/log/audit/audit.log
|
@ -29,7 +29,7 @@ variable "ssh_privatekey" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "disk_size" {
|
variable "disk_size" {
|
||||||
description = "Disk size of the App VM to build"
|
description = "Disk size of the VM to build"
|
||||||
type = string
|
type = string
|
||||||
default = "10G"
|
default = "10G"
|
||||||
}
|
}
|
||||||
@ -46,6 +46,12 @@ variable "base_dir" {
|
|||||||
default = "/var/lib/libvirt/images"
|
default = "/var/lib/libvirt/images"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "firmware" {
|
||||||
|
description = "Path to the UEFI firmware"
|
||||||
|
type = string
|
||||||
|
default = "/usr/share/edk2-ovmf/x64/OVMF_CODE.fd"
|
||||||
|
}
|
||||||
|
|
||||||
variable "output" {
|
variable "output" {
|
||||||
description = "Output build directory"
|
description = "Output build directory"
|
||||||
type = string
|
type = string
|
||||||
@ -82,8 +88,8 @@ variable "release" {
|
|||||||
version = "22.04.2",
|
version = "22.04.2",
|
||||||
},
|
},
|
||||||
"debian" : {
|
"debian" : {
|
||||||
codename = "bullseye",
|
codename = "bookworm",
|
||||||
version = "11",
|
version = "12",
|
||||||
}
|
}
|
||||||
"opensuse" : {
|
"opensuse" : {
|
||||||
codename = "tumbleweed",
|
codename = "tumbleweed",
|
||||||
|
Loading…
Reference in New Issue
Block a user