added TARGET_USERNAME from autoinstall yaml
This commit is contained in:
@@ -25,10 +25,8 @@ WORK_DIR="$(mktemp -d /tmp/autoinstall-build.XXXXXX)"
|
|||||||
OUTPUT_ISO="autoinstall-$(date +%Y%m%d-%H%M).iso"
|
OUTPUT_ISO="autoinstall-$(date +%Y%m%d-%H%M).iso"
|
||||||
SOPS_FILE="secrets.sops.yaml"
|
SOPS_FILE="secrets.sops.yaml"
|
||||||
TEMPLATE_DIR="templates"
|
TEMPLATE_DIR="templates"
|
||||||
# TEMPLATE_FILE="user-data.tmpl"
|
|
||||||
# RENDERED_FILE="user-data.yaml"
|
|
||||||
POST_INSTALL_SCRIPT="scripts/post-install.sh"
|
POST_INSTALL_SCRIPT="scripts/post-install.sh"
|
||||||
|
TARGET_USERNAME=$(yq -e .autoinstall.identity.username templates/user-data.tmpl)
|
||||||
NOCLOUD_DIR="$WORK_DIR/iso/nocloud"
|
NOCLOUD_DIR="$WORK_DIR/iso/nocloud"
|
||||||
mkdir -p "$NOCLOUD_DIR"
|
mkdir -p "$NOCLOUD_DIR"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
TARGET_USER=${TARGET_USERNAME:?must defined}
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
@@ -43,7 +44,7 @@ function docker() {
|
|||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
|
||||||
usermod -aG docker alfoldi
|
usermod -aG docker "$TARGET_USER"
|
||||||
systemctl enable docker
|
systemctl enable docker
|
||||||
info "Docker installed."
|
info "Docker installed."
|
||||||
echo docker >>/tmp/installer
|
echo docker >>/tmp/installer
|
||||||
@@ -135,7 +136,7 @@ function main() {
|
|||||||
|
|
||||||
# ─── DASH TO PANEL ───────────────────────────────────────────────────────────
|
# ─── DASH TO PANEL ───────────────────────────────────────────────────────────
|
||||||
info "Installing Dash to Panel..."
|
info "Installing Dash to Panel..."
|
||||||
sudo -u alfoldi bash -c '
|
sudo -u "$TARGET_USER" bash -c '
|
||||||
cd /tmp
|
cd /tmp
|
||||||
git clone https://github.com/home-sweet-gnome/dash-to-panel.git || true
|
git clone https://github.com/home-sweet-gnome/dash-to-panel.git || true
|
||||||
cd dash-to-panel
|
cd dash-to-panel
|
||||||
@@ -148,10 +149,10 @@ function main() {
|
|||||||
info "Enabling SSH..."
|
info "Enabling SSH..."
|
||||||
systemctl enable ssh
|
systemctl enable ssh
|
||||||
|
|
||||||
# ─── (passwordless for alfoldi) ─────────────────────────────────────────
|
# ─── (passwordless for "$TARGET_USER") ─────────────────────────────────────────
|
||||||
info "Configuring sudoers..."
|
info "Configuring sudoers..."
|
||||||
echo 'alfoldi ALL=(ALL) NOPASSWD:ALL' >/etc/sudoers.d/alfoldi
|
echo "$TARGET_USER ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/$TARGET_USER"
|
||||||
chmod 440 /etc/sudoers.d/alfoldi
|
chmod 440 "/etc/sudoers.d/$TARGET_USER"
|
||||||
|
|
||||||
info "Post-install complete ✓"
|
info "Post-install complete ✓"
|
||||||
systemctl start gdm
|
systemctl start gdm
|
||||||
|
|||||||
Reference in New Issue
Block a user