adding gogs-0.11.86.ebuild

This commit is contained in:
Micha Glave
2019-02-07 15:46:44 +01:00
parent 731b0dc8fa
commit ce87cc9332
4 changed files with 228 additions and 0 deletions

41
www-apps/gogs/files/confd Normal file
View File

@@ -0,0 +1,41 @@
# Apache License 2015
# Path of your config dir
# It will be created upon finishing installation
# custom_config_dir="/etc/gogs/custom"
# Path of gogs data (avatars etc.)
# This will change the location in which repos are stored
workdir="/var/lib/gogs"
# What user and group should Gogs run as?
user="gogs"
group="gogs"
# What arguments should be passed to Gogs?
# Only "web" is supported (to start the server)
# daemon_opts="web"
# Where does Gogs keep configuration files?
# Only for user information messages at the moment
defaultconf="/etc/gogs/conf/app.ini"
#customconf="${custom_config_dir}/app.ini"
# Where should logs be stored?
logfile="/var/log/gogs/gogs.log"
# Where should the PID file be saved while Gogs is running?
# Default is "/run/${SVCNAME}.pid"
# eg "/run/gogs.pid"
#pidfile="/run/gogs.pid"
# How long should we wait for Gogs itself to start?
# Expects a number (in milliseconds)
# Default 500
startwait=500
# What is the maximum wait for start-stop-daemon to create a PID file?
# Expects a number (in milliseconds)
# Default 1000
timeout=1000

72
www-apps/gogs/files/initd Normal file
View File

@@ -0,0 +1,72 @@
#!/sbin/openrc-run
# Apache License 2015
user="${user:-gogs}"
group="${group:-gogs}"
pidfile="${pidfile:-/run/${SVCNAME}.pid}"
daemon_opts="${daemon_opts:-web}"
logfile="${logfile:-/var/log/gogs/gogs.log}"
defaultconf="${defaultconf:-/etc/gogs/conf/app.ini}"
startwait=${startwait:-500}
timeout=${timeout:-1000}
GOGS_CUSTOM="${custom_config_dir:-/etc/gogs/custom}"
GOGS_WORK_DIR="${workdir:-/var/lib/gogs}"
depend() {
need gogs net localmount
use logger mysql pam cert nginx memcache
after bootmisc
}
start_pre() {
if [ ! -r "${customconf}" ] ; then
einfo "Cannot read custom configuration file '${customconf}'"
if [ ! -r "${defaultconf}" ] ; then
eerror "Cannot read default configuration file '${defaultconf}'"
return 1
else
einfo "Falling back to '${defaultconf}'"
customconf="${defaultconf}"
fi
fi
}
start() {
ebegin "Starting ${SVCNAME}"
export GOGS_CUSTOM
export GOGS_WORK_DIR
sh -c "start-stop-daemon \
--start \
--user ${user} \
--group ${group} \
--background \
--make-pidfile \
--pidfile=${pidfile} \
--wait=${startwait} \
--stderr=${logfile} \
--stdout=${logfile} \
--exec /usr/bin/gogs \
-- ${daemon_opts} --config ${customconf} "
local i=0
while [ ! -f ${pidfile} ] && [ $i -le ${timeout} ]; do
sleep 1
i=$(($i + 1000))
done
[ $timeout -gt $i ]
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon \
${DEBUG:+"--verbose"} \
--stop \
--exec /usr/bin/gogs \
--pidfile "${pidfile}"
eend $?
rm -f $PIDFILE
return 0;
}