2019-05-26 21:49:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-01 18:08:27 +00:00
|
|
|
#############################################################################
|
|
|
|
# This script sets some defaults for gitea to run in a FHS compliant manner #
|
|
|
|
#############################################################################
|
2019-05-26 21:49:54 +00:00
|
|
|
|
|
|
|
# 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
|
2022-02-10 06:15:06 +00:00
|
|
|
CONF_ARG=("-c" "${GITEA_APP_INI:-$APP_INI}")
|
2019-05-26 21:49:54 +00:00
|
|
|
fi
|
|
|
|
|
2021-12-01 18:08:27 +00:00
|
|
|
# Provide FHS compliant defaults
|
2022-02-10 06:15:06 +00:00
|
|
|
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" exec -a "$0" "$GITEA" "${CONF_ARG[@]}" "$@"
|