remove all X packages from cache to optimize RAM usage

This commit is contained in:
Tobias Powalowski 2022-05-14 09:02:46 +02:00
parent ad1961cda6
commit 873d50880f
2 changed files with 16 additions and 7 deletions

View file

@ -6,13 +6,11 @@ _GRUB_CONFIG="/usr/share/archboot/grub/archboot-main-grub.cfg"
_GRUB_BACKGROUND="/usr/share/archboot/grub/archboot-background.png"
### XFCE defaults
# needed full installed packages in environment for X
_FULL_PACKAGES="llvm-libs gcc-libs perl glibc libtiff glib2 libcups harfbuzz avahi nss p11-kit libp11-kit fuse tpm2-tss libsecret smbclient libcap tevent libbsd libldap tdb ldb libmd jansson libsasl"
_FULL_PACKAGES="gcc-libs perl glibc libtiff glib2 libcups harfbuzz avahi nss p11-kit libp11-kit fuse tpm2-tss libsecret smbclient libcap tevent libbsd libldap tdb ldb libmd jansson libsasl"
# ignore packages to upgrade before X startup eg. kernel and firmware
_X_IGNORE="linux linux-firmware linux-firmware-marvell"
# X packages
_X_PACKAGES="xorg chromium xfce4 tigervnc breeze-icons gvfs gvfs-smb thunar-archive-plugin thunar-volman file-roller gparted gnome-keyring nss-mdns mousepad ristretto"
# packages to remove from cache before X startup happens
_X_RM_PACKAGES="xorg xfce4 chromium llvm-libs mesa ffmpeg"
# don't show in xfce menu
_HIDE_MENU="xfce4-mail-reader xfce4-about"
# VNC password

View file

@ -237,6 +237,19 @@ _cleanup_install() {
rm -rf /usr/lib/libgo.*
}
_cleanup_x_cache() {
# get last full package
LAST_FULL_PACKAGE="$(grep 'FULL' /etc/archboot/defaults | sed -e 's#^.*\ ##g' -e 's#\"##g')"
# installed packages
grep installed /var/log/pacman.log | cut -d ' ' -f 4 >/tmp/installed.log
# remove all lines above with match
sed "1,/^${LAST_FULL_PACKAGE}$/d" >/tmp/installed.log
# remove packages from cache
for i in $(cat /tmp/installed.log); do
rm -rf /var/cache/pacman/pkg/${i}-*
done
}
_prepare_xfce() {
# fix libs first, then install packages from defaults
_XORG="${_FULL_PACKAGES} ${_X_PACKAGES}"
@ -272,10 +285,8 @@ _prepare_xfce() {
fi
echo "Removing not used icons ..."
rm -rf /usr/share/icons/breeze-dark
echo "Removing files from cache directory: ${_X_RM_PACKAGES} ..."
for i in ${_X_RM_PACKAGES}; do
rm -f /var/cache/pacman/pkg/"${i}"-*
done
echo "Removing files from cache directory ..."
_cleanup_x_cache
echo "Removing firmware files ..."
rm -rf /usr/lib/firmware
echo "Recreating C.UTF-8 locale ..."