#!/bin/bash

### Error checking added to "lint-trap" section.
### Missing files no longer cause builds to fail.

### Do NOT remove these files. 
# /usr/share/lightdm/lightdm.conf.d/01_debian.conf 

## This section is the "lint-trap" to remove files and/or
##  directories not associated with or required by PepOS.
## Followed by \ , add files to be removed, one per line.

for i in \
/usr/bin/install-debian \
/usr/share/applications/install-debian.desktop \
/usr/share/applications/xfburn.desktop \
/root/.cache/pip \

  do [ -e $i ] && 
     rm -rf ${i} ||
     echo "   The path ${i} was not found and couldn't be removed."
  done

 
### This might be better in an OS-tweaks hook script. 
# Lowers the footprint in RAM by 200 MB at the small expense of added size to the ISO.
update-icon-caches /usr/share/icons/*

### Setting --apt-recommends and --apt-suggests defaults to '0'
echo -e "# Changing these values to \"1\" may quickly fill up a small partition" > /etc/apt/apt.conf.d/99No-Recommends
echo -e "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/99No-Recommends

### Fixes the "Not installing grub for UEFI Secure Boot" in all versions , after the default was changed.
#sed s/keyutils/"keyutils --install-recommends"/ /usr/sbin/bootloader-config > /tmp/bootloader-config
echo -e "$(grep -A1 -B20 "Installing grub-efi (uefi)..." /usr/sbin/bootloader-config) --install-recommends" > /tmp/bootloader-config
echo -e "$(grep -A2 "else" /usr/sbin/bootloader-config) --install-recommends\nfi" >> /tmp/bootloader-config
chmod +x /tmp/bootloader-config && mv /tmp/bootloader-config /usr/sbin/bootloader-config

