summaryrefslogtreecommitdiffstats
path: root/contrib/fhs-compliant-script
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
committerDaniel Baumann <daniel@debian.org>2024-12-12 23:57:56 +0100
commite68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch)
tree97775d6c13b0f416af55314eb6a89ef792474615 /contrib/fhs-compliant-script
parentInitial commit. (diff)
downloadforgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz
forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rwxr-xr-xcontrib/fhs-compliant-script/gitea40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/fhs-compliant-script/gitea b/contrib/fhs-compliant-script/gitea
new file mode 100755
index 0000000..ea033b0
--- /dev/null
+++ b/contrib/fhs-compliant-script/gitea
@@ -0,0 +1,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[@]}" "$@"