@@ -42,15 +42,47 @@ elif [ -n "$(command -v apt-get)" ]; then
4242
4343 source /etc/os-release
4444
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+
4766 apt-get -y autoremove
4867 apt-get -y autoclean
68+
69+ apt-get -y update
70+ apt-get -y upgrade
71+
4972fi
73+
74+ systemctl set-default multi-user.target
75+ systemctl disable
[email protected] 76+ 77+ systemctl mask graphical.target
78+
5079rm -rf /tmp/* /var/tmp/*
5180history -c
5281cat /dev/null > /root/.bash_history
5382unset HISTFILE
83+
84+ journalctl --rotate
85+ journalctl --vacuum-time=1s
5486find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
5587rm -rf /var/log/* .gz /var/log/* .[0-9] /var/log/* -????????
5688rm -rf /var/lib/cloud/instances/*
@@ -60,3 +92,14 @@ chmod 600 /etc/ssh/revoked_keys
6092
6193cat /dev/null > /var/log/lastlog
6294cat /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