feat: add cloud-config for user setup and update setup script for compatibility checks
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
This commit is contained in:
parent
a7b9dd4102
commit
7e1094dd7c
22
cloud-config
Normal file
22
cloud-config
Normal file
@ -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."
|
13
setup.sh
13
setup.sh
@ -213,12 +213,10 @@ warning_prompt() {
|
|||||||
log_error "Please ensure you have a backup of your data before proceeding."
|
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_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 "This script works best on a fresh Fedora, Ubuntu or Arch Linux installation."
|
||||||
log_info "Type 'continue' to continue or Ctrl+C to exit."
|
log_info "Setup starts in 5 seconds, to abort use Ctrl+C to exit NOW."
|
||||||
read -r -p "> " continue < /dev/tty
|
sleep 5
|
||||||
if [ "$continue" != "continue" ]; then
|
|
||||||
die "Exiting..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
log_info "Starting setup..."
|
log_info "Starting setup..."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,6 +302,11 @@ check_compatibility() {
|
|||||||
attempt_package_install "tail"
|
attempt_package_install "tail"
|
||||||
attempt_package_install "git"
|
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
|
local distro
|
||||||
distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"')
|
distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user