From 1323fdabe46b7c2f485de2bcdadca3aa16a8ebda Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 18 Aug 2025 00:24:36 +0200 Subject: [PATCH] post install fixes --- post-install.sh | 59 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/post-install.sh b/post-install.sh index b74f42d..52f5ca9 100755 --- a/post-install.sh +++ b/post-install.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -euo pipefail + BANNER=$(cat << "EOF" :^7J5GB##&&##GPY?~: ^75B&@@@@@@&&&@@@@@@@#GJ~: @@ -63,9 +65,15 @@ else TPM_ENABLED=true fi +# Install basic packages first +echo "[+] Installing basic packages..." +dnf install -y epel-release || exit 1 +dnf config-manager --set-enabled crb || exit 1 +dnf install -y zsh git wget curl || exit 1 + # Create user and add SSH key echo "[+] Creating user ${ALMA_USER}..." -useradd -m -G wheel -s /bin/zsh ${ALMA_USER} +useradd -m -G wheel -s /bin/zsh ${ALMA_USER} || exit 1 mkdir -p /home/${ALMA_USER}/.ssh echo "${SSH_KEY}" > /home/${ALMA_USER}/.ssh/authorized_keys chmod 700 /home/${ALMA_USER}/.ssh @@ -74,20 +82,13 @@ chown -R ${ALMA_USER}:${ALMA_USER} /home/${ALMA_USER}/.ssh # Install oh-my-zsh and powerlevel10k echo "[+] Installing oh-my-zsh and powerlevel10k..." -# Run oh-my-zsh installer as the user -sudo -u ${ALMA_USER} bash -c 'sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended' +# Download and run oh-my-zsh installer as the user +su - ${ALMA_USER} -c 'sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended' || echo "WARNING: oh-my-zsh installation failed" # Clone powerlevel10k theme -sudo -u ${ALMA_USER} git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/${ALMA_USER}/.oh-my-zsh/custom/themes/powerlevel10k +su - ${ALMA_USER} -c 'git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k' || echo "WARNING: powerlevel10k installation failed" -# Install dotfiles -echo "[+] Setting up dotfiles..." -if [ -d /tmp/nullpoint/dotfiles ]; then - echo "[+] Installing dotfiles from repository..." - cp /tmp/nullpoint/dotfiles/.* /home/${ALMA_USER}/ 2>/dev/null || true - chown -R ${ALMA_USER}:${ALMA_USER} /home/${ALMA_USER}/ -else - echo "[!] No dotfiles directory found, user will need to configure manually" -fi +# Note: Dotfiles need to be copied manually after installation +echo "[!] Dotfiles will need to be configured manually after first boot" # Set up MOTD if [ "$ENABLE_MOTD" = true ]; then @@ -99,27 +100,29 @@ fi # Install additional packages echo "[+] Installing additional packages..." -dnf install -y epel-release -dnf config-manager --set-enabled crb dnf install -y \ clevis clevis-luks clevis-tang clevis-tpm2 tpm2-tools tpm2-tss \ - git zsh tmux neovim python3-pip \ + tmux neovim python3-pip \ dracut-clevis dracut-network \ - dropbear tree curl wget nano + dropbear tree nano || exit 1 -# Install lsd and bat from GitHub releases (not in repos) +# Install lsd and bat echo "[+] Installing lsd and bat..." -# Get latest lsd version -LSD_VERSION=$(curl -s https://api.github.com/repos/lsd-rs/lsd/releases/latest | grep -Po '"tag_name": "v\K[0-9.]+') -curl -sL "https://github.com/lsd-rs/lsd/releases/download/v${LSD_VERSION}/lsd-v${LSD_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /tmp -mv /tmp/lsd-*/lsd /usr/local/bin/ -chmod +x /usr/local/bin/lsd +# Install using fixed versions that should work +LSD_VERSION="1.0.0" +BAT_VERSION="0.24.0" -# Get latest bat version -BAT_VERSION=$(curl -s https://api.github.com/repos/sharkdp/bat/releases/latest | grep -Po '"tag_name": "v\K[0-9.]+') -curl -sL "https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat-v${BAT_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /tmp -mv /tmp/bat-*/bat /usr/local/bin/ -chmod +x /usr/local/bin/bat +# Download and install lsd +if curl -sL "https://github.com/lsd-rs/lsd/releases/download/v${LSD_VERSION}/lsd-v${LSD_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /tmp; then + mv /tmp/lsd-*/lsd /usr/local/bin/ 2>/dev/null || true + chmod +x /usr/local/bin/lsd 2>/dev/null || true +fi + +# Download and install bat +if curl -sL "https://github.com/sharkdp/bat/releases/download/v${BAT_VERSION}/bat-v${BAT_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /tmp; then + mv /tmp/bat-*/bat /usr/local/bin/ 2>/dev/null || true + chmod +x /usr/local/bin/bat 2>/dev/null || true +fi # Create batman script for fancy man pages cat > /usr/local/bin/batman << 'BATMAN'