Skip to content

Commit

Permalink
latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanis committed May 7, 2024
1 parent 499b32b commit 44b7071
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 130 deletions.
16 changes: 6 additions & 10 deletions cableos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 2 additions & 22 deletions cableos/cableos.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ locals {
}

}
source "null" "dependencies" {
communicator = "none"
}

source "qemu" "cableos" {

source "qemu" "debirf" {

vm_name = "debirf-live"
boot_wait = "2s"
Expand Down Expand Up @@ -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"]
Expand Down
99 changes: 1 addition & 98 deletions cableos/debirf.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
["<esc><wait>"],
["linux", "/install.amd/vmlinuz", "initrd=/install.amd/initrd.gz", "debirf.boot=live", "fetch=http://{{ .HTTPIP }}:{{ .HTTPPort }}/debirf.cgz<enter>"]
]
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
Expand All @@ -76,7 +37,6 @@ source "qemu" "cableos" {
"debconf/frontend=noninteractive <wait>",
"console-setup/ask_detect=false <wait>",
"interface=auto <wait>",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <enter>"
]
http_directory = "http"
disk_size = 10240
Expand All @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions cableos/http/cableos.ks.pkrtpl.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 44b7071

Please sign in to comment.