diff options
| -rwxr-xr-x | others/vm3/.config/cloud-init-generator/debian12.sh | 11 | ||||
| -rwxr-xr-x | others/vm3/compute/create.sh | 2 |
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 @@ | |||
| 4 | # | 4 | # |
| 5 | # osinfo-query os to list all available vm types to deploy. debian is debian12 | 5 | # osinfo-query os to list all available vm types to deploy. debian is debian12 |
| 6 | # use no cloud and some other tools because cloud init does not work | 6 | # use no cloud and some other tools because cloud init does not work |
| 7 | # | ||
| 8 | #qemu-img resize debian-11-generic-amd64.qcow2 +10G # try this if you want to install something big like kde | ||
| 9 | # sudo apt update | ||
| 10 | # sudo apt install kde-plasma-desktop | ||
| 11 | |||
| 12 | # | ||
| 7 | image_url="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2" | 13 | image_url="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2" |
| 8 | sshkeysdir="/root/k" | 14 | sshkeysdir="/root/k" |
| 9 | scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #&& echo $scriptdir | 15 | scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #&& echo $scriptdir |
| @@ -23,12 +29,13 @@ sudo mkdir -p "$config_dir" | |||
| 23 | 29 | ||
| 24 | [ ! -f "$src_file" ] && echo "source image does not exist! downloading..." && sudo wget -O "$src_file" "$image_url" | 30 | [ ! -f "$src_file" ] && echo "source image does not exist! downloading..." && sudo wget -O "$src_file" "$image_url" |
| 25 | 31 | ||
| 26 | # First create a command that will generate all the ssh-inject options | 32 | # generate all the lines from the file |
| 27 | SSH_INJECT_OPTS=$(find ${sshkeysdir} -name "*.pub" -exec echo "--ssh-inject user:file:{}" \;) | 33 | SSH_INJECT_OPTS=$(find ${sshkeysdir} -name "*.pub" -exec echo "--ssh-inject user:file:{}" \;) |
| 28 | 34 | ||
| 29 | flag_file="${dir_path}/debian12_customized" | 35 | flag_file="${dir_path}/debian12_customized" |
| 30 | 36 | ||
| 31 | # Check if customization has already been done | 37 | # NOTE to delete customfile if debqcow2 is deleted. otherwise it will be ambiguous |
| 38 | # this to check if image is already customised | ||
| 32 | if [ -f "$flag_file" ]; then | 39 | if [ -f "$flag_file" ]; then |
| 33 | echo "Image already customized, skipping customization..." | 40 | echo "Image already customized, skipping customization..." |
| 34 | else | 41 | 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 | |||
| 91 | # Define the disk options based on OS type | 91 | # Define the disk options based on OS type |
| 92 | if [ "$os" = "debian12" ]; then | 92 | if [ "$os" = "debian12" ]; then |
| 93 | disk_opts="--disk path=${new_vm},format=qcow2" | 93 | disk_opts="--disk path=${new_vm},format=qcow2" |
| 94 | virt-customize -a ${new_vm} --run-command "rm -f /etc/machine-id ; systemd-machine-id-setup ; hostnamectl set-hostname ${vmname}" | 94 | virt-customize -a ${new_vm} --run-command "rm -f /etc/machine-id && dbus-uuidgen --ensure=/etc/machine-id && echo ${vmname} > /etc/hostname" |
| 95 | else | 95 | else |
| 96 | disk_opts="--disk path=${new_vm},format=qcow2 --disk path=$seed_iso,device=cdrom" | 96 | disk_opts="--disk path=${new_vm},format=qcow2 --disk path=$seed_iso,device=cdrom" |
| 97 | fi | 97 | fi |
