diff --git a/configs/debian/bookworm_gnome.json b/configs/debian/bookworm_gnome.json index fa41f93..6aec0c7 100644 --- a/configs/debian/bookworm_gnome.json +++ b/configs/debian/bookworm_gnome.json @@ -5,7 +5,8 @@ "download_name": "bookworm", "packages": "grub-pc linux-image-amd64 task-gnome-desktop", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/user.sh" ], "package_manager": "apt" } \ No newline at end of file diff --git a/configs/debian/bookworm_kde.json b/configs/debian/bookworm_kde.json index f984597..422d149 100644 --- a/configs/debian/bookworm_kde.json +++ b/configs/debian/bookworm_kde.json @@ -5,7 +5,8 @@ "download_name": "bookworm", "packages": "grub-pc linux-image-amd64 task-kde-desktop", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/user.sh" ], "package_manager": "apt" } \ No newline at end of file diff --git a/configs/debian/bookworm_server.json b/configs/debian/bookworm_server.json index 4b59806..ed7d984 100644 --- a/configs/debian/bookworm_server.json +++ b/configs/debian/bookworm_server.json @@ -5,7 +5,8 @@ "download_name": "bookworm", "packages": "nginx grub-pc linux-image-amd64", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/server.sh" ], "package_manager": "apt" } \ No newline at end of file diff --git a/configs/scripts/install.sh b/configs/scripts/install.sh index 61bd842..6f015a9 100755 --- a/configs/scripts/install.sh +++ b/configs/scripts/install.sh @@ -35,28 +35,4 @@ elif chroot /mnt /bin/bash -c "command -v grub-install &>/dev/null;" then chroot /mnt /bin/bash -c "grub-install /dev/sda" fi -while true; do - read -p "Enter a username (lowercase letters, digits, underscores and hyphens): " username - chroot /mnt /bin/bash -c "useradd -m '$username'" - if [ $? -eq 0 ]; then - break - fi -done - -while true; do - chroot /mnt /bin/bash -c "passwd '$username'" - - if [ $? -eq 0 ]; then - break - fi -done - -while true; do - read -p "Enter the hostname: " hostname - chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname" - - if [ $? -eq 0 ]; then - break - fi -done diff --git a/configs/scripts/server.sh b/configs/scripts/server.sh new file mode 100644 index 0000000..58ef193 --- /dev/null +++ b/configs/scripts/server.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# This file is part of VM-Experiments. +# Licensed under the GPL-3.0-or-later. See LICENSE for details. + +trap '' SIGINT SIGTERM + +while true; do + chroot /mnt /bin/bash -c "passwd root" + + if [ $? -eq 0 ]; then + break + fi +done + +while true; do + read -p "Enter the hostname: " hostname + chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname" + + if [ $? -eq 0 ]; then + break + fi +done \ No newline at end of file diff --git a/configs/scripts/user.sh b/configs/scripts/user.sh new file mode 100644 index 0000000..26ce7d8 --- /dev/null +++ b/configs/scripts/user.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# This file is part of VM-Experiments. +# Licensed under the GPL-3.0-or-later. See LICENSE for details. + +trap '' SIGINT SIGTERM + +while true; do + read -p "Enter a username (lowercase letters, digits, underscores and hyphens): " username + chroot /mnt /bin/bash -c "useradd -m '$username'" + + if [ $? -eq 0 ]; then + break + fi +done + +while true; do + chroot /mnt /bin/bash -c "passwd '$username'" + + if [ $? -eq 0 ]; then + break + fi +done + +while true; do + read -p "Enter the hostname: " hostname + chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname" + + if [ $? -eq 0 ]; then + break + fi +done \ No newline at end of file diff --git a/configs/ubuntu/noble_gnome.json b/configs/ubuntu/noble_gnome.json index 8961025..08dc9b6 100644 --- a/configs/ubuntu/noble_gnome.json +++ b/configs/ubuntu/noble_gnome.json @@ -5,7 +5,8 @@ "download_name": "noble-base-amd64.tar.gz", "packages": "grub-pc linux-image-generic ubuntu-desktop", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/user.sh" ], "package_manager": "apt" } \ No newline at end of file diff --git a/configs/ubuntu/noble_kde.json b/configs/ubuntu/noble_kde.json index 5c56c61..ad986c1 100644 --- a/configs/ubuntu/noble_kde.json +++ b/configs/ubuntu/noble_kde.json @@ -5,7 +5,8 @@ "download_name": "noble-base-amd64.tar.gz", "packages": "grub-pc linux-image-generic kubuntu-desktop", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/user.sh" ], "package_manager": "apt" } \ No newline at end of file diff --git a/configs/ubuntu/noble_server.json b/configs/ubuntu/noble_server.json index 279ea14..adf1c5c 100644 --- a/configs/ubuntu/noble_server.json +++ b/configs/ubuntu/noble_server.json @@ -5,7 +5,8 @@ "download_name": "noble-base-amd64.tar.gz", "packages": "nginx grub-pc linux-image-generic", "scripts": [ - "configs/scripts/install.sh" + "configs/scripts/install.sh", + "configs/scripts/server.sh" ], "package_manager": "apt" } \ No newline at end of file