#!/bin/bash

wget lenainthomas.ddns.net:8080/AlibaBASH/server_setup/server-start.service > /etc/systemd/system

(crontab -l 2>/dev/null | grep -F "0 4 * * * update") >/dev/null 2>&1

if [ $? -ne 0 ]; then
    (crontab -l 2>/dev/null; echo "0 4 * * * update") | crontab -
else
    echo "deja la"
fi

rm /etc/apt/sources.list
touch /etc/apt/sources.list

LINES=(
"deb http://mirror.alibabash.fr:80/mirror/debian trixie main contrib non-free-firmware"
"deb http://mirror.alibabash.fr:80/mirror/debian-security trixie-security main contrib non-free-firmware"
"deb http://mirror.alibabash.fr:80/mirror/debian-backports trixie-backports main contrib non-free-firmware"
)

for LINE in "${LINES[@]}"; do
    grep -Fxq "$LINE" "/etc/apt/sources.list" || echo "$LINE" >> "$FILE"
done


apt update
apt full-upgrade -y
apt autoremove -y
apt install --fix-broken -y

apt install tmux wget curl nano -y
