post_install() {
  # Disable systemd-resolved
    sed -i s/"enable systemd-resolved.service"/"disable systemd-resolved.service"/g /usr/lib/systemd/system-preset/90-systemd.preset
    
  # Disable pacman-init
    systemctl mask pacman-init

  # Fix GTK in Lomiri
    if [ -e /usr/bin/unity8 ]; then
        install -Dm644 "/opt/pinephone-pro-post-install/lomiri/gtk.css" "/etc/skel/.config/gtk-3.0/gtk.css"
    fi

    # Edit mkinitcpio.conf
        echo "Editing mkinitcpio.conf..."
        sed -i s/"^MODULES=()"/"MODULES=(rtc_rk808 rockchipdrm rk817_charger)"/g /etc/mkinitcpio.conf

}

post_upgrade() {
  # Set chassis
    hostnamectl set-chassis handset

    # Provide instructions
        if ! grep -q '^MODULES=(.*rtc_rk808' /etc/mkinitcpio.conf; then
            echo "To prevent journal corruption on boot, please add 'rtc_rk808' to the start"
            echo "of the 'MODULES' list in /etc/mkinitcpio.conf and rebuild the initcpio images."
            echo "You can do this by running:"
            echo "# sed -i 's/^MODULES=(/MODULES=(rtc_rk808 /g' /etc/mkinitcpio.conf"
            echo "# mkinitcpio -P"
        fi

}


