_enable_apply_service() {
    if command -v systemctl >/dev/null 2>&1; then
        systemctl enable raveos-gnome-theme-apply.service >/dev/null 2>&1 || true
    fi
}

post_install() {
    _enable_apply_service
}

post_upgrade() {
    # Never rewrite a live GNOME session from inside a pacman transaction.
    # The boot service applies the new payload before the display manager starts.
    rm -f /var/lib/raveos-gnome-theme/.applied
    _enable_apply_service
}
