@@ -42,15 +42,47 @@ elif [ -n "$(command -v apt-get)" ]; then
42
42
43
43
source /etc/os-release
44
44
45
- apt-get -y update
46
- apt-get -y upgrade
45
+ apt-mark manual libevent-2.1-7t64
46
+
47
+ apt-get remove -y --purge ansible-core apport appstream bash-completion bcache-tools bind9-dnsutils bind9-host bind9-libs bolt btrfs-progs byobu command-not-found console-setup distro-info eject fonts-ubuntu-console friendly-recovery ftp fwupd gawk gdisk keyboard-configuration libvolume-key1 libssl-dev lvm2 lxd-agent-loader man-db mdadm modemmanager mtd-utils nano netcat-openbsd nfs-common ntfs-3g parted pastebinit screen strace thin-provisioning-tools tmux usb-modeswitch vim vim-runtime wget whiptail xfsprogs
48
+
49
+ apt remove -y --purge libc6-dev linux-libc-dev libevent-dev libpcre3-dev libsystemd-dev packagekit multipath-tools unattended-upgrades plymouth gnupg open-vm-tools xauth lxd-installer publicsuffix libclang-cpp18 python3-twisted python-babel-localedata libicu74 python3-pygments fonts-dejavu* python3-botocore
50
+
51
+ apt-get remove -y --purge linux-headers*
52
+
53
+ # remove old kernels
54
+ # CURRENT_KERNEL="$(uname -r | sed 's/-generic//')"
55
+ # INSTALLED_KERNELS=$(dpkg -l | awk '{print $2}' | grep -Eo 'linux-(image|headers|modules|tools)-[0-9]+' | sed -E 's/linux-(image|modules|tools)-//' | sort -Vu)
56
+ # REMOVE_KERNELS=$(echo "$INSTALLED_KERNELS" | grep -v -e "$CURRENT_KERNEL")
57
+ # for VER in $REMOVE_KERNELS; do
58
+ # for PREFIX in linux-image linux-modules linux-tools; do
59
+ # for PKG in $(dpkg -l | awk '{print $2}' | grep "^$PREFIX-$VER"); do
60
+ # apt-get purge -y "$PKG"
61
+ # done
62
+ # done
63
+ # done
64
+ # update-grub
65
+
47
66
apt-get -y autoremove
48
67
apt-get -y autoclean
68
+
69
+ apt-get -y update
70
+ apt-get -y upgrade
71
+
49
72
fi
73
+
74
+ systemctl set-default multi-user.target
75
+ systemctl disable
[email protected]
76
+
77
+ systemctl mask graphical.target
78
+
50
79
rm -rf /tmp/* /var/tmp/*
51
80
history -c
52
81
cat /dev/null > /root/.bash_history
53
82
unset HISTFILE
83
+
84
+ journalctl --rotate
85
+ journalctl --vacuum-time=1s
54
86
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
55
87
rm -rf /var/log/* .gz /var/log/* .[0-9] /var/log/* -????????
56
88
rm -rf /var/lib/cloud/instances/*
@@ -60,3 +92,14 @@ chmod 600 /etc/ssh/revoked_keys
60
92
61
93
cat /dev/null > /var/log/lastlog
62
94
cat /dev/null > /var/log/wtmp
95
+
96
+ dd if=/dev/zero of=/zerofile &
97
+ PID=$!
98
+ while [ -d /proc/$PID ]
99
+ do
100
+ printf " ."
101
+ sleep 5
102
+ done
103
+ sync; rm /zerofile; sync
104
+
105
+ fstrim /
0 commit comments