#!/usr/bin/env bash

set -e
set -x

. ${0%/*}/_functions.sh

export DEBIAN_FRONTEND="noninteractive"

#apt-get -qq -y remove dirmngr wget patch

#apt-get -qq -y autoclean
#apt-get -qq -y clean
#apt-get -qq -y autoremove

# very dirty clean
#apt list --installed | grep python | grep -oE '^[^/]+' | xargs dpkg -r --force-depends || true

find /usr/share/doc -depth -type f ! -name copyright | xargs -r rm || true
find /usr/share/doc -empty | xargs rmdir || true

rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/*
rm -rf /usr/share/lintian/* /usr/share/linda/* /var/cache/man/*
rm -rf /installation
rm -rf /var/lib/apt/lists/*
find /var/cache/apt -maxdepth 1 -type f -exec rm -f {} \; # only files not mounted cache directory
rm -Rf /packages
rm -Rf /package
rm -Rf /tmp/*

rm -Rf /root/.wget-hsts