# Font-icon directories FONT_DIRS="/usr/share/fonts/TTF /usr/share/fonts/OTF /usr/share/fonts/misc" ICON_DIR="/usr/share/icons/hicolor" GLIB_SCHEMA_DIR="/usr/share/glib-2.0/schemas" # Utility function to check if required commands are available check_command() { if ! command -v "$1" &> /dev/null; then echo "Error: $1 command not found. Please install it first." exit 1 fi } # Font-related commands update_fonts() { check_command mkfontscale check_command mkfontdir check_command fc-cache # Update font-related files echo "Updating fonts..." mkfontscale "$FONT_DIRS" >/dev/null 2>&1 || { echo "Failed to run mkfontscale"; return 1; } mkfontdir "$FONT_DIRS" >/dev/null 2>&1 || { echo "Failed to run mkfontdir"; return 1; } fc-cache -s >/dev/null || { echo "Failed to update font cache"; return 1; } } # GTK related commands update_gtk() { check_command glib-compile-schemas check_command gtk-update-icon-cache check_command dconf # Update GTK and icon cache echo "Updating GTK and icon cache..." glib-compile-schemas "$GLIB_SCHEMA_DIR" || { echo "Failed to compile schemas"; return 1; } gtk-update-icon-cache -ftq "$ICON_DIR" || { echo "Failed to update icon cache"; return 1; } /bin/sh -c 'dconf update' || { echo "Failed to update dconf"; return 1; } } # Post installation post_install() { echo "Post installation steps..." post_upgrade } # Post upgrade post_upgrade() { echo "Post upgrade steps..." update_fonts update_gtk } # Main entry point: Run post-install steps post_install