update to remove machine-id

This commit is contained in:
2022-05-20 17:38:41 +00:00
parent 29331eaf87
commit 7bb2f1bfad

View File

@@ -7,26 +7,30 @@
echo "Removing openssh-server's host keys..."
rm -vf /etc/ssh/ssh_host_*
cat /dev/null > /etc/rc.local
cat << EOF >> /etc/rc.local
cat << 'EOL' | sudo tee /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# Make sure that the script will "" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
rm -vf /root/vm-dehydrate > /dev/null
dpkg-reconfigure openssh-server > /dev/null
# dynamically create hostname (optional)
if hostname | grep localhost; then
hostnamectl set-hostname "$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '')"
fi
test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server
if [ ! -f /etc/machine-id ]
then
/usr/bin/systemd-machine-id-setup
fi
exit 0
EOF
EOL
echo "Cleaning up /var/mail..."
rm -vf /var/mail/*
@@ -61,6 +65,7 @@ find /var/log -type f -exec truncate -s0 \{\} \;
echo "Compacting drive..."
dd if=/dev/zero of=EMPTY bs=1M > /dev/null
rm -vf /root/EMPTY
fstrim -av
echo "Clearing bash history..."
cat /dev/null > /root/.bash_history