mirror of
https://github.com/KDE/kde-linux.git
synced 2025-12-24 00:18:23 -05:00
plocate is a fast and efficient file locating tool that improves upon the traditional locate command. Database is updated daily or on demand by running `sudo updatedb`, then users can quickly find files using `locate <filename>` -- much faster than using `find` across the filesystem.
173 lines
6.4 KiB
Bash
Executable File
173 lines
6.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
# SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
|
|
|
|
set -ex
|
|
|
|
userdel --remove --force builder || true
|
|
passwd --delete root
|
|
passwd --lock root
|
|
|
|
if [ -f "$SRCDIR/.secure_files/gpg.public.key" ]; then # only useful and available for publishing branches
|
|
# Put our key into the systemd keyring
|
|
export GNUPGHOME="$SRCDIR/.secure_files/gpg"
|
|
KEYRING=/usr/lib/systemd/import-pubring.pgp
|
|
rm -rf "$GNUPGHOME"
|
|
mkdir "$GNUPGHOME"
|
|
rm -f "$KEYRING"
|
|
gpg --no-options --no-default-keyring --keyring="$KEYRING" --homedir="$GNUPGHOME" --import "$SRCDIR/.secure_files/gpg.public.key"
|
|
|
|
# TODO: Make sure the keyring is actually used. This notably broke in the past because of an upstream change.
|
|
# https://invent.kde.org/kde-linux/kde-linux/-/issues/199
|
|
fi
|
|
|
|
# Uninstall solaar and sane, but keep their udev rules.
|
|
# This ensures that they stay up to date.
|
|
UDEV_BACKUP_DIR=$(mktemp -d)
|
|
pacman -Qlq solaar sane | grep '^/usr/lib/udev/' | xargs -r cp -a --parents -t "$UDEV_BACKUP_DIR"
|
|
pacman -Rns --noconfirm solaar sane
|
|
cp -a "$UDEV_BACKUP_DIR"/* /
|
|
rm -rf "$UDEV_BACKUP_DIR"
|
|
|
|
# De-initialize pacman
|
|
rm -rf \
|
|
/etc/pacman.d/gnupg \
|
|
/.gnupg \
|
|
/var/cache/pacman \
|
|
/var/lib/pacman \
|
|
/var/log/pacman.log
|
|
|
|
## Pacman being present confuses users into thinking they can use it to install packages.
|
|
rm -f /usr/bin/pacman
|
|
|
|
# Remove all excess things we don't want in the final image
|
|
|
|
## locale-gen doesn't work because /usr is read-only. Removing it means calamares won't attempt to use it.
|
|
rm -rf \
|
|
/etc/locale.gen \
|
|
/usr/bin/locale-gen
|
|
|
|
## Multimedia players we only want for their libraries
|
|
rm -rf \
|
|
/usr/share/applications/vlc.desktop \
|
|
/usr/bin/vlc \
|
|
/usr/share/applications/mpv.desktop \
|
|
/usr/bin/mpv
|
|
|
|
## Development tools that aren't useful even for the development edition
|
|
rm -rf \
|
|
/usr/bin/assistant \
|
|
/usr/bin/assistant-qt5 \
|
|
/usr/share/applications/assistant.desktop \
|
|
/usr/bin/designer \
|
|
/usr/bin/designer-qt5 \
|
|
/usr/share/applications/designer.desktop \
|
|
/usr/bin/linguist \
|
|
/usr/bin/linguist-qt5 \
|
|
/usr/share/applications/linguist.desktop \
|
|
/usr/bin/qdbusviewer \
|
|
/usr/bin/qdbusviewer-qt5 \
|
|
/usr/share/applications/qdbusviewer.desktop \
|
|
/usr/share/applications/qv4l2.desktop \
|
|
/usr/bin/qvidcap \
|
|
/usr/share/applications/qvidcap.desktop \
|
|
|
|
# Parts of plasma-sdk that are on Flathub now, so you can just get them from there
|
|
# (once everything is on Flathub, we can stop building plasma-sdk, and remove these lines)
|
|
rm -rf \
|
|
/usr/bin/iconexplorer \
|
|
/usr/lib/qt6/plugins/kf6/ktexteditor/iconexplorerplugin.so \
|
|
/usr/share/applications/org.kde.iconexplorer.desktop \
|
|
/usr/share/locale/*/LC_MESSAGES/iconexplorer.mo \
|
|
/usr/share/icons/hicolor/scalable/apps/org.kde.iconexplorer.svg
|
|
|
|
## HP device management apps that are useless even for 99% of HP device owners, and we have our own better stuff
|
|
rm -rf \
|
|
/usr/share/applications/hp-uiscan.desktop \
|
|
/usr/bin/hp-uiscan \
|
|
/usr/share/applications/hplip.desktop \
|
|
/usr/bin/hp-toolbox
|
|
|
|
## FFADO Mixer app that came along for the ride with FireWire audio support
|
|
rm -rf \
|
|
/usr/bin/ffado-mixer \
|
|
/usr/lib/python3.13/site-packages/ffado/mixer \
|
|
/usr/share/applications/org.ffado.FfadoMixer.desktop \
|
|
/usr/share/icons/hicolor/64x64/apps/hi64-apps-ffado.png \
|
|
/usr/share/metainfo/org.ffado.FfadoMixer.metainfo.xml \
|
|
|
|
# LSHW GUI app that came along for the ride with the CLi tool
|
|
rm -rf \
|
|
/usr/share/applications/gtk-lshw.desktop \
|
|
/usr/bin/gtk-lshw \
|
|
/usr/share/lshw/artwork \
|
|
/usr/share/lshw/ui
|
|
|
|
## Miscellaneous application entries that have zero value because we either have better stuff or they're for terminal applications
|
|
rm -rf \
|
|
/usr/share/applications/avahi-discover.desktop \
|
|
/usr/share/applications/vim.desktop \
|
|
/usr/share/applications/htop.desktop \
|
|
/usr/share/applications/lstopo.desktop \
|
|
/usr/share/applications/bssh.desktop \
|
|
/usr/share/applications/bvnc.desktop \
|
|
/usr/share/applications/cups.desktop \
|
|
/etc/xdg/autostart/print-applet.desktop \
|
|
/usr/bin/system-config-printer-applet \
|
|
/usr/share/applications/system-config-printer.desktop \
|
|
/usr/share/applications/nvtop.desktop \
|
|
/usr/share/applications/stoken-gui-small.desktop \
|
|
/usr/share/applications/stoken-gui.desktop \
|
|
/usr/share/applications/cmake-gui.desktop \
|
|
/usr/share/applications/tuned-gui.desktop \
|
|
|
|
## Remove local documentation for KDE apps; it's available online.
|
|
rm -rf \
|
|
/usr/share/doc/
|
|
|
|
## /boot is now the preferred mount point for systemd and BLS:
|
|
## https://uapi-group.org/specifications/specs/boot_loader_specification/#mount-points
|
|
## However, its content are no longer necessary, since we've already created our initrd.
|
|
# shellcheck disable=SC2114
|
|
rm -rf /boot/*
|
|
|
|
## Don't expose any X11 sessions; we're all-in on Wayland.
|
|
rm -rf /usr/share/xsessions/
|
|
|
|
## Get rid of the beefy Kernel Headers as DKMS happens at build time and after that is useless
|
|
rm -rf \
|
|
/usr/lib/modules/*/build \
|
|
/usr/lib/modules/*/vdso \
|
|
/usr/src/*
|
|
|
|
## Replace Falkon with Firefox as the default browser, since that's what we pre-install.
|
|
sed -i 's/org.kde.falkon.desktop/org.mozilla.firefox.desktop/' /usr/share/applications/kde-mimeapps.list
|
|
|
|
# Prevent tuned from messing with the vm.swappiness parameter we already set
|
|
sed --in-place 's|^vm.swappiness.*||' /usr/lib/tuned/profiles/*/*
|
|
|
|
# Give KWin phenomenal cosmic power so it can do its job better; see
|
|
# https://community.kde.org/Distributions/Packaging_Recommendations#KWin_package_configuration
|
|
setcap 'cap_sys_nice=+ep' /usr/bin/kwin_wayland
|
|
|
|
# Add a "command not found" handler for Bash. We have to modify the existing file because it
|
|
# already exists, and we can't put this in /etc/profile or /etc/profile.d/ because for profile
|
|
# items, only environment variables get inherited by non-login shells; shell functions don't.
|
|
cat <<- EOF >> /etc/bash.bashrc
|
|
|
|
command_not_found_handle () {
|
|
python3 /usr/lib/command-not-found-handler.py "\$1"
|
|
}
|
|
EOF
|
|
|
|
# Configure plocate to index bind mounts (needed on BTRFS)
|
|
# See: https://wiki.archlinux.org/title/Locate#Btrfs
|
|
if [ -f /etc/updatedb.conf ]; then
|
|
sed -i 's/^PRUNE_BIND_MOUNTS = "yes"/PRUNE_BIND_MOUNTS = "no"/' /etc/updatedb.conf
|
|
fi
|
|
|
|
# Clean up final remnants of the build process
|
|
rm -rf \
|
|
/buildroot \
|
|
/.cache \
|