#!/bin/bash ##---------------## # Static Vars # ##---------------## OUTPUT='/dev/null' APTMODE="debconf-apt-progress -- apt" PKGM="$APTMODE" PKGUD="$PKGM update" PKGUP="$PKGM upgrade -y" PKGI="${PKGM} install -y" PKRM="$PKGM remove --purge -y" PKARM="$PKGM autoremove -y" REPO=LanCache BRANCH=main GIT=https://git.ictcorpnet.com/b.waal/$REPO/raw if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi if (whiptail --title "LanCache - Prefill" --yesno "Use SteamPrefill?." 8 78); then echo "" prefill=true else prefill=false fi ##---------------## # Pre-Updater # ##---------------## ping -c 1 192.168.1.102 > /dev/null && HOSTUP=yes || HOSTUP=no if [[ $HOSTUP == yes ]]; then echo > /dev/tcp/192.168.1.102/80 && echo 'Acquire::http::Proxy "http://192.168.1.102:80";'> /etc/apt/apt.conf.d/01prox fi echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/01Recommends echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/01Suggests if [ -f /etc/apt/apt.conf.d/00CDMountPoint ]; then rm /etc/apt/apt.conf.d/00CDMountPoint fi if [ -f /etc/apt/apt.conf.d/00trustcdrom ]; then rm /etc/apt/apt.conf.d/00trustcdrom fi ##---------------## # Dependencies # ##---------------## #$PKGI curl wget whiptail sudo apt update apt upgrade -y $PKGUD $PKGI curl wget whiptail gnupg ca-certificates ##------------------## # Docker Compose # ##------------------## install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null $PKGUD apt list --upgradeable 2>/dev/null | cut -d/ -f1 | grep -v Listing >> /tmp/install.list echo "openssh-server curl wget nload htop nano" >> /tmp/install.list echo "docker-ce docker-ce-cli docker-compose-plugin" >> /tmp/install.list if [[ $prefill == "true" ]]; then echo "jq unzip" >> /tmp/install.list fi xargs < /tmp/install.list xargs $PKGI systemctl enable --now docker ##-------------## # Pre-Config # ##-------------## mkdir -p /opt/lancache mkdir -p /opt/lancache/tools/SteamPrefill mkdir -p /data sed -i "s/GRUB_TIMEOUT=5/GRUB_TIMEOUT=3/g" /etc/default/grub sed -i "s/PermitRootLogin yes/PermitRootLogin prohibit-password/g" /etc/ssh/sshd_config echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCYQpbusYwoASsIgPo3JwxhQGq7Vu5u/+rbkB8+p5XuIAuGpuOm3rB17Heq7fyV01oGSwWxQT92623Iw1Kf5q8iVs+KHKNoLEqxb4jvIJ1bN9O4jo/hIOAr8O0rvRBMg+WNIXg7WbXlXDzO05ME8UGA/b5dch0f4ZJcSgUUrj5/QzYFBimvpN0+U5eYQ48NkBekRZKmacw6ABtREpLhyqEgWsuxYsUcKLt95lmVWN7nvaWdc3pvyMs2N/aE9/rbbkO8Ft3y/w4kgXyNVhCvLwFK8uic10FI3Q3vqL5NE35PL1zoktqgmyzNVYd+M4sthGCNvH3goWfQmpy5XDC6wAftNrPuh3W1LylDdEnwfY1AXXP2uKk20X4fD6YCyaMatxV5bhStGOIOHE8VL4xEOcbBCeLfpcVhASDulN2Dbi9k0Muvs+CwV4Kf4N6UpCN7UaINfncY2nQf3dfAXn7XVTciU3ByXypxy+M0iB6PP8i566twKD2ZhLTQxXzsmRdNg/q6RH7Iu4zsKY/1I8aM9Jv6BkvdGKn0aG9W9PCmWv1QGGKRKT5gRqQjf1bjefJtFqw/WjHkf7KQrj1Ql5TGbPaHKc5YIBPwpOR6CKyfGVz7EhBWSsoM7IgcE27P5oJXlzqGwK/MQNHHNDwammvyJgOGGmuHq0rm5eBNv9+/UcFBaQ== 5700x " >> .ssh/authorized_keys userdel branco update-grub echo "" >> /etc/sysctl.conf echo "#Disable IPv6" >> /etc/sysctl.conf echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf ##-------------## # Installer # ##-------------## wget $GIT/$BRANCH/config/lancache/default.env -O /opt/lancache/.env wget $GIT/$BRANCH/config/lancache/highspeed.env -O /opt/lancache/.HSenv wget $GIT/$BRANCH/config/lancache/docker.yml -O /opt/lancache/docker-compose.yml ##----------------## # Steam Prefill # ##----------------## cd /opt/lancache/tools/SteamPrefill curl -o /opt/lancache/tools/SteamPrefill/update.sh --location "https://raw.githubusercontent.com/tpill90/steam-lancache-prefill/master/scripts/update.sh" chmod +x /opt/lancache/tools/SteamPrefill/update.sh bash /opt/lancache/tools/SteamPrefill/update.sh chmod +x /opt/lancache/tools/SteamPrefill/SteamPrefill cd ~ wget $GIT/$BRANCH/config/tools/prefill/steam/recent.timer -O /etc/systemd/system/steamprefill-recent.timer wget $GIT/$BRANCH/config/tools/prefill/steam/selected.timer -O /etc/systemd/system/steamprefill-selected.timer wget $GIT/$BRANCH/config/tools/prefill/steam/recent.service -O /etc/systemd/system/steamprefill-recent.service wget $GIT/$BRANCH/config/tools/prefill/steam/selected.service -O /etc/systemd/system/steamprefill-selected.service systemctl daemon-reload systemctl enable --now steamprefill-selected.timer systemctl enable --now steamprefill-recent.timer systemctl enable steamprefill-selected.service systemctl enable steamprefill-recent.service ##---------------## # Cleaning up # ##---------------## apt remove --purge vim* mailcap* man-db* manpages* laptop-detect* publicsuffix* xkb-data* python* apt autoremove -y ##------------------## # Start LanCache # ##------------------## cd /opt/lancache docker compose up -d cd ~ #/opt/lancache/tools/SteamPrefill/SteamPrefill prefill --recent --os windows --no-ansi #/opt/lancache/tools/SteamPrefill/SteamPrefill prefill --os windows --no-ansi