#!/bin/bash

if [[ $UID != 0 ]]; then
    echo "Please run this script with root privileges"
    exit 1
fi

dest=/etc/update-motd.d

# dependencies
apt install figlet python3 lm-sensors -y

# turn off stock motd news
systemctl stop motd-news.timer
systemctl disable motd-news.timer

# copy files to destination
cp *-* $dest/
cp misc.py $dest/

# turn all modules off
chmod -x $dest/*

# turn on selected
chmod +x    $dest/00-header \
            $dest/05-logo \
            $dest/10-uptime \
            $dest/18-mounts \
            $dest/19-temps \
            $dest/21-services \
            $dest/88-esm-announce \
            $dest/90-updates-available \
            $dest/91-release-upgrade \
            $dest/92-unattended-upgrades \
            $dest/95-hwe-eol \
            $dest/98-fsck-at-reboot \
            $dest/98-reboot-required
