diff --git a/cloud-config b/cloud-config new file mode 100644 index 0000000..3f08b70 --- /dev/null +++ b/cloud-config @@ -0,0 +1,22 @@ +#cloud-config + +# Create a user named menno with sudo privileges +users: + - name: menno + sudo: ALL=(ALL) NOPASSWD:ALL + groups: sudo, adm + shell: /bin/bash + ssh_authorized_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM+sKpcREOUjwMMSzEWAso6830wbOi8kUxqpuXWw5gHr menno_1password + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE22Hfx8wgkc57TXX1TCMHcNrCdjbfog5QeHFJfl7IeD menno_fallback + +# Update package lists and install latest updates +package_update: true +package_upgrade: true + +# Configure system to preserve hostname +preserve_hostname: false +hostname: mennos-vm + +# Final message when cloud-init completes +final_message: "Cloud-init has finished setting up the system with user 'menno'. System boot completed after $UPTIME seconds." diff --git a/setup.sh b/setup.sh index 724aecf..9795a67 100755 --- a/setup.sh +++ b/setup.sh @@ -213,12 +213,10 @@ warning_prompt() { log_error "Please ensure you have a backup of your data before proceeding." log_error "This script will modify system files and may require sudo permissions.\n" log_info "This script works best on a fresh Fedora, Ubuntu or Arch Linux installation." - log_info "Type 'continue' to continue or Ctrl+C to exit." - read -r -p "> " continue < /dev/tty - if [ "$continue" != "continue" ]; then - die "Exiting..." - fi + log_info "Setup starts in 5 seconds, to abort use Ctrl+C to exit NOW." + sleep 5 + echo "" log_info "Starting setup..." } @@ -304,6 +302,11 @@ check_compatibility() { attempt_package_install "tail" attempt_package_install "git" + # Check if we are a user or root + if [ "$EUID" -eq 0 ]; then + die "This script should not be run as root. Please run as a regular user." + fi + local distro distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"')