]> source.dussan.org Git - gitea.git/commitdiff
fix debian init script
authorBjörn <bo@kbct.de>
Wed, 13 May 2015 12:15:05 +0000 (14:15 +0200)
committerBjörn <bo@kbct.de>
Thu, 4 Jun 2015 11:15:00 +0000 (13:15 +0200)
- use start-stop-daemon's chuid feature insted of su
  - using `su -c` breaks if the git user has no usable shell
  - this fixes #1025
- put --test before --exec, instead it gets passed to gogs
- set cwd via --chdir

scripts/init/debian/gogs

index 13e8b8aa5b893447bf492d809f271567fed484f7..b0b52286fcf538e0cf1df28bbdef26864c195d0a 100644 (file)
@@ -49,10 +49,12 @@ 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 \\
-                       --exec $DAEMON -- $DAEMON_ARGS --test > /dev/null \\
+                       --test --chdir $WORKINGDIR --chuid $USER \\
+                       --exec $DAEMON -- $DAEMON_ARGS > /dev/null \\
                        || return 1"
        sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
-                       --background --exec /bin/su -- - $USER -c \"cd \\\"$WORKINGDIR\\\" && $DAEMON -- $DAEMON_ARGS\" \\
+                       --background --chdir $WORKINGDIR --chuid $USER \\
+                       --exec $DAEMON -- $DAEMON_ARGS \\
                        || return 2"
 }