Docs/BashScripts/vm-tweaks.sh

23 lines
784 B
Bash

# Install using: sudo su -c "bash <(wget -qO- /url/to/vm-tweaks.sh)"
# Make sure script is ran as root
if [[ $EUID -ne 0 ]]; then
exec sudo /bin/bash "$0" "$@"
fi
REALUSER=$(logname)
rmmod floppy > /dev/null 2>&1 && (
echo "Adding floppy to modprobe blacklist"
echo "blacklist floppy" | tee /etc/modprobe.d/blacklist-floppy.conf
dpkg-reconfigure initramfs-tools
)
if [ ! -f "/etc/cloud/cloud-init.disabled" ]; then
echo "Disabling cloud-init"
touch /etc/cloud/cloud-init.disabled
fi
# Fix: apt-get upgrade auto restart services
# https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services
sed -i -e "s/#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/g" /etc/needrestart/needrestart.conf
echo 'Installation complete. You should reboot to apply changes.'