#!/bin/bash # Exit immediately if a command exits with a non-zero status. set -e # set the local repo location LOCAL_REPO="~/src/ente" INSTALL_DIR="/usr/local/bin/" LIB_DIR="/var/lib/museum/" PORT=1098 cd $LOCAL_REPO/server # sed command to replace `server.Run(":8080")` with `server.Run(":$PORT")` sed -i "s/server.Run(\":8080\")/server.Run(\":$PORT\")/g" cmd/museum/main.go go build -o museum cmd/museum/main.go sudo cp museum $INSTALL_DIR # Create a new user and group named 'museum' sudo groupadd -r museum sudo useradd -r -g museum -d $LIB_DIR -s /sbin/nologin -c "museum user" museum sudo mkdir -p $LIB_DIR sudo cp -r migrations $LIB_DIR sudo cp -r mail-templates $LIB_DIR sudo cp -r configurations $LIB_DIR sudo cp museum.yaml $LIB_DIR sudo chown -R museum:museum $LIB_DIR # Create a new systemd service file for the museum service sudo tee /etc/systemd/system/museum.service > /dev/null <