aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-09-30 21:39:12 -0400
committer无闻 <joe2010xtmf@163.com>2014-09-30 21:39:12 -0400
commit3ffa17c49a41f24492fc3c8d80854e5a5a0b3a34 (patch)
treef5d10c83eb3d7562efef30fe8d57106c25f481d5 /scripts
parent2a031c13658458df9f8f56ce295a8ba72bf35dff (diff)
parent98c719c342d796e4e651270ca4a43523df721251 (diff)
downloadgitea-3ffa17c49a41f24492fc3c8d80854e5a5a0b3a34.tar.gz
gitea-3ffa17c49a41f24492fc3c8d80854e5a5a0b3a34.zip
Merge pull request #519 from silverkorn/dev
Debian's "init.d" - Tentative to fix user's environment variables loading
Diffstat (limited to 'scripts')
-rw-r--r--scripts/init/debian/gogs13
1 files changed, 4 insertions, 9 deletions
diff --git a/scripts/init/debian/gogs b/scripts/init/debian/gogs
index b82df1de57..13e8b8aa5b 100644
--- a/scripts/init/debian/gogs
+++ b/scripts/init/debian/gogs
@@ -31,11 +31,6 @@ USER=git
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
-# Prepare the starting daemon command depending on available non-mandatory variables
-STARTDEAMONEVALOPTS=""
-[ ! -z "$USER" ] && STARTDEAMONEVALOPTS="$STARTDEAMONEVALOPTS --chuid $USER "
-[ ! -z "$WORKINGDIR" ] && STARTDEAMONEVALOPTS="$STARTDEAMONEVALOPTS --chdir \"$WORKINGDIR\" "
-
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
@@ -54,10 +49,10 @@ do_start()
# 1 if daemon was already running
# 2 if daemon could not be started
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
- $STARTDEAMONEVALOPTS --exec $DAEMON -- $DAEMON_ARGS --test > /dev/null \\
+ --exec $DAEMON -- $DAEMON_ARGS --test > /dev/null \\
|| return 1"
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
- $STARTDEAMONEVALOPTS --background --exec $DAEMON -- $DAEMON_ARGS \\
+ --background --exec /bin/su -- - $USER -c \"cd \\\"$WORKINGDIR\\\" && $DAEMON -- $DAEMON_ARGS\" \\
|| return 2"
}
@@ -71,10 +66,10 @@ do_stop()
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name $NAME
+ start-stop-daemon --stop --quiet --retry=TERM/1/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
- start-stop-daemon --stop --quiet --oknodo --retry=0/10/KILL/5 --exec $DAEMON
+ start-stop-daemon --stop --quiet --oknodo --retry=0/1/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE