From 1508fbb2bf3bdc6dd968cfbd352c15599f2523c6 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 11 Jan 2025 13:02:57 +0100 Subject: [PATCH] feat: add updater to install script --- install.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/install.sh b/install.sh index c9c75fd..92056f1 100644 --- a/install.sh +++ b/install.sh @@ -11,12 +11,18 @@ SERVICE_NAME="${APP_NAME}.service" INSTALL_DIR="/usr/local/bin" CONFIG_DIR="/etc/${APP_NAME}" CHURN_DISCOVERY="https://churn.prod.kjuulh.app" +LOG="/var/log/churn-install.log" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' NC='\033[0m' # No Color + +exec > >(tee -i ${LOG}) +exec 2>&1 +echo "Starting churn install $(date)" + # Check if running as root if [ "$EUID" -ne 0 ]; then echo -e "${RED}Please run as root${NC}" @@ -75,12 +81,44 @@ Environment=RUST_LOG=h2=warn,hyper=warn,churn=debug,warn WantedBy=multi-user.target EOF +echo "Creating churn update service..." +cat > "/etc/systemd/system/${SERVICE_NAME}-update" < "/etc/systemd/system/${SERVICE_NAME}-update.timer" <