blob: 0045ce489b6145b7ac46d8bde5991f16e265fcfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/sh
export http_proxy=
#apt-get remove --yes --purge aptitude dselect nano vim-tiny libdiscover1 resolvconf
apt-get remove --yes --purge nano vim-tiny libdiscover1 resolvconf
/usr/sbin/remove-orphans || true
# Removing unused files
find . -name *~ | xargs rm -f
# Cleaning apt lists but keep yml files
# TODO
for x in $(ls /var/lib/apt/lists |grep yml)
do
cp -f /var/lib/apt/lists/$x /tmp/
done
rm -rf /var/lib/apt/lists
mkdir -p /var/lib/apt/lists/partial
for x in $(ls /tmp |grep yml)
do
cp -f /tmp/$x /var/lib/apt/lists/
done
# Cleaning apt cache
rm -rf /var/cache/apt
mkdir -p /var/cache/apt/archives/partial
# Cleaning /etc/hosts
rm -f /etc/hosts
# Truncating logs
for FILE in $(find /var/log/ -type f)
do
: > ${FILE}
done
# custom cleanup
rm -f /var/cache/apt/*.bin
dpkg --clear-avail
apt-cache gencaches
update-pciids || true
rm -f /usr/share/misc/pci.ids.*
update-usbids || true
rm -f /var/lib/usbutils/usb.ids.*
|