#!/bin/bash this_file="$(realpath -s $0)" # Ensure running as sudo id if [ `id -u` -ne 0 ]; then echo Need sudo exit 1 fi # Set time zone timedatectl set-timezone Asia/Singapore # Update packages apt update apt -y full-upgrade # Regenerate SSH host keys test -f /etc/ssh/ssh_host_rsa_key || dpkg-reconfigure openssh-server # Clear file, and replace rc.local <- rc.local.bak if [ "$this_file" -ef /etc/rc.local ]; then rm -f /etc/rc.local; test -f /etc/rc.local.bak && mv /etc/rc.local.bak /etc/rc.local; else rm -f "$this_file" fi # Reboot shutdown -r now