#!/bin/bash
apt install wget
wget -e robots=off --no-parent -r --reject "index.html*" https://www.xircon.net/download/tools/update-service/

cp -v www.xircon.net/download/tools/update-service/system-update.sh /usr/local/bin/system-update.sh
chmod +x /usr/local/bin/system-update.sh
cp -v www.xircon.net/download/tools/update-service/system-update.service /etc/systemd/system/system-update.service
cp -v www.xircon.net/download/tools/update-service/system-update.timer /etc/systemd/system/system-update.timer
systemctl daemon-reload
systemctl enable --now system-update.timer

read -p "Do you want to install reboot service? (y/n) " yn
case $yn in
	y)
	cp -v www.xircon.net/download/tools/update-service/weekly-reboot.service /etc/systemd/system/weekly-reboot.service
	cp -v www.xircon.net/download/tools/update-service/weekly-reboot.timer /etc/systemd/system/weekly-reboot.timer
	systemctl daemon-reload
	systemctl enable --now weekly-reboot.timer
	rm -r www.xircon.net/
	;;

	n)
	rm -r www.xircon.net/
	exit;;
esac



