From acde20fb921b04f82bc7533ad1f77b488269d2eb Mon Sep 17 00:00:00 2001 From: ston1th Date: Fri, 10 Dec 2021 23:13:42 +0100 Subject: [PATCH] initial commit --- README.md | 12 ++++++++++++ hash.sh | 4 ++++ ubuntu_2004.sh | 26 ++++++++++++++++++++++++++ ubuntu_2004.sh.sha256 | 1 + ubuntu_2004.sh.sha256.sha256 | 1 + ubuntu_2004_full.sh | 29 +++++++++++++++++++++++++++++ ubuntu_2004_full.sh.sha256 | 1 + ubuntu_2004_full.sh.sha256.sha256 | 1 + 8 files changed, 75 insertions(+) create mode 100644 README.md create mode 100755 hash.sh create mode 100644 ubuntu_2004.sh create mode 100644 ubuntu_2004.sh.sha256 create mode 100644 ubuntu_2004.sh.sha256.sha256 create mode 100644 ubuntu_2004_full.sh create mode 100644 ubuntu_2004_full.sh.sha256 create mode 100644 ubuntu_2004_full.sh.sha256.sha256 diff --git a/README.md b/README.md new file mode 100644 index 0000000..c52ba94 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Ubuntu Installation Cleanup Scripts + +## Usage + +Validate the scripts. + +Download and execute the script is the hash matches: + +``` +curl -sSL https://git.giftfish.de/ston1th/cleanup/raw/branch/master/ubuntu_2004_full.sh >/tmp/cleanup.sh +[ "$(sha256sum /tmp/cleanup.sh|cut -d' ' -f1)" = "fe2827d03ebba6e058ed7b9e56116eef78a45606f2e5f2956b2b2f495f042724" ] && sh /tmp/cleanup.sh || echo "error: cleanup script hash does not match" >&2 +``` diff --git a/hash.sh b/hash.sh new file mode 100755 index 0000000..f5e3e32 --- /dev/null +++ b/hash.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for f in $(ls ubuntu*); do + sha256sum ${f} >${f}.sha256 +done diff --git a/ubuntu_2004.sh b/ubuntu_2004.sh new file mode 100644 index 0000000..ff693d6 --- /dev/null +++ b/ubuntu_2004.sh @@ -0,0 +1,26 @@ +#!/bin/sh +apt-get -y purge alsa-topology-conf alsa-ucm-conf apport \ + apport-symptoms at bash-completion bolt byobu eatmydata command-not-found \ + eject fonts-ubuntu-console htop install-info landscape-common lxd-agent-loader \ + motd-news-config nano ntfs-3g pastebinit plymouth plymouth-theme-ubuntu-text \ + popularity-contest policykit-1 python3-apport os-prober snapd \ + sound-theme-freedesktop ubuntu-advantage-tools ufw +apt-get -y autoremove --purge +apt-get -y clean + +mkdir /etc/systemd/system/motd-news.service.d +cat </etc/systemd/system/motd-news.service.d/override.conf +[Service] +ExecStart=/bin/true +EOF + +mkdir /etc/systemd/timesyncd.conf.d +cat </etc/systemd/timesyncd.conf.d/ntp.conf +[Time] +NTP=pool.ntp.org +EOF + +rm /home/ubuntu/.ssh/authorized_keys +find /var/log -type f | while read f; do echo -ne >$f; done +rm -rf /var/lib/cloud/* /var/tmp/* /tmp/* /tmp/.*-unix +exit 0 diff --git a/ubuntu_2004.sh.sha256 b/ubuntu_2004.sh.sha256 new file mode 100644 index 0000000..2dcf7bc --- /dev/null +++ b/ubuntu_2004.sh.sha256 @@ -0,0 +1 @@ +15d111ab2de72ef204a6e3dd77006038f869f3d596109a34a994d0474e124816 ubuntu_2004.sh diff --git a/ubuntu_2004.sh.sha256.sha256 b/ubuntu_2004.sh.sha256.sha256 new file mode 100644 index 0000000..bc5be5d --- /dev/null +++ b/ubuntu_2004.sh.sha256.sha256 @@ -0,0 +1 @@ +213d1b35771c3a43ae53667ef0a25beecd9faaed3b2c21355ba4584210c63b68 ubuntu_2004.sh.sha256 diff --git a/ubuntu_2004_full.sh b/ubuntu_2004_full.sh new file mode 100644 index 0000000..045a14c --- /dev/null +++ b/ubuntu_2004_full.sh @@ -0,0 +1,29 @@ +#!/bin/sh +apt-get -y purge alsa-topology-conf alsa-ucm-conf apport \ + apport-symptoms at bash-completion bolt byobu eatmydata command-not-found \ + eject fonts-ubuntu-console htop install-info landscape-common lxd-agent-loader \ + motd-news-config nano ntfs-3g pastebinit plymouth plymouth-theme-ubuntu-text \ + popularity-contest policykit-1 python3-apport os-prober snapd \ + sound-theme-freedesktop ubuntu-advantage-tools ufw +apt-get -y purge accountsservice multipath-tools packagekit udisks2 \ + unattended-upgrades lshw lsof ltrace man-db manpages mdadm mtr-tiny \ + screen sosreport strace tcpdump tmux usbutils whiptail +apt-get -y autoremove --purge +apt-get -y clean + +mkdir /etc/systemd/system/motd-news.service.d +cat </etc/systemd/system/motd-news.service.d/override.conf +[Service] +ExecStart=/bin/true +EOF + +mkdir /etc/systemd/timesyncd.conf.d +cat </etc/systemd/timesyncd.conf.d/ntp.conf +[Time] +NTP=pool.ntp.org +EOF + +rm /home/ubuntu/.ssh/authorized_keys +find /var/log -type f | while read f; do echo -ne >$f; done +rm -rf /var/lib/cloud/* /var/tmp/* /tmp/* /tmp/.*-unix +exit 0 diff --git a/ubuntu_2004_full.sh.sha256 b/ubuntu_2004_full.sh.sha256 new file mode 100644 index 0000000..5cd2b7c --- /dev/null +++ b/ubuntu_2004_full.sh.sha256 @@ -0,0 +1 @@ +fe2827d03ebba6e058ed7b9e56116eef78a45606f2e5f2956b2b2f495f042724 ubuntu_2004_full.sh diff --git a/ubuntu_2004_full.sh.sha256.sha256 b/ubuntu_2004_full.sh.sha256.sha256 new file mode 100644 index 0000000..2b0588f --- /dev/null +++ b/ubuntu_2004_full.sh.sha256.sha256 @@ -0,0 +1 @@ +1806939ad40adae83d208a759732696ccb3b11587013488b6e9b09f328d6ee60 ubuntu_2004_full.sh.sha256