2023-02-07 09:22:33 +01:00
|
|
|
#!/usr/bin/env bash
|
2023-08-11 17:19:18 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2023-02-07 09:22:33 +01:00
|
|
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
2023-09-01 13:28:32 +02:00
|
|
|
. /usr/lib/archboot/common.sh
|
2024-08-01 10:27:47 +02:00
|
|
|
_usage () {
|
2024-08-01 13:24:04 +02:00
|
|
|
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Check Not Installed Packages\e[m"
|
2024-08-01 10:27:47 +02:00
|
|
|
echo -e "\e[1m---------------------------------------\e[m"
|
|
|
|
echo "Check the system for uninstalled packages with pacman."
|
|
|
|
echo ""
|
|
|
|
echo -e "Usage: \e[1m${_BASENAME} run\e[m"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
[[ -z "${1}" || "${1}" != "run" ]] && _usage
|
2023-09-01 13:28:32 +02:00
|
|
|
_archboot_check
|
2024-04-13 09:21:29 +02:00
|
|
|
# consider only license package and locale as uninstalled
|
|
|
|
# it's hard to track manually changes in systemd files
|
|
|
|
# added those directories with _full_dir
|
|
|
|
rm -r /usr/share/{licenses,locale} /usr/lib/{systemd,tmpfiles.d}
|
2023-02-07 09:14:40 +01:00
|
|
|
pacman -Sy
|
2023-09-04 09:33:55 +02:00
|
|
|
#shellcheck disable=SC2013
|
2024-07-28 22:07:31 +02:00
|
|
|
for i in $(pacman -Q | choose 0); do
|
2024-07-10 21:42:44 +02:00
|
|
|
#shellcheck disable=SC2086
|
2024-07-10 21:40:20 +02:00
|
|
|
rm -r "${_PACMAN_LIB}"/local/"$(pacman -Q ${i} | sd ' ' '-')"
|
2024-04-13 09:21:29 +02:00
|
|
|
#shellcheck disable=SC2086
|
2024-07-18 09:53:34 +02:00
|
|
|
if pacman -Sdd ${i} --noconfirm >>pacman.log; then
|
|
|
|
echo "${i}" >> not-installed.orig.log
|
2023-03-12 07:26:26 +01:00
|
|
|
else
|
2024-04-13 09:21:29 +02:00
|
|
|
#shellcheck disable=SC2086
|
2023-09-04 21:17:37 +02:00
|
|
|
pacman -Sdd ${i} --noconfirm --overwrite '*'
|
2023-03-12 07:26:26 +01:00
|
|
|
fi
|
2023-02-07 09:14:40 +01:00
|
|
|
done
|
2024-04-13 09:38:52 +02:00
|
|
|
# remove false positives:
|
|
|
|
# ca-certificates has no files
|
|
|
|
# dbus-broker-units only systemd files
|
|
|
|
# iana-etc only /etc files
|
|
|
|
# licenses mandatory removed
|
|
|
|
# linux-firmware-whence only license files
|
|
|
|
# pacman-mirrorlist only /etc file
|
|
|
|
# pambase only /etc files
|
2024-07-27 19:25:33 +02:00
|
|
|
rg -v "ca-certificates|dbus-units|dbus-broker-units|iana-etc|licenses|linux-firmware-whence|pacman-mirrorlist|pambase" not-installed.orig.log >not-installed.log
|