summaryrefslogtreecommitdiffstats
path: root/contrib/init
diff options
context:
space:
mode:
authorYISH <mokeyish@hotmail.com>2022-03-09 06:58:14 +0800
committerGitHub <noreply@github.com>2022-03-08 17:58:14 -0500
commitddf7f1319f70e124acfd1e8e86dff4ff87290f51 (patch)
treeaeb76622d5ed404c2abb31588da91974c88b2e3c /contrib/init
parenteceab9e26f671318d3b50e622736a514f384aee6 (diff)
downloadgitea-ddf7f1319f70e124acfd1e8e86dff4ff87290f51.tar.gz
gitea-ddf7f1319f70e124acfd1e8e86dff4ff87290f51.zip
Fix script compatiable with OpenWrt (#19000)
* Fix compatibility of upgrade.sh in openwrt and add service init script for openwrt. * Apply suggestions from code review Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: zeripath <art27@cantab.net> * Update contrib/upgrade.sh Co-authored-by: Norwin <noerw@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Norwin <noerw@users.noreply.github.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'contrib/init')
-rw-r--r--contrib/init/openwrt/gitea35
1 files changed, 35 insertions, 0 deletions
diff --git a/contrib/init/openwrt/gitea b/contrib/init/openwrt/gitea
new file mode 100644
index 0000000000..67b4495ff8
--- /dev/null
+++ b/contrib/init/openwrt/gitea
@@ -0,0 +1,35 @@
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+
+# PROCD_DEBUG=1
+
+START=90
+STOP=10
+
+PROG=/opt/gitea/gitea
+GITEA_WORK_DIR=/opt/gitea
+CONF_FILE=$GITEA_WORK_DIR/app.ini
+
+start_service(){
+ procd_open_instance gitea
+ procd_set_param env GITEA_WORK_DIR=$GITEA_WORK_DIR
+ procd_set_param env HOME=$GITEA_WORK_DIR
+ procd_set_param command $PROG web -c $CONF_FILE
+ procd_set_param file $CONF_FILE
+ procd_set_param user git
+ procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} # respawn automatically if something died, be careful if you have an alternative process supervisor
+ procd_close_instance
+}
+
+start(){
+ service_start $PROG
+}
+
+stop(){
+ service_stop $PROG
+}
+
+reload(){
+ service_reload $PROG
+}