🏡 index : quine-global-labs/mirror-fedora-workstation-ostree-config.git

# Shared manifest between Kinoite & Kinoite Mobile

packages:
  # Install some minor optional tools for KInfoCenter
  - vulkan-tools
  - xdpyinfo
  # Includes a KIO & KCM (can not be Flatpak'ed), used by Dolphin and Gwenview
  # See https://pagure.io/fedora-kde/SIG/issue/291
  - kamera
  # Make sure that previous Anaconda dependencies are kept in the image
  # See: https://pagure.io/fedora-kde/SIG/issue/243
  - mobile-broadband-provider-info
  # Make sure that modem support is installed
  - NetworkManager-ppp
  # Install gdb to make getting backtraces work with DrKonqi
  - gdb
  # Make sure rpm-ostree support is installed
  - plasma-discover-rpm-ostree
  # Temporarily explicitly included to take precedence over maliit
  - plasma-keyboard

# Make sure the following are not pulled in when Recommended by other packages
exclude-packages:
  - plasma-discover-offline-updates
  - plasma-discover-packagekit
  - plasma-pk-updates
  # Manually excluded as recommended by gtk3 (and likely gtk4 in the future)
  # See https://pagure.io/fedora-kde/SIG/issue/124
  - tracker
  - tracker-miners
  - localsearch
  - tinysparql
  # Ensure we do not include X11 support
  - plasma-x11
  - plasma-workspace-x11
  # Exclude mariadb server tools that bring in Perl
  - mariadb-server-utils
  # Can only be excluded on variants that do not include GNOME Software
  - PackageKit-glib

# Kinoite specific workarounds and configuration
postprocess:
  - |
    #!/bin/bash
    set -xeuo pipefail

    # Enable weekly auto updates in Discover. In the future, Flatpaks will be
    # updated daily. See: https://bugs.kde.org/show_bug.cgi?id=454422
    cat > /etc/xdg/PlasmaDiscoverUpdates <<EOF
    [Global]
    UseUnattendedUpdates=true
    RequiredNotificationInterval=604800
    EOF

  # Workaroud for missing shadow & gshadow entries for plasmalogin. See:
  # https://forge.fedoraproject.org/kde/tickets/issues/684
  # For more details why this happens and a potential proper fix, see:
  # - https://github.com/bootc-dev/bootc/issues/1179
  # - https://github.com/coreos/fedora-coreos-tracker/issues/1599
  # - https://github.com/coreos/rpm-ostree/issues/49
  - |
    #!/bin/bash
    set -xeuo pipefail

    cat > /usr/lib/systemd/system/fedora-kinoite-plasmalogin-workaround.service << 'EOF'
    [Unit]
    Description=Workaround for missing plasmalogin entries in /etc/shadow & /etc/gshadow on Kinoite
    Documentation=https://forge.fedoraproject.org/kde/SIG/issues/684
    ConditionPathIsReadWrite=/etc
    ConditionPathExists=/run/ostree-booted
    ConditionPathExists=!/etc/.fedora-kinoite-plasmalogin-workaround
    Before=plasmalogin.service

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/libexec/fedora-kinoite-plasmalogin-workaround

    [Install]
    WantedBy=multi-user.target
    EOF

    cat > /usr/libexec/fedora-kinoite-plasmalogin-workaround << 'EOF'
    #!/bin/bash
    # See: https://forge.fedoraproject.org/kde/tickets/issues/684

    set -euo pipefail

    echo "Checking plasmalogin entries in /etc/shadow & /etc/gshadow"

    if [[ $(grep -c "plasmalogin" "/etc/shadow") -eq 0 ]]; then
        echo "plasmalogin:!*:::::::" >> "/etc/shadow"
        echo "Added missing plasmalogin entry to /etc/shadow"
    else
        echo "Nothing to do for /etc/shadow"
    fi

    if [[ $(grep -c "plasmalogin" "/etc/gshadow") -eq 0 ]]; then
        echo "plasmalogin:!*::" >> "/etc/gshadow"
        echo "Added missing plasmalogin entry to /etc/gshadow"
    else
        echo "Nothing to do for /etc/gshadow"
    fi

    echo "Writing stamp file: /etc/.fedora-kinoite-plasmalogin-workaround"
    touch /etc/.fedora-kinoite-plasmalogin-workaround
    EOF

    chmod a+x /usr/libexec/fedora-kinoite-plasmalogin-workaround

    cat > /usr/lib/systemd/system-preset/82-kinoite.preset << 'EOF'
    # See: https://forge.fedoraproject.org/kde/tickets/issues/684
    enable fedora-kinoite-plasmalogin-workaround.service
    EOF

    systemctl preset fedora-kinoite-plasmalogin-workaround.service