summaryrefslogtreecommitdiffstats
path: root/contrib/fhs-compliant-script/gitea
blob: ea033b0f2d8f8702ad239bb4123178011f89d76d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

#############################################################################
# This script sets some defaults for gitea to run in a FHS compliant manner #
#############################################################################

# It assumes that you place this script as gitea in /usr/bin
#
# And place the original in /usr/lib/gitea with working files in /var/lib/gitea
# and main configuration in /etc/gitea/app.ini
GITEA="/usr/lib/gitea/gitea"
WORK_DIR="/var/lib/gitea"
APP_INI="/etc/gitea/app.ini"

APP_INI_SET=""
for i in "$@"; do
	case "$i" in
	"-c")
		APP_INI_SET=1
		;;
	"-c="*)
		APP_INI_SET=1
		;;
	"--config")
		APP_INI_SET=1
		;;
	"--config="*)
		APP_INI_SET=1
		;;
	*)
	;;
	esac
done

if [ -z "$APP_INI_SET" ]; then
	CONF_ARG=("-c" "${GITEA_APP_INI:-$APP_INI}")
fi

# Provide FHS compliant defaults
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" exec -a "$0" "$GITEA" "${CONF_ARG[@]}"  "$@"