From a707af5b7ae4f872fc603c67b94c3db39b77c8c7 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 18 Aug 2025 21:12:08 +0200 Subject: [PATCH] Install dotfiles and zsh configuration for root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install oh-my-zsh and powerlevel10k for both user and root - Copy dotfiles to both user and root home directories - Set zsh as default shell for root - Root now has same terminal experience as user 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- post-install.sh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/post-install.sh b/post-install.sh index 94a78af..1b92708 100755 --- a/post-install.sh +++ b/post-install.sh @@ -86,14 +86,20 @@ echo "${ALMA_USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-${ALMA_USER} chmod 440 /etc/sudoers.d/99-${ALMA_USER} # Install oh-my-zsh and powerlevel10k -echo "[+] Installing oh-my-zsh and powerlevel10k..." -# Download and run oh-my-zsh installer as the user with proper environment -su - ${ALMA_USER} -c 'export RUNZSH=no CHSH=no KEEP_ZSHRC=yes && bash -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' 2>/dev/null || echo "WARNING: oh-my-zsh installation failed" -# Clone powerlevel10k theme -su - ${ALMA_USER} -c 'git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k' 2>/dev/null || echo "WARNING: powerlevel10k installation failed" +echo "[+] Installing oh-my-zsh and powerlevel10k for ${ALMA_USER} and root..." + +# Install for user +su - ${ALMA_USER} -c 'export RUNZSH=no CHSH=no KEEP_ZSHRC=yes && bash -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' 2>/dev/null || echo "WARNING: user oh-my-zsh installation failed" +su - ${ALMA_USER} -c 'git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k' 2>/dev/null || echo "WARNING: user powerlevel10k installation failed" + +# Install for root +export RUNZSH=no CHSH=no KEEP_ZSHRC=yes && bash -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 2>/dev/null || echo "WARNING: root oh-my-zsh installation failed" +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /root/.oh-my-zsh/custom/themes/powerlevel10k 2>/dev/null || echo "WARNING: root powerlevel10k installation failed" # Install dotfiles from git repo (cloning needed as we're in chroot) -echo "[+] Installing dotfiles..." +echo "[+] Installing dotfiles for ${ALMA_USER} and root..." + +# Install for user su - ${ALMA_USER} -c ' cd && git clone https://git.dominik-roth.eu/dodox/nullpoint.git /tmp/nullpoint-dotfiles && @@ -104,7 +110,22 @@ su - ${ALMA_USER} -c ' fi done && cd && rm -rf /tmp/nullpoint-dotfiles -' || echo "WARNING: dotfiles installation failed" +' || echo "WARNING: user dotfiles installation failed" + +# Install for root +cd /root && +git clone https://git.dominik-roth.eu/dodox/nullpoint.git /tmp/nullpoint-dotfiles-root && +cd /tmp/nullpoint-dotfiles-root/dotfiles && +for file in .*; do + if [ -f "$file" ] && [ "$file" != "." ] && [ "$file" != ".." ]; then + cp "$file" /root/ 2>/dev/null || true + fi +done && +cd /root && rm -rf /tmp/nullpoint-dotfiles-root || echo "WARNING: root dotfiles installation failed" + +# Set zsh as default shell for root +echo "[+] Setting zsh as default shell for root..." +chsh -s /bin/zsh root # Set up MOTD if [ "$ENABLE_MOTD" = true ]; then