Install dotfiles and zsh configuration for root

- 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 <noreply@anthropic.com>
This commit is contained in:
Dominik Moritz Roth 2025-08-18 21:12:08 +02:00
parent 9739367f38
commit a707af5b7a

View File

@ -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