[neon/neon/settings/Neon/rm-base-files] debian: and the postinst magic

Carlos De Maine null at kde.org
Sun Apr 19 08:01:42 BST 2026


Git commit a3252356926b156e3e7644f7270e690681aff5b3 by Carlos De Maine.
Committed on 19/04/2026 at 06:36.
Pushed by carlosdem into branch 'Neon/rm-base-files'.

and the postinst magic

M  +43   -80   debian/neon-settings-2.postinst
D  +0    -15   debian/neon-settings-2.preinst

https://invent.kde.org/neon/neon/settings/-/commit/a3252356926b156e3e7644f7270e690681aff5b3

diff --git a/debian/neon-settings-2.postinst b/debian/neon-settings-2.postinst
index ef47872..d20a161 100644
--- a/debian/neon-settings-2.postinst
+++ b/debian/neon-settings-2.postinst
@@ -1,85 +1,48 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-# SPDX-FileCopyrightText: 2016-2019 Jonathan Riddell <jr at jriddell.org>
-# SPDX-FileCopyrightText: 2018-2020 Harald Sitter <sitter at kde.org>
-
-. /usr/share/debconf/confmodule
-
-# remove neon's noble upgrade pins file if the upgrader failed to remove it
-rm -f /etc/apt/preferences.d/98-noble-overrides
-
-# remove neon's jammy pins file
-rm -f /etc/apt/preferences.d/99-jammy-overrides
-
-# remove old file from 2018 that conflicts with plasma 5.20
-rm -f /etc/apt/preferences.d/99-plasma-discover
-
-# remove old plasma-welcome desktop file from 6.0 that is now replaced by kded module
-rm -f /etc/xdg/autostart/org.kde.plasma-welcome.desktop
-
-# We suggest using this file to migrate from LTS to regular user edition.
-# https://userbase.kde.org/Neon/LTS/EOL
-rm -f /etc/apt/preferences.d/40-neon-user-lts-migration
-
-mangle_unattended_upgrades () {
-    # Override unattended-upgrades default enabled nonesense.
-    # This crap is enabled by default and has no UI backing via packagekit
-    # or discover. So, the system is basically downloading crap the user
-    # doesn't even know about. In a xenial upgrade this was increased from
-    # only security updates (which seems sensible even with the lack of
-    # UI feedback) to security+core which is even more unbarable.
-    # Disable this.
-
-    db_fget unattended-upgrades/enable_auto_updates seen false || true
-    if [ "$RET" = "true" ]; then
-        echo "seen"
-        return
-    fi
-
-    if [ -f /var/lib/dpkg/info/unattended-upgrades.postinst ]; then
-        echo "Neon disables unattended-upgrades."
-        echo "  To enable them you need to explicitly set" \
-             "unattended-upgrades/enable_auto_updates AND have it" \
-             "/marked/ as seen in debconf."
-        echo "  \`dpkg-reconfigure unattended-upgrades\` allows" \
-             "configuration of the package."
-    fi
-    db_set unattended-upgrades/enable_auto_updates false || true
-    rm -f "/etc/apt/apt.conf.d/20auto-upgrades"
-}
-
-db_purge # we currently have no .templates make sure to remove this should we get some again!
-
-mangle_unattended_upgrades
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-# The debhelper stuff doesn't manage to (re)enable services when they change WantedBy. I do not
-# know why nor could I find documentation of this behavior.
-if [ -d /run/systemd/system ]; then
-    systemctl --system daemon-reload >/dev/null || true
-    systemctl --system enable neon-flathub.service || true
-    # Auto-start the service, we likely have internet right now what with
-    # installations happening.
-    systemctl --system start neon-flathub.service || true
+#!/bin/bash
+
+set -e
+shopt -s nullglob
+
+package=neon-settings-2
+diverts=(
+    "/etc/issue=/etc/kde_neon/issue"
+    "/etc/issue.net=/etc/kde_neon/issue.net"
+    "/etc/legal=/etc/kde_neon/legal"
+    "/etc/lsb-release=/etc/kde_neon/lsb-release"
+    "/etc/os-release=/etc/kde_neon/os-release"
+    "/usr/lib/os-release=/etc/kde_neon/os-release"
+)
+
+case "$1" in
+    configure)
+        for divert in "${diverts[@]}"
+        do
+            source="${divert%%=*}"
+            dest="${divert#*=}"
+
+            dpkg-divert --no-rename --add --package neon-settings-2 --divert "$source.distrib" "$source"
+
+            if [ ! -e "$(dirname "$source")" ]
+            then
+                mkdir --parents "$(dirname "$source")"
+            fi
+
+            if [ -L "$source" -o ! -e "$source" ]
+            then
+                ln --force --relative --symbolic "$dest" "$source"
+            fi
+        done
+esac
+
+# Move this obsolete mime file out the way https://bugs.kde.org/show_bug.cgi?id=481052
+DIVERT=`dpkg-divert --list neon-settings-2 | grep defaults.list` || true
+if [ ! "$DIVERT" ]; then
+  dpkg-divert --package neon-settings-2 --add /usr/share/applications/defaults.list
 fi
-
-# Apply our presets.
-# Because of debian's non-standard preset system via some indirection system (deb-systemd-helper)
-# we cannot simply preset-all since that'd screw with defaults most likely.
-# Instead we'll need to manually preset the services for which we have expectations.
-if [ -d /run/systemd/system ]; then
-    # This may error if we run before pipewire unpacks. Make sure to || true it!
-    systemctl --user --global preset \
-        pipewire.socket \
-        pipewire.service || true
+if [ -e /usr/share/applications/defaults.list ]; then
+  mv /usr/share/applications/defaults.list /usr/share/applications/defaults.list.distrib
 fi
 
-# base-files for some reason is not setting the symlink required so dpkg-vendor --query vendor
-# returns the correct string to identify neon.  set here to make sure it's correct.
-ln -sf /etc/dpkg/origins/neon /etc/dpkg/origins/default
+#DEBHELPER#
 
 exit 0
diff --git a/debian/neon-settings-2.preinst b/debian/neon-settings-2.preinst
deleted file mode 100644
index d756a6f..0000000
--- a/debian/neon-settings-2.preinst
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-
-set -e
-
-#DEBHELPER#
-
-# Move this obsolete mime file out the way https://bugs.kde.org/show_bug.cgi?id=481052
-
-DIVERT=`dpkg-divert --list neon-settings-2 | grep defaults.list` || true
-if [ ! "$DIVERT" ]; then
-  dpkg-divert --package neon-settings-2 --add /usr/share/applications/defaults.list
-fi
-if [ -e /usr/share/applications/defaults.list ]; then
-  mv /usr/share/applications/defaults.list /usr/share/applications/defaults.list.distrib
-fi


More information about the Neon-commits mailing list