54 lines
2.4 KiB
Plaintext
54 lines
2.4 KiB
Plaintext
# ABOUTME: Post-install hooks for moonarch-git package.
|
|
# ABOUTME: Handles zsh integration and configs owned by other packages.
|
|
|
|
post_install() {
|
|
# Zsh integration: source moonarch defaults for users without ~/.zshrc
|
|
if ! grep -q "zshrc.moonarch" /etc/zsh/zshrc 2>/dev/null; then
|
|
echo '# Moonarch defaults (overridden by ~/.zshrc)' >> /etc/zsh/zshrc
|
|
echo '[[ ! -f "$HOME/.zshrc" ]] && source /etc/zsh/zshrc.moonarch' >> /etc/zsh/zshrc
|
|
fi
|
|
|
|
# Deploy greetd config (file owned by greetd package, overwrite deliberately)
|
|
if [ -d /etc/greetd ]; then
|
|
cp /usr/share/moonarch/greetd/config.toml /etc/greetd/config.toml
|
|
cp /usr/share/moonarch/greetd/niri-greeter.kdl /etc/greetd/niri-greeter.kdl
|
|
fi
|
|
|
|
# Deploy moongreet config (file owned by moongreet-git, overwrite deliberately)
|
|
if [ -d /etc/moongreet ]; then
|
|
cp /usr/share/moonarch/moongreet/moongreet.toml /etc/moongreet/moongreet.toml
|
|
fi
|
|
|
|
# Deploy foot config (file owned by foot package, overwrite deliberately)
|
|
cp /usr/share/moonarch/foot/foot.ini /etc/xdg/foot/foot.ini
|
|
|
|
# Deploy waybar style (file owned by waybar package, overwrite deliberately)
|
|
cp /usr/share/moonarch/waybar/style.css /etc/xdg/waybar/style.css
|
|
|
|
# Deploy Walker config override to skel and existing user homes.
|
|
# Only copies if user has no config yet — never overwrites manual edits.
|
|
install -Dm644 /usr/share/moonarch/walker-config.toml \
|
|
/etc/skel/.config/walker/config.toml
|
|
while IFS=: read -r _ _ uid gid _ home _; do
|
|
if [ "$uid" -ge 1000 ] && [ "$uid" -lt 60000 ] && [ -d "$home" ]; then
|
|
if [ ! -f "$home/.config/walker/config.toml" ]; then
|
|
install -Dm644 -o "$uid" -g "$gid" /usr/share/moonarch/walker-config.toml \
|
|
"$home/.config/walker/config.toml"
|
|
fi
|
|
fi
|
|
done < /etc/passwd
|
|
|
|
# Cleanup legacy /usr/local/bin/ scripts from pre-package installs
|
|
rm -f /usr/local/bin/moonarch-* 2>/dev/null || true
|
|
rm -f /usr/local/bin/swww /usr/local/bin/swww-daemon 2>/dev/null || true
|
|
rm -f /usr/local/bin/moonarch-update 2>/dev/null || true
|
|
|
|
echo "==> Moonarch defaults installed."
|
|
echo "==> For first-time setup run: /opt/moonarch/scripts/post-install.sh"
|
|
echo "==> This enables services, configures firewall, and sets up user defaults."
|
|
}
|
|
|
|
post_upgrade() {
|
|
post_install
|
|
}
|