summaryrefslogtreecommitdiff
path: root/others/vm3
diff options
context:
space:
mode:
Diffstat (limited to 'others/vm3')
-rwxr-xr-xothers/vm3/.config/cloud-init-generator/debian12.sh11
-rwxr-xr-xothers/vm3/compute/create.sh2
2 files changed, 10 insertions, 3 deletions
diff --git a/others/vm3/.config/cloud-init-generator/debian12.sh b/others/vm3/.config/cloud-init-generator/debian12.sh
index 07c3fb7..6bfa54b 100755
--- a/others/vm3/.config/cloud-init-generator/debian12.sh
+++ b/others/vm3/.config/cloud-init-generator/debian12.sh
@@ -4,6 +4,12 @@
#
# osinfo-query os to list all available vm types to deploy. debian is debian12
# use no cloud and some other tools because cloud init does not work
+#
+#qemu-img resize debian-11-generic-amd64.qcow2 +10G # try this if you want to install something big like kde
+# sudo apt update
+# sudo apt install kde-plasma-desktop
+
+#
image_url="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2"
sshkeysdir="/root/k"
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #&& echo $scriptdir
@@ -23,12 +29,13 @@ sudo mkdir -p "$config_dir"
[ ! -f "$src_file" ] && echo "source image does not exist! downloading..." && sudo wget -O "$src_file" "$image_url"
-# First create a command that will generate all the ssh-inject options
+# generate all the lines from the file
SSH_INJECT_OPTS=$(find ${sshkeysdir} -name "*.pub" -exec echo "--ssh-inject user:file:{}" \;)
flag_file="${dir_path}/debian12_customized"
-# Check if customization has already been done
+# NOTE to delete customfile if debqcow2 is deleted. otherwise it will be ambiguous
+# this to check if image is already customised
if [ -f "$flag_file" ]; then
echo "Image already customized, skipping customization..."
else
diff --git a/others/vm3/compute/create.sh b/others/vm3/compute/create.sh
index 6d55fdc..ab481cd 100755
--- a/others/vm3/compute/create.sh
+++ b/others/vm3/compute/create.sh
@@ -91,7 +91,7 @@ fi
# Define the disk options based on OS type
if [ "$os" = "debian12" ]; then
disk_opts="--disk path=${new_vm},format=qcow2"
- virt-customize -a ${new_vm} --run-command "rm -f /etc/machine-id ; systemd-machine-id-setup ; hostnamectl set-hostname ${vmname}"
+ virt-customize -a ${new_vm} --run-command "rm -f /etc/machine-id && dbus-uuidgen --ensure=/etc/machine-id && echo ${vmname} > /etc/hostname"
else
disk_opts="--disk path=${new_vm},format=qcow2 --disk path=$seed_iso,device=cdrom"
fi