diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 10 | ||||
-rwxr-xr-x | scripts/gogs_supervisord.sh | 47 | ||||
-rw-r--r-- | scripts/init/debian/gogs | 6 | ||||
-rw-r--r-- | scripts/init/freebsd/gogs | 2 | ||||
-rw-r--r-- | scripts/supervisor/gogs | 16 | ||||
-rw-r--r-- | scripts/systemd/gogs.service | 2 |
6 files changed, 30 insertions, 53 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index ea43bdaf..cf127c2a 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,8 +4,14 @@ rm -rf $outPath mkdir $outPath go build ../gogs.go -chmod +x gogs -mv gogs $outPath/ +PLATFORM=`uname | cut -d _ -f 1` +if [ $PLATFORM = "MINGW32" ] || [ $PLATFORM = "MINGW64" ] || [ $PLATFORM = "CYGWIN" ]; then + GOGS_EXE=gogs.exe +else + GOGS_EXE=gogs +fi +chmod +x $GOGS_EXE +mv $GOGS_EXE $outPath/ cp -r ../conf/ $outPath/conf/ cp -r ../custom/ $outPath/custom/ diff --git a/scripts/gogs_supervisord.sh b/scripts/gogs_supervisord.sh deleted file mode 100755 index 01667584..00000000 --- a/scripts/gogs_supervisord.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -PID="log/supervisord.pid" -CONF="etc/supervisord.conf" - -EXEPATH='/usr/bin/gogs_start' -if [ ! -f $EXEPATH ]; then - gogs_scripts_path=$(cd `dirname $0`; pwd) - echo $gogs_scripts_path - sudo ln -s $gogs_scripts_path'/start.sh' /usr/bin/gogs_start -fi - -LOGDIR="log" -if [ ! -d $LOGDIR ]; then - mkdir $LOGDIR -fi - -stop() { - if [ -f $PID ]; then - kill `cat -- $PID` - rm -f -- $PID - echo "stopped" - fi -} - -start() { - echo "starting" - if [ ! -f $PID ]; then - supervisord -c $CONF - echo "started" - fi -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "Usage: $0 {start|stop|restart}" -esac
\ No newline at end of file diff --git a/scripts/init/debian/gogs b/scripts/init/debian/gogs index 13e8b8aa..b0b52286 100644 --- a/scripts/init/debian/gogs +++ b/scripts/init/debian/gogs @@ -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" } diff --git a/scripts/init/freebsd/gogs b/scripts/init/freebsd/gogs index df13ee0d..e1d3bdee 100644 --- a/scripts/init/freebsd/gogs +++ b/scripts/init/freebsd/gogs @@ -21,7 +21,7 @@ load_rc_config $name : ${gogs_enable:="NO"} : ${gogs_directory:="/home/git"} -command="${gogs_directory}/scripts/start.sh" +command="${gogs_directory}/gogs web" pidfile="${gogs_directory}/${name}.pid" diff --git a/scripts/supervisor/gogs b/scripts/supervisor/gogs new file mode 100644 index 00000000..51531fb7 --- /dev/null +++ b/scripts/supervisor/gogs @@ -0,0 +1,16 @@ +[program:gogs] +directory=/home/git/go/src/github.com/gogits/gogs/ +command=/home/git/go/src/github.com/gogits/gogs/gogs web +autostart=true +autorestart=true +startsecs=10 +stdout_logfile=/var/log/gogs/stdout.log +stdout_logfile_maxbytes=1MB +stdout_logfile_backups=10 +stdout_capture_maxbytes=1MB +stderr_logfile=/var/log/gogs/stderr.log +stderr_logfile_maxbytes=1MB +stderr_logfile_backups=10 +stderr_capture_maxbytes=1MB +user = git +environment = HOME="/home/git", USER="git"
\ No newline at end of file diff --git a/scripts/systemd/gogs.service b/scripts/systemd/gogs.service index 7436e46a..95567eaa 100644 --- a/scripts/systemd/gogs.service +++ b/scripts/systemd/gogs.service @@ -14,7 +14,7 @@ Group=git WorkingDirectory=/home/git/gogs ExecStart=/home/git/gogs/gogs web Restart=always -Environment="USER=git","HOME=/home/git" +Environment=USER=git HOME=/home/git [Install] WantedBy=multi-user.target |