From 4fa2cbaf6f34d1382c84543d2b9d09da1dfce9f9 Mon Sep 17 00:00:00 2001 From: Marek Zarychta Date: Thu, 29 Feb 2024 16:57:03 +0100 Subject: [PATCH 1/3] Remove dependency on genisoimage, use tar and libarchive from base system instead --- lib/vm-core | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/vm-core b/lib/vm-core index 20975db5..6527d32a 100644 --- a/lib/vm-core +++ b/lib/vm-core @@ -182,12 +182,6 @@ core::create(){ # make sure template has a disk before we start creating anything [ -z "${_disk}" ] && util::err "template is missing disk0_name specification" - if [ -n "${_enable_cloud_init}" ]; then - if ! which genisoimage > /dev/null; then - util::err "Error: genisoimage is required to work with cloud init! Run 'pkg install cdrkit-genisoimage'." - fi - fi - # get ssh public key for cloud-init from file if [ -n "${_ssh_key_file}" ]; then @@ -317,7 +311,7 @@ ssh_authorized_keys: EOF fi - genisoimage -output "${VM_DS_PATH}/${_name}/seed.iso" -volid cidata -joliet -rock ${_cloud_init_dir}/* > /dev/null 2>&1 || util::err "Can't write seed.iso for cloud-init" + tar --format=iso --options iso9660:volume-id="cidata" -cf "${VM_DS_PATH}/${_name}/seed.iso" -C ${_cloud_init_dir} ./ || util::err "Can't write seed.iso for cloud-init" config::set "${_name}" "disk${_num}_type" "ahci-cd" config::set "${_name}" "disk${_num}_name" "seed.iso" config::set "${_name}" "disk${_num}_dev" "file" From 6f17f66b299492fabb3efd00a92ef468129abf96 Mon Sep 17 00:00:00 2001 From: Marek Zarychta Date: Fri, 15 Mar 2024 16:59:58 +0100 Subject: [PATCH 2/3] Revert "Remove dependency on genisoimage, use tar and libarchive from base system instead" This reverts commit 4fa2cbaf6f34d1382c84543d2b9d09da1dfce9f9. --- lib/vm-core | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/vm-core b/lib/vm-core index 6527d32a..20975db5 100644 --- a/lib/vm-core +++ b/lib/vm-core @@ -182,6 +182,12 @@ core::create(){ # make sure template has a disk before we start creating anything [ -z "${_disk}" ] && util::err "template is missing disk0_name specification" + if [ -n "${_enable_cloud_init}" ]; then + if ! which genisoimage > /dev/null; then + util::err "Error: genisoimage is required to work with cloud init! Run 'pkg install cdrkit-genisoimage'." + fi + fi + # get ssh public key for cloud-init from file if [ -n "${_ssh_key_file}" ]; then @@ -311,7 +317,7 @@ ssh_authorized_keys: EOF fi - tar --format=iso --options iso9660:volume-id="cidata" -cf "${VM_DS_PATH}/${_name}/seed.iso" -C ${_cloud_init_dir} ./ || util::err "Can't write seed.iso for cloud-init" + genisoimage -output "${VM_DS_PATH}/${_name}/seed.iso" -volid cidata -joliet -rock ${_cloud_init_dir}/* > /dev/null 2>&1 || util::err "Can't write seed.iso for cloud-init" config::set "${_name}" "disk${_num}_type" "ahci-cd" config::set "${_name}" "disk${_num}_name" "seed.iso" config::set "${_name}" "disk${_num}_dev" "file" From d88bc164ff6534be584c04793aff6d1f8fa987c5 Mon Sep 17 00:00:00 2001 From: Marek Zarychta Date: Fri, 15 Mar 2024 17:05:51 +0100 Subject: [PATCH 3/3] Replace genisoimage with makefs(8) from the base --- lib/vm-core | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/vm-core b/lib/vm-core index 20975db5..14ea9aa2 100644 --- a/lib/vm-core +++ b/lib/vm-core @@ -182,12 +182,6 @@ core::create(){ # make sure template has a disk before we start creating anything [ -z "${_disk}" ] && util::err "template is missing disk0_name specification" - if [ -n "${_enable_cloud_init}" ]; then - if ! which genisoimage > /dev/null; then - util::err "Error: genisoimage is required to work with cloud init! Run 'pkg install cdrkit-genisoimage'." - fi - fi - # get ssh public key for cloud-init from file if [ -n "${_ssh_key_file}" ]; then @@ -317,7 +311,7 @@ ssh_authorized_keys: EOF fi - genisoimage -output "${VM_DS_PATH}/${_name}/seed.iso" -volid cidata -joliet -rock ${_cloud_init_dir}/* > /dev/null 2>&1 || util::err "Can't write seed.iso for cloud-init" + makefs -t cd9660 -o R,L=cidata "${VM_DS_PATH}/${_name}/seed.iso" ${_cloud_init_dir} || util::err "Can't write seed.iso for cloud-init" config::set "${_name}" "disk${_num}_type" "ahci-cd" config::set "${_name}" "disk${_num}_name" "seed.iso" config::set "${_name}" "disk${_num}_dev" "file"