diff --git a/cableos/Makefile b/cableos/Makefile index 550b893..8904832 100644 --- a/cableos/Makefile +++ b/cableos/Makefile @@ -16,21 +16,17 @@ export PACKER_LOG .PHONY: all clean all: cableos.tar.gz -$(eval $(call check_packages_deps debirf)) +$(eval $(call check_packages_deps)) debirf.tar.gz: check-deps clean - cp -r /usr/share/doc/debirf/example-profiles/minimal.tgz + # ${PACKER} build template.json + ${PACKER} init . cableos.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} cableos.pkr.hcl + - mv debirf.cgz - ${PACKER} init . && ${PACKER} build \ - -only='cloudimg.*' \ - -var ubuntu_series=${SERIES} \ - -var architecture=${ARCH} \ - -var timeout=${TIMEOUT} . cableos.tar.gz: check-deps clean - ${PACKER} build template.json - ${PACKER} init debirf.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} debirf.pkr.hcl + # ${PACKER} build template.json + ${PACKER} init . debirf.pkr.hcl && ${PACKER} build -var timeout=${TIMEOUT} debirf.pkr.hcl clean: diff --git a/cableos/cableos.pkr.hcl b/cableos/cableos.pkr.hcl index 8793e55..abe2acb 100644 --- a/cableos/cableos.pkr.hcl +++ b/cableos/cableos.pkr.hcl @@ -19,11 +19,9 @@ locals { } } -source "null" "dependencies" { - communicator = "none" -} -source "qemu" "cableos" { + +source "qemu" "debirf" { vm_name = "debirf-live" boot_wait = "2s" @@ -62,24 +60,6 @@ source "qemu" "cableos" { - -build { - name = "cableos.deps" - sources = ["source.null.dependencies"] - - provisioner "shell-local" { - inline = [ - "cp ${var.source_iso_directory}/${var.debirf_live_bullseye_amd64_iso} ${var.image_path}/" - # "sudo mount -o loop ${var.image_path}/${var.debirf_live_bullseye_amd64_iso} ${var.debirf_tmp_path}" - "cp ${var.debirf_tmp_path}/${var.debirf_initrd_filename} ${var.image_path}/" - # "cp ${var.source_iso_directory}/${var.apollo_iso} ${var.http_path}/" - # "sudo umount -lf ${var.debirf_tmp_path}" - ] - inline_shebang = "/bin/bash -e" - } -} - - build { name = "debirf.image" sources = ["source.qemu.debirf"] diff --git a/cableos/debirf.pkr.hcl b/cableos/debirf.pkr.hcl index f5d8183..7a8b488 100644 --- a/cableos/debirf.pkr.hcl +++ b/cableos/debirf.pkr.hcl @@ -18,47 +18,8 @@ locals { "arm64" = "cortex-a57" } -} -source "null" "dependencies" { - communicator = "none" -} -source "qemu" "debirf" { - vm_name = "debirf-live" - boot_wait = "2s" - cpus = 2 - disk_image = true - format = qcow2 - disk_size = "10G" - type = "qemu" - headless = var.headless - http_directory = var.http_directory - http_url = "http://{{ .HTTPIP }}:{{ .HTTPPort }}/" - iso_checksum = "none" - iso_url = var.image_path/var.debirf_live_bullseye_amd64_iso - memory = 2048 - qemu_binary = "qemu-system-${lookup(local.qemu_arch, var.architecture, "")}" - qemuargs = [ - ["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"], - ["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"], - ["-device", "virtio-gpu-pci"] - ] - qemu_img_args = [ - create = ["-F", "qcow2"] - ] - boot_command = [ - [""], - ["linux", "/install.amd/vmlinuz", "initrd=/install.amd/initrd.gz", "debirf.boot=live", "fetch=http://{{ .HTTPIP }}:{{ .HTTPPort }}/debirf.cgz"] - ] - shutdown_command = "sudo -S shutdown -P now" - ssh_handshake_attempts = 50 - ssh_password = "install" - ssh_timeout = var.timeout - ssh_username = "root" - ssh_wait_timeout = var.timeout - use_backing_file = true -} source "qemu" "cableos" { iso_url = var.deb_netinst_url @@ -76,7 +37,6 @@ source "qemu" "cableos" { "debconf/frontend=noninteractive ", "console-setup/ask_detect=false ", "interface=auto ", - "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg " ] http_directory = "http" disk_size = 10240 @@ -87,68 +47,11 @@ source "qemu" "cableos" { ssh_port = 22 ssh_wait_timeout = "10000s" shutdown_command = "echo 'shutdown -P now' > shutdown.sh; chmod +x shutdown.sh; sudo ./shutdown.sh" - format = "raw" + format = "qemu" vm_name = "debian-minimal" } -build { - name = "debirf.local" - sources = ["source.null.dependencies"] - - provisioner "shell-local" { - inline = [ - "cp ${var.source_iso_directory}/${var.debirf_live_bullseye_amd64_iso} ${var.image_path}/" - "sudo mount -o loop ${var.image_path}/${var.debirf_live_bullseye_amd64_iso} ${var.debirf_tmp_path}" - "cp ${var.debirf_tmp_path}/${var.debirf_initrd_filename} ${var.image_path}/" - "cp ${var.source_iso_directory}/${var.apollo_iso} ${var.http_path}/" - "sudo umount -lf ${var.debirf_tmp_path}" - ] - inline_shebang = "/bin/bash -e" - } -} - - -build { - name = "debirf.image" - sources = ["source.qemu.debirf"] - - provisioner "shell" { - environment_vars = ["DEBIAN_FRONTEND=noninteractive"] - expect_disconnect = true - scripts = ["${var.scripts_directory}/apollo_install.sh"] - } - - post-processor "shell-local" { - inline = [ - "IMG_FMT=qcow2", - "SOURCE=cloudimg", - "ROOT_PARTITION=1", - "OUTPUT=${var.filename}", - "source ../scripts/fuse-nbd", - "source ../scripts/fuse-tar-root" - ] - inline_shebang = "/bin/bash -e" - } -} - - - -build { - sources = [ - "source.qemu.cableos" - ] - - provisioner "shell" { - inline = [ - "sudo apt-get update", - "sudo apt-get install -y openssh-server", - "sudo apt-get clean" - ] - } -} - - build { name = "cableos.image" diff --git a/cableos/http/cableos.ks.pkrtpl.hcl b/cableos/http/cableos.ks.pkrtpl.hcl index 90500e3..b87c827 100644 --- a/cableos/http/cableos.ks.pkrtpl.hcl +++ b/cableos/http/cableos.ks.pkrtpl.hcl @@ -19,3 +19,16 @@ d-i passwd/user-password-again password insecure d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i finish-install/reboot_in_progress note +url ${KS_OS_REPOS} ${KS_PROXY} +poweroff +firewall --enabled --service=ssh +firstboot --disable +ignoredisk --only-use=vda +lang en_US.UTF-8 +keyboard us +network --device eth0 --bootproto=dhcp +firewall --enabled --service=ssh +selinux --enforcing +timezone UTC --isUtc +bootloader --location=mbr --driveorder="vda" --timeout=1 +rootpw --plaintext password