Skip to content

Commit ee963f6

Browse files
authored
Merge pull request #103 from strk/GOGS_drop
Replace GOGS with GITEA in variable names
2 parents 9c434cc + 30be1f4 commit ee963f6

File tree

17 files changed

+142
-126
lines changed

17 files changed

+142
-126
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/go
66
RUN chmod +x /usr/sbin/gosu \
77
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
88

9-
ENV GOGS_CUSTOM /data/gogs
9+
ENV GITEA_CUSTOM /data/gogs
1010

1111
COPY . /app/gogs/
1212
WORKDIR /app/gogs/

Dockerfile.rpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN chmod +x /usr/sbin/gosu \
99
&& apk -U --no-progress upgrade && rm -f /var/cache/apk/APKINDEX.* \
1010
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
1111

12-
ENV GOGS_CUSTOM /data/gogs
12+
ENV GITEA_CUSTOM /data/gogs
1313

1414
COPY . /app/gogs/
1515
WORKDIR /app/gogs/

docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ apk --no-progress del build-deps
3333

3434
# Create git user for Gogs
3535
adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
36-
echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile
36+
echo "export GITEA_CUSTOM=${GITEA_CUSTOM}" >> /etc/profile

docker/s6/gogs/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if ! test -d ~git/.ssh; then
66
fi
77

88
if ! test -f ~git/.ssh/environment; then
9-
echo "GOGS_CUSTOM=${GOGS_CUSTOM}" > ~git/.ssh/environment
9+
echo "GITEA_CUSTOM=${GITEA_CUSTOM}" > ~git/.ssh/environment
1010
chmod 600 ~git/.ssh/environment
1111
fi
1212

models/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLe
2626
type PullRequestType int
2727

2828
const (
29-
PULL_REQUEST_GOGS PullRequestType = iota
30-
PLLL_ERQUEST_GIT
29+
PULL_REQUEST_GITEA PullRequestType = iota
30+
PULL_REQUEST_GIT
3131
)
3232

3333
type PullRequestStatus int

modules/setting/setting.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,18 @@ func init() {
297297

298298
// WorkDir returns absolute path of work directory.
299299
func WorkDir() (string, error) {
300-
wd := os.Getenv("GOGS_WORK_DIR")
300+
wd := os.Getenv("GITEA_WORK_DIR")
301301
if len(wd) > 0 {
302302
return wd, nil
303303
}
304+
// Use GOGS_WORK_DIR if available, for backward compatibility
305+
// TODO: drop in 1.1.0 ?
306+
wd = os.Getenv("GOGS_WORK_DIR")
307+
if len(wd) > 0 {
308+
log.Warn(`Usage of GOGS_WORK_DIR is deprecated and will be *removed* in a future release,
309+
please consider changing to GITEA_WORK_DIR`)
310+
return wd, nil
311+
}
304312

305313
i := strings.LastIndex(AppPath, "/")
306314
if i == -1 {
@@ -341,9 +349,17 @@ func NewContext() {
341349
log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
342350
}
343351

344-
CustomPath = os.Getenv("GOGS_CUSTOM")
352+
CustomPath = os.Getenv("GITEA_CUSTOM")
345353
if len(CustomPath) == 0 {
346-
CustomPath = workDir + "/custom"
354+
// For backward compatibility
355+
// TODO: drop in 1.1.0 ?
356+
CustomPath = os.Getenv("GOGS_CUSTOM")
357+
if len(CustomPath) == 0 {
358+
CustomPath = workDir + "/custom"
359+
} else {
360+
log.Warn(`Usage of GOGS_CUSTOM is deprecated and will be *removed* in a future release,
361+
please consider changing to GITEA_CUSTOM`)
362+
}
347363
}
348364

349365
if len(CustomConf) == 0 {

routers/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
687687
HeadRepo: headRepo,
688688
BaseRepo: repo,
689689
MergeBase: prInfo.MergeBase,
690-
Type: models.PULL_REQUEST_GOGS,
690+
Type: models.PULL_REQUEST_GITEA,
691691
}
692692
// FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
693693
// instead of 500.

scripts/init/centos/gogs renamed to scripts/init/centos/gitea

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# /etc/rc.d/init.d/gogs
3+
# /etc/rc.d/init.d/gitea
44
#
55
# Runs the Gogs Go Git Service.
66
#
@@ -9,47 +9,47 @@
99
#
1010

1111
### BEGIN INIT INFO
12-
# Provides: gogs
12+
# Provides: gitea
1313
# Required-Start: $remote_fs $syslog
1414
# Required-Stop: $remote_fs $syslog
1515
# Default-Start: 2 3 4 5
1616
# Default-Stop: 0 1 6
17-
# Short-Description: Start gogs at boot time.
18-
# Description: Control gogs.
17+
# Short-Description: Start gitea at boot time.
18+
# Description: Control gitea.
1919
### END INIT INFO
2020

2121
# Source function library.
2222
. /etc/init.d/functions
2323

2424
# Default values
2525

26-
NAME=gogs
27-
GOGS_HOME=/home/git/gogs
28-
GOGS_PATH=${GOGS_HOME}/$NAME
29-
GOGS_USER=git
26+
NAME=gitea
27+
GITEA_HOME=/home/git/gitea
28+
GITEA_PATH=${GITEA_HOME}/$NAME
29+
GITEA_USER=git
3030
SERVICENAME="Gogs Go Git Service"
31-
LOCKFILE=/var/lock/subsys/gogs
32-
LOGPATH=${GOGS_HOME}/log
33-
LOGFILE=${LOGPATH}/gogs.log
31+
LOCKFILE=/var/lock/subsys/gitea
32+
LOGPATH=${GITEA_HOME}/log
33+
LOGFILE=${LOGPATH}/gitea.log
3434
RETVAL=0
3535

36-
# Read configuration from /etc/sysconfig/gogs to override defaults
36+
# Read configuration from /etc/sysconfig/gitea to override defaults
3737
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
3838

3939
# Don't do anything if nothing is installed
40-
[ -x ${GOGS_PATH} ] || exit 0
40+
[ -x ${GITEA_PATH} ] || exit 0
4141
# exit if logpath dir is not created.
4242
[ -x ${LOGPATH} ] || exit 0
4343

4444
DAEMON_OPTS="--check $NAME"
4545

4646
# Set additional options, if any
47-
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
47+
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
4848

4949
start() {
50-
cd ${GOGS_HOME}
50+
cd ${GITEA_HOME}
5151
echo -n "Starting ${SERVICENAME}: "
52-
daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
52+
daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
5353
RETVAL=$?
5454
echo
5555
[ $RETVAL = 0 ] && touch ${LOCKFILE}
@@ -58,7 +58,7 @@ start() {
5858
}
5959

6060
stop() {
61-
cd ${GOGS_HOME}
61+
cd ${GITEA_HOME}
6262
echo -n "Shutting down ${SERVICENAME}: "
6363
killproc ${NAME}
6464
RETVAL=$?

scripts/init/debian/gogs renamed to scripts/init/debian/gitea

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
### BEGIN INIT INFO
3-
# Provides: gogs
3+
# Provides: gitea
44
# Required-Start: $syslog $network
55
# Required-Stop: $syslog
66
# Default-Start: 2 3 4 5
@@ -16,11 +16,11 @@
1616
# PATH should only include /usr/* if it runs after the mountnfs.sh script
1717
PATH=/sbin:/usr/sbin:/bin:/usr/bin
1818
DESC="Go Git Service"
19-
NAME=gogs
19+
NAME=gitea
2020
SERVICEVERBOSE=yes
2121
PIDFILE=/var/run/$NAME.pid
2222
SCRIPTNAME=/etc/init.d/$NAME
23-
WORKINGDIR=/home/git/gogs
23+
WORKINGDIR=/home/git/gitea
2424
DAEMON=$WORKINGDIR/$NAME
2525
DAEMON_ARGS="web"
2626
USER=git

scripts/init/freebsd/gitea

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
#
3+
# $FreeBSD$
4+
#
5+
# PROVIDE: gitea
6+
# REQUIRE: NETWORKING SYSLOG
7+
# KEYWORD: shutdown
8+
#
9+
# Add the following lines to /etc/rc.conf to enable gitea:
10+
#
11+
#gitea_enable="YES"
12+
13+
. /etc/rc.subr
14+
15+
name="gitea"
16+
rcvar="gitea_enable"
17+
18+
load_rc_config $name
19+
20+
: ${gitea_user:="git"}
21+
: ${gitea_enable:="NO"}
22+
: ${gitea_directory:="/home/git"}
23+
24+
command="${gitea_directory}/gitea web"
25+
procname="$(echo $command |cut -d' ' -f1)"
26+
27+
pidfile="${gitea_directory}/${name}.pid"
28+
29+
start_cmd="${name}_start"
30+
stop_cmd="${name}_stop"
31+
32+
gitea_start() {
33+
cd ${gitea_directory}
34+
export USER=${gitea_user}
35+
export HOME=/usr/home/${gitea_user}
36+
/usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command
37+
}
38+
39+
gitea_stop() {
40+
if [ ! -f $pidfile ]; then
41+
echo "GITEA PID File not found. Maybe GITEA is not running?"
42+
else
43+
kill $(cat $pidfile)
44+
fi
45+
}
46+
47+
run_rc_command "$1"

scripts/init/freebsd/gogs

Lines changed: 0 additions & 47 deletions
This file was deleted.

scripts/init/openbsd/gitea

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
#
3+
# $OpenBSD$
4+
5+
daemon="/home/git/gitea/gitea"
6+
daemon_user="git"
7+
daemon_flags="web"
8+
9+
gitea_directory="/home/git/gitea"
10+
11+
rc_bg=YES
12+
13+
. /etc/rc.d/rc.subr
14+
15+
rc_start() {
16+
${rcexec} "cd ${gitea_directory}; ${daemon} ${daemon_flags} ${_bg}"
17+
}
18+
19+
rc_cmd $1

scripts/init/openbsd/gogs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)