mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01:00
Merge pull request #103 from strk/GOGS_drop
Replace GOGS with GITEA in variable names
This commit is contained in:
commit
ee963f67c1
17 changed files with 142 additions and 126 deletions
|
@ -6,7 +6,7 @@ ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/go
|
|||
RUN chmod +x /usr/sbin/gosu \
|
||||
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
|
||||
|
||||
ENV GOGS_CUSTOM /data/gogs
|
||||
ENV GITEA_CUSTOM /data/gogs
|
||||
|
||||
COPY . /app/gogs/
|
||||
WORKDIR /app/gogs/
|
||||
|
|
|
@ -9,7 +9,7 @@ RUN chmod +x /usr/sbin/gosu \
|
|||
&& apk -U --no-progress upgrade && rm -f /var/cache/apk/APKINDEX.* \
|
||||
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
|
||||
|
||||
ENV GOGS_CUSTOM /data/gogs
|
||||
ENV GITEA_CUSTOM /data/gogs
|
||||
|
||||
COPY . /app/gogs/
|
||||
WORKDIR /app/gogs/
|
||||
|
|
|
@ -33,4 +33,4 @@ apk --no-progress del build-deps
|
|||
|
||||
# Create git user for Gogs
|
||||
adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
|
||||
echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile
|
||||
echo "export GITEA_CUSTOM=${GITEA_CUSTOM}" >> /etc/profile
|
||||
|
|
|
@ -6,7 +6,7 @@ if ! test -d ~git/.ssh; then
|
|||
fi
|
||||
|
||||
if ! test -f ~git/.ssh/environment; then
|
||||
echo "GOGS_CUSTOM=${GOGS_CUSTOM}" > ~git/.ssh/environment
|
||||
echo "GITEA_CUSTOM=${GITEA_CUSTOM}" > ~git/.ssh/environment
|
||||
chmod 600 ~git/.ssh/environment
|
||||
fi
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLe
|
|||
type PullRequestType int
|
||||
|
||||
const (
|
||||
PULL_REQUEST_GOGS PullRequestType = iota
|
||||
PLLL_ERQUEST_GIT
|
||||
PULL_REQUEST_GITEA PullRequestType = iota
|
||||
PULL_REQUEST_GIT
|
||||
)
|
||||
|
||||
type PullRequestStatus int
|
||||
|
|
|
@ -297,10 +297,18 @@ func init() {
|
|||
|
||||
// WorkDir returns absolute path of work directory.
|
||||
func WorkDir() (string, error) {
|
||||
wd := os.Getenv("GOGS_WORK_DIR")
|
||||
wd := os.Getenv("GITEA_WORK_DIR")
|
||||
if len(wd) > 0 {
|
||||
return wd, nil
|
||||
}
|
||||
// Use GOGS_WORK_DIR if available, for backward compatibility
|
||||
// TODO: drop in 1.1.0 ?
|
||||
wd = os.Getenv("GOGS_WORK_DIR")
|
||||
if len(wd) > 0 {
|
||||
log.Warn(`Usage of GOGS_WORK_DIR is deprecated and will be *removed* in a future release,
|
||||
please consider changing to GITEA_WORK_DIR`)
|
||||
return wd, nil
|
||||
}
|
||||
|
||||
i := strings.LastIndex(AppPath, "/")
|
||||
if i == -1 {
|
||||
|
@ -341,9 +349,17 @@ func NewContext() {
|
|||
log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
|
||||
}
|
||||
|
||||
CustomPath = os.Getenv("GOGS_CUSTOM")
|
||||
CustomPath = os.Getenv("GITEA_CUSTOM")
|
||||
if len(CustomPath) == 0 {
|
||||
CustomPath = workDir + "/custom"
|
||||
// For backward compatibility
|
||||
// TODO: drop in 1.1.0 ?
|
||||
CustomPath = os.Getenv("GOGS_CUSTOM")
|
||||
if len(CustomPath) == 0 {
|
||||
CustomPath = workDir + "/custom"
|
||||
} else {
|
||||
log.Warn(`Usage of GOGS_CUSTOM is deprecated and will be *removed* in a future release,
|
||||
please consider changing to GITEA_CUSTOM`)
|
||||
}
|
||||
}
|
||||
|
||||
if len(CustomConf) == 0 {
|
||||
|
|
|
@ -687,7 +687,7 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
|
|||
HeadRepo: headRepo,
|
||||
BaseRepo: repo,
|
||||
MergeBase: prInfo.MergeBase,
|
||||
Type: models.PULL_REQUEST_GOGS,
|
||||
Type: models.PULL_REQUEST_GITEA,
|
||||
}
|
||||
// FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
|
||||
// instead of 500.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.d/init.d/gogs
|
||||
# /etc/rc.d/init.d/gitea
|
||||
#
|
||||
# Runs the Gogs Go Git Service.
|
||||
#
|
||||
|
@ -9,13 +9,13 @@
|
|||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gogs
|
||||
# Provides: gitea
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start gogs at boot time.
|
||||
# Description: Control gogs.
|
||||
# Short-Description: Start gitea at boot time.
|
||||
# Description: Control gitea.
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
|
@ -23,33 +23,33 @@
|
|||
|
||||
# Default values
|
||||
|
||||
NAME=gogs
|
||||
GOGS_HOME=/home/git/gogs
|
||||
GOGS_PATH=${GOGS_HOME}/$NAME
|
||||
GOGS_USER=git
|
||||
NAME=gitea
|
||||
GITEA_HOME=/home/git/gitea
|
||||
GITEA_PATH=${GITEA_HOME}/$NAME
|
||||
GITEA_USER=git
|
||||
SERVICENAME="Gogs Go Git Service"
|
||||
LOCKFILE=/var/lock/subsys/gogs
|
||||
LOGPATH=${GOGS_HOME}/log
|
||||
LOGFILE=${LOGPATH}/gogs.log
|
||||
LOCKFILE=/var/lock/subsys/gitea
|
||||
LOGPATH=${GITEA_HOME}/log
|
||||
LOGFILE=${LOGPATH}/gitea.log
|
||||
RETVAL=0
|
||||
|
||||
# Read configuration from /etc/sysconfig/gogs to override defaults
|
||||
# Read configuration from /etc/sysconfig/gitea to override defaults
|
||||
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
|
||||
# Don't do anything if nothing is installed
|
||||
[ -x ${GOGS_PATH} ] || exit 0
|
||||
[ -x ${GITEA_PATH} ] || exit 0
|
||||
# exit if logpath dir is not created.
|
||||
[ -x ${LOGPATH} ] || exit 0
|
||||
|
||||
DAEMON_OPTS="--check $NAME"
|
||||
|
||||
# Set additional options, if any
|
||||
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
|
||||
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
|
||||
|
||||
start() {
|
||||
cd ${GOGS_HOME}
|
||||
cd ${GITEA_HOME}
|
||||
echo -n "Starting ${SERVICENAME}: "
|
||||
daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
|
||||
daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL = 0 ] && touch ${LOCKFILE}
|
||||
|
@ -58,7 +58,7 @@ start() {
|
|||
}
|
||||
|
||||
stop() {
|
||||
cd ${GOGS_HOME}
|
||||
cd ${GITEA_HOME}
|
||||
echo -n "Shutting down ${SERVICENAME}: "
|
||||
killproc ${NAME}
|
||||
RETVAL=$?
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gogs
|
||||
# Provides: gitea
|
||||
# Required-Start: $syslog $network
|
||||
# Required-Stop: $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
|
@ -16,11 +16,11 @@
|
|||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Go Git Service"
|
||||
NAME=gogs
|
||||
NAME=gitea
|
||||
SERVICEVERBOSE=yes
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
WORKINGDIR=/home/git/gogs
|
||||
WORKINGDIR=/home/git/gitea
|
||||
DAEMON=$WORKINGDIR/$NAME
|
||||
DAEMON_ARGS="web"
|
||||
USER=git
|
47
scripts/init/freebsd/gitea
Normal file
47
scripts/init/freebsd/gitea
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# PROVIDE: gitea
|
||||
# REQUIRE: NETWORKING SYSLOG
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf to enable gitea:
|
||||
#
|
||||
#gitea_enable="YES"
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="gitea"
|
||||
rcvar="gitea_enable"
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${gitea_user:="git"}
|
||||
: ${gitea_enable:="NO"}
|
||||
: ${gitea_directory:="/home/git"}
|
||||
|
||||
command="${gitea_directory}/gitea web"
|
||||
procname="$(echo $command |cut -d' ' -f1)"
|
||||
|
||||
pidfile="${gitea_directory}/${name}.pid"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd="${name}_stop"
|
||||
|
||||
gitea_start() {
|
||||
cd ${gitea_directory}
|
||||
export USER=${gitea_user}
|
||||
export HOME=/usr/home/${gitea_user}
|
||||
/usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command
|
||||
}
|
||||
|
||||
gitea_stop() {
|
||||
if [ ! -f $pidfile ]; then
|
||||
echo "GITEA PID File not found. Maybe GITEA is not running?"
|
||||
else
|
||||
kill $(cat $pidfile)
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# PROVIDE: gogs
|
||||
# REQUIRE: NETWORKING SYSLOG
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf to enable gogs:
|
||||
#
|
||||
#gogs_enable="YES"
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="gogs"
|
||||
rcvar="gogs_enable"
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${gogs_user:="git"}
|
||||
: ${gogs_enable:="NO"}
|
||||
: ${gogs_directory:="/home/git"}
|
||||
|
||||
command="${gogs_directory}/gogs web"
|
||||
procname="$(echo $command |cut -d' ' -f1)"
|
||||
|
||||
pidfile="${gogs_directory}/${name}.pid"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd="${name}_stop"
|
||||
|
||||
gogs_start() {
|
||||
cd ${gogs_directory}
|
||||
export USER=${gogs_user}
|
||||
export HOME=/usr/home/${gogs_user}
|
||||
/usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
|
||||
}
|
||||
|
||||
gogs_stop() {
|
||||
if [ ! -f $pidfile ]; then
|
||||
echo "GOGS PID File not found. Maybe GOGS is not running?"
|
||||
else
|
||||
kill $(cat $pidfile)
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
19
scripts/init/openbsd/gitea
Executable file
19
scripts/init/openbsd/gitea
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $OpenBSD$
|
||||
|
||||
daemon="/home/git/gitea/gitea"
|
||||
daemon_user="git"
|
||||
daemon_flags="web"
|
||||
|
||||
gitea_directory="/home/git/gitea"
|
||||
|
||||
rc_bg=YES
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
rc_start() {
|
||||
${rcexec} "cd ${gitea_directory}; ${daemon} ${daemon_flags} ${_bg}"
|
||||
}
|
||||
|
||||
rc_cmd $1
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $OpenBSD$
|
||||
|
||||
daemon="/home/git/gogs/gogs"
|
||||
daemon_user="git"
|
||||
daemon_flags="web"
|
||||
|
||||
gogs_directory="/home/git/gogs"
|
||||
|
||||
rc_bg=YES
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
rc_start() {
|
||||
${rcexec} "cd ${gogs_directory}; ${daemon} ${daemon_flags} ${_bg}"
|
||||
}
|
||||
|
||||
rc_cmd $1
|
|
@ -1,38 +1,38 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# /etc/init.d/gogs
|
||||
# /etc/init.d/gitea
|
||||
#
|
||||
# Runs the Gogs Go Git Service.
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: gogs
|
||||
# Provides: gitea
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start gogs at boot time.
|
||||
# Description: Control gogs.
|
||||
# Short-Description: Start gitea at boot time.
|
||||
# Description: Control gitea.
|
||||
### END INIT INFO
|
||||
|
||||
# Default values
|
||||
|
||||
NAME=gogs
|
||||
GOGS_HOME=/home/git/gogs
|
||||
GOGS_PATH=${GOGS_HOME}/$NAME
|
||||
GOGS_USER=git
|
||||
NAME=gitea
|
||||
GITEA_HOME=/home/git/gitea
|
||||
GITEA_PATH=${GITEA_HOME}/$NAME
|
||||
GITEA_USER=git
|
||||
SERVICENAME="Go Git Service"
|
||||
LOCKFILE=/var/lock/subsys/gogs
|
||||
LOGPATH=${GOGS_HOME}/log
|
||||
LOCKFILE=/var/lock/subsys/gitea
|
||||
LOGPATH=${GITEA_HOME}/log
|
||||
LOGFILE=${LOGPATH}/error.log
|
||||
# gogs creates its own gogs.log from stdout
|
||||
# gitea creates its own gitea.log from stdout
|
||||
RETVAL=0
|
||||
|
||||
# Read configuration from /etc/sysconfig/gogs to override defaults
|
||||
# Read configuration from /etc/sysconfig/gitea to override defaults
|
||||
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
|
||||
# Don't do anything if nothing is installed
|
||||
test -x ${GOGS_PATH} || { echo "$NAME not installed";
|
||||
test -x ${GITEA_PATH} || { echo "$NAME not installed";
|
||||
if [ "$1" = "stop" ]; then exit 0;
|
||||
else exit 5; fi; }
|
||||
|
||||
|
@ -53,12 +53,12 @@ case "$1" in
|
|||
echo -n "Starting ${SERVICENAME} "
|
||||
|
||||
# As we can't use startproc, we have to check ourselves if the service is already running
|
||||
/sbin/checkproc ${GOGS_PATH}
|
||||
/sbin/checkproc ${GITEA_PATH}
|
||||
if [ $? -eq 0 ]; then
|
||||
# return skipped as service is already running
|
||||
(exit 5)
|
||||
else
|
||||
su - ${GOGS_USER} -c "USER=${GOGS_USER} ${GOGS_PATH} web 2>&1 >>${LOGFILE} &"
|
||||
su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &"
|
||||
fi
|
||||
|
||||
# Remember status and be verbose
|
||||
|
@ -70,7 +70,7 @@ case "$1" in
|
|||
|
||||
## Stop daemon with killproc(8) and if this fails
|
||||
## killproc sets the return value according to LSB.
|
||||
/sbin/killproc ${GOGS_PATH}
|
||||
/sbin/killproc ${GITEA_PATH}
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
|
@ -100,7 +100,7 @@ case "$1" in
|
|||
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
|
||||
|
||||
# NOTE: checkproc returns LSB compliant status values.
|
||||
/sbin/checkproc ${GOGS_PATH}
|
||||
/sbin/checkproc ${GITEA_PATH}
|
||||
# NOTE: rc_status knows that we called this init script with
|
||||
# "status" option and adapts its messages accordingly.
|
||||
rc_status -v
|
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>io.gogs.web</string>
|
||||
<string>io.gitea.web</string>
|
||||
<!-- assumes Gogs is running under 'git' account -->
|
||||
<!-- modify below to reflect your settings -->
|
||||
<key>UserName</key>
|
||||
|
@ -12,23 +12,23 @@
|
|||
<string>git</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<!-- assumes Gogs is installed in /Users/git/gogs -->
|
||||
<!-- assumes Gogs is installed in /Users/git/gitea -->
|
||||
<!-- modify below to reflect your settings -->
|
||||
<string>/Users/git/gogs/gogs</string>
|
||||
<string>/Users/git/gitea/gitea</string>
|
||||
<string>web</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<!-- assumes Gogs is installed in /Users/git/gogs -->
|
||||
<!-- assumes Gogs is installed in /Users/git/gitea -->
|
||||
<!-- modify below to reflect your settings -->
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Users/git/gogs/</string>
|
||||
<string>/Users/git/gitea/</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/Users/git/gogs/log/stdout.log</string>
|
||||
<string>/Users/git/gitea/log/stdout.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/Users/git/gogs/log/stderr.log</string>
|
||||
<string>/Users/git/gitea/log/stderr.log</string>
|
||||
<!-- default 256 is too low for Gogs needs using parallel pipes -->
|
||||
<key>SoftResourceLimits</key>
|
||||
<dict>
|
|
@ -1,14 +1,14 @@
|
|||
[program:gogs]
|
||||
[program:gitea]
|
||||
directory=/home/git/go/src/github.com/go-gitea/gitea/
|
||||
command=/home/git/go/src/github.com/go-gitea/gitea/gogs web
|
||||
command=/home/git/go/src/github.com/go-gitea/gitea/gitea web
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=10
|
||||
stdout_logfile=/var/log/gogs/stdout.log
|
||||
stdout_logfile=/var/log/gitea/stdout.log
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stdout_logfile_backups=10
|
||||
stdout_capture_maxbytes=1MB
|
||||
stderr_logfile=/var/log/gogs/stderr.log
|
||||
stderr_logfile=/var/log/gitea/stderr.log
|
||||
stderr_logfile_maxbytes=1MB
|
||||
stderr_logfile_backups=10
|
||||
stderr_capture_maxbytes=1MB
|
|
@ -17,8 +17,8 @@ After=network.target
|
|||
Type=simple
|
||||
User=git
|
||||
Group=git
|
||||
WorkingDirectory=/home/git/gogs
|
||||
ExecStart=/home/git/gogs/gogs web
|
||||
WorkingDirectory=/home/git/gitea
|
||||
ExecStart=/home/git/gitea/gitea web
|
||||
Restart=always
|
||||
Environment=USER=git HOME=/home/git
|
||||
|
Loading…
Reference in a new issue