From 42b9775d5c908b317536e590c3c753a7d662f094 Mon Sep 17 00:00:00 2001 From: konsthol Date: Sun, 15 Dec 2024 14:15:27 +0200 Subject: [PATCH] Oh my god what year is it?! --- setupSingleBinary.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 setupSingleBinary.sh diff --git a/setupSingleBinary.sh b/setupSingleBinary.sh new file mode 100644 index 0000000..4fc0f96 --- /dev/null +++ b/setupSingleBinary.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +mkdir -p app/certs +openssl genrsa -out app/certs/cert.key 2048 +openssl req -new -key app/certs/cert.key -out app/certs/cert.csr -subj "/C=/ST=/L=/O=/OU=/CN=/emailAddress=" +openssl x509 -req -days 365 -in app/certs/cert.csr -signkey app/certs/cert.key -out app/certs/cert.crt + +LOCATION="$(pwd)" + +cat << EOF > $LOCATION/app/.env +# Environment variables +WOL_SECRET_KEY="changethis" +WOL_USER_PASS="changethat" +REDIS_URL="redis://localhost:6379/0" +DEVICE_MAC="00:00:00:00:00:00" +DEVICE_IP="192.168.0.0" +DEVICE_IFACE="eth0" +EOF + +cat << EOF > /etc/systemd/system/wolServer.service +[Unit] +Description=wol-server +After=network.target +[Service] +Type=simple +StandardOutput=journal +StandardError=journal +SyslogIdentifier=%n +User=root +Group=root +WorkingDirectory=$LOCATION/app +EnvironmentFile=$LOCATION/app/.env +ExecStart=$LOCATION/app/wolServer +LimitNOFILE=20000 +Restart=on-failure +RestartSec=3 +[Install] +WantedBy=multi-user.target +EOF + +wget -O app/wolServer +chmod +x app/wolServer + +systemctl daemon-reload +systemctl enable --now wolServer.service