gitea/run

31 lines
1015 B
Bash
Executable File

#!/bin/bash
DEPLOY=${1:-default}
declare -A ARCHES
ARCHES=(["x86_64"]="amd64" ["arm32"]="arm32" ["armhf"]="arm32" ["arm64"]="arm64" ["aarch64"]="arm64" )
ARCH=$(arch)
if [ -z "${ARCHES[$ARCH]}" ]; then
echo Your machine kernel architecture $ARCH is not supported by this script, aborting
exit 1
fi
DIR=$(dirname "$(readlink -f "$0")") || exit
ARCH=$(arch)
# echo $ARCH ${ARCHES[$ARCH]}
BIN="$DIR/bin/gitea.${ARCHES[$ARCH]}"
# echo $ARCH ${ARCHES[$ARCH]} $BIN
if [ ! -f $BIN ]; then
echo $ARCH/${ARCHES[$ARCH]} gitea binary is not available in $BIN, run ./bin/update script
exit 1
fi
INI="$DIR/config/$DEPLOY.ini"
mkdir -p $DIR/frontend/current
rsync -a --delete $DIR/frontend/default/ $DIR/frontend/current
rsync -a $DIR/frontend/$DEPLOY/ $DIR/frontend/current
export GITEA_WORK_DIR=/mnt/data/git-server
export GITEA_CUSTOM=$DIR/frontend/current
export USER=sysadmin
export HOME=/home/sysadmin
# where data and repo are located
# export -p | grep GITEA
echo Running: $BIN web -c $INI
$BIN web -c $INI