devel/gogs: Changed user from gogs to git; Moved ini file under /usr/local/etc

PR:		224113
Submitted by:	Dmitri Goutnik <dg@syrec.org> (maintainer)
Approved by:	adamw (mentor)
Differential Revision:	https://reviews.freebsd.org/D13469
This commit is contained in:
Yuri Victorovich 2017-12-18 23:57:06 +00:00
parent 857f98b9e4
commit 80c876d85e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=456695
10 changed files with 54 additions and 24 deletions

1
GIDs
View file

@ -150,7 +150,6 @@ gnugk:*:205:
gini:*:206:
_mixminion:*:207:
_dnsdist:*:208:
gogs:*:209:
shoutcast:*:210:
git:*:211:
hg:*:212:

1
UIDs
View file

@ -155,7 +155,6 @@ gnugk:*:205:205::0:0:GNU GateKeeper pseudo-user:/nonexistent:/usr/sbin/nologin
gini:*:206:206::0:0:& streaming server:/var/log/gini:/usr/sbin/nologin
_mixminion:*:207:207::0:0:Mixminion server:/nonexistent:/usr/sbin/nologin
_dnsdist:*:208:208::0:0:dnsdist user:/nonexistent:/usr/sbin/nologin
gogs:*:209:209::0:0:gogs user:/var/db/gogs/home:/bin/sh
shoutcast:*:210:210::0:0:Shoutcast sandbox:/nonexistent:/bin/sh
git:*:211:211::0:0:gitosis user:/usr/local/git:/bin/sh
hg:*:212:212::0:0:mercurial-server user:/usr/local/hg:/bin/sh

View file

@ -5,6 +5,25 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20171218:
AFFECTS: users of devel/gogs
AUTHOR: dg@syrec.org
Gogs user has been changed to "git" and configuration files are now
located in /usr/local/etc/gogs. Users should update ownership of the
existing Gogs directories with
# chown -R git:git /var/db/gogs
# chown -R git:git /var/log/gogs
and either move or merge the contents of /var/db/gogs/home/.ssh with
/usr/local/git/.ssh. After migration, /var/db/gogs/home can be removed,
and both the user "gogs" and the group "gogs" should be deleted:
# rm -rf /var/db/gogs/home
# pw userdel gogs
# pw groupdel gogs
20171215:
AFFECTS: users of finance/gnucash
AUTHOR: madpilot@FreeBSD.org

View file

@ -3,6 +3,7 @@
PORTNAME= gogs
DISTVERSIONPREFIX= v
DISTVERSION= 0.11.34
PORTREVISION= 1
CATEGORIES= devel www
MAINTAINER= dg@syrec.org
@ -20,8 +21,8 @@ GH_SUBDIR= src/github.com/${GH_ACCOUNT}/${PORTNAME}
OPTIONS_DEFINE= DOCS
USERS= gogs
GROUPS= gogs
USERS= git
GROUPS= git
GOGS_DBDIR?= /var/db/gogs
GOGS_LOGDIR?= /var/log/gogs
@ -31,8 +32,7 @@ SUB_FILES= gogs \
gogs-service \
gogs-rm-data \
pkg-message
SUB_LIST= PREFIX=${PREFIX} \
PORTNAME=${PORTNAME} \
SUB_LIST= PORTNAME=${PORTNAME} \
PORTNAME_FANCY=${PORTNAME_FANCY} \
GOGS_USER=${USERS} \
GOGS_DBDIR=${GOGS_DBDIR} \
@ -45,9 +45,12 @@ PLIST_SUB= GOGS_USER=${USERS} \
PORTDOCS= README.md
post-patch:
@${REINPLACE_CMD} -i '' \
-e 's|^ROOT =$$|ROOT = ${GOGS_DBDIR}/repositories|' \
@${REINPLACE_CMD} \
-e '/^# \!\!\!/d' \
-e 's|^RUN_USER = git$$|RUN_USER = ${USERS}|' \
-e 's|^RUN_MODE = dev$$|RUN_MODE = prod|' \
-e 's|^ROOT =$$|ROOT = ${GOGS_DBDIR}/repositories|' \
-e 's|^ROOT_PATH =$$|ROOT_PATH = ${GOGS_LOGDIR}|' \
-e 's|^DB_TYPE = mysql$$|DB_TYPE = sqlite3|' \
${WRKSRC}/conf/app.ini
@ -62,10 +65,11 @@ do-install:
${INSTALL_SCRIPT} ${WRKDIR}/gogs-rm-data ${STAGEDIR}${PREFIX}/bin/
${INSTALL_SCRIPT} ${WRKDIR}/gogs-service ${STAGEDIR}${PREFIX}/etc/rc.d/gogs
@(cd ${WRKSRC} && ${COPYTREE_SHARE} "conf public templates" ${STAGEDIR}${PREFIX}/libexec/${PORTNAME})
@${MKDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/custom/conf
${INSTALL_DATA} ${WRKSRC}/conf/app.ini ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/custom/conf/
@${MKDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/custom/https
@${MKDIR} ${STAGEDIR}${GOGS_DBDIR}/data ${STAGEDIR}${GOGS_DBDIR}/repositories ${STAGEDIR}${GOGS_DBDIR}/home
@${MKDIR} ${STAGEDIR}${ETCDIR}/conf
@${MKDIR} ${STAGEDIR}${ETCDIR}/https
${INSTALL_DATA} ${WRKSRC}/conf/app.ini ${STAGEDIR}${ETCDIR}/conf/app.ini.sample
@${RLN} ${STAGEDIR}${ETCDIR} ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/custom
@${MKDIR} ${STAGEDIR}${GOGS_DBDIR}/data ${STAGEDIR}${GOGS_DBDIR}/repositories
@${LN} -sf ${GOGS_DBDIR}/data ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/data
@${MKDIR} ${STAGEDIR}${GOGS_LOGDIR}
@${LN} -sf ${GOGS_LOGDIR} ${STAGEDIR}/${PREFIX}/libexec/${PORTNAME}/log

View file

@ -17,5 +17,4 @@ while true; do
esac
done
rm -rf %%GOGS_DBDIR%%/*/* %%GOGS_DBDIR%%/*/.ssh \
%%GOGS_LOGDIR%%/* /var/log/gogs.log
rm -rf %%GOGS_DBDIR%%/*/* %%GOGS_LOGDIR%%/* /var/log/gogs.log

View file

@ -24,6 +24,7 @@ stop_cmd="%%PORTNAME%%_stop"
load_rc_config ${name}
: ${%%PORTNAME%%_enable="NO"}
: ${%%PORTNAME%%_config="%%ETCDIR%%/conf/app.ini"}
is_process_running() {
local pidfile=$1
@ -43,11 +44,11 @@ stop_daemon() {
return 1
fi
export USER=%%GOGS_USER%%
export HOME=$(getent passwd %%GOGS_USER%% | cut -d: -f6)
export HOME=$(echo ~%%GOGS_USER%%)
touch $logfile
chmod 640 $logfile
cd %%PREFIX%%/libexec/%%PORTNAME%%
/usr/sbin/daemon -P $pidfile -u %%GOGS_USER%% %%PREFIX%%/libexec/%%PORTNAME%%/%%PORTNAME%% web >>$logfile 2>&1
/usr/sbin/daemon -P $pidfile -u %%GOGS_USER%% %%PREFIX%%/libexec/%%PORTNAME%%/%%PORTNAME%% web --config ${%%PORTNAME%%_config} >>$logfile 2>&1
if is_process_running $pidfile; then
echo "started %%PORTNAME%% (pid=$(cat $pidfile))"
else

View file

@ -2,5 +2,5 @@
cd %%PREFIX%%/libexec/%%PORTNAME%% &&
USER=%%GOGS_USER%% \
HOME=$(getent passwd %%GOGS_USER%% | cut -d: -f6) \
su -m %%GOGS_USER%% -c './%%PORTNAME%% web'
HOME=$(echo ~%%GOGS_USER%%) \
su -m %%GOGS_USER%% -c './%%PORTNAME%% web --config %%ETCDIR%%/conf/app.ini'

View file

@ -1,4 +1,4 @@
--- templates/install.tmpl.orig 2017-11-17 23:20:54 UTC
--- templates/install.tmpl.orig 2017-11-22 19:46:14 UTC
+++ templates/install.tmpl
@@ -8,12 +8,9 @@
<div class="ui attached segment">
@ -37,3 +37,12 @@
<label for="run_user">{{.i18n.Tr "install.run_user"}}</label>
<input id="run_user" name="run_user" value="{{.run_user}}" required>
<span class="help">{{.i18n.Tr "install.run_user_helper"}}</span>
@@ -115,7 +112,7 @@
<input id="app_url" name="app_url" value="{{.app_url}}" placeholder="e.g. https://try.gogs.io" required>
<span class="help">{{.i18n.Tr "install.app_url_helper"}}</span>
</div>
- <div class="inline required field">
+ <div class="disabled inline required field">
<label for="log_root_path">{{.i18n.Tr "install.log_root_path"}}</label>
<input id="log_root_path" name="log_root_path" value="{{.log_root_path}}" placeholder="log" required>
<span class="help">{{.i18n.Tr "install.log_root_path_helper"}}</span>

View file

@ -13,7 +13,7 @@ You can also run %%PORTNAME%% manually with a command:
Connect to %%PORTNAME%% on the default port 3000:
http://localhost:3000
Configuration file is %%PREFIX%%/libexec/%%PORTNAME%%/custom/conf/app.ini.
Configuration file is %%ETCDIR%%/conf/app.ini.
You can only edit it when %%PORTNAME%% isn't running.
%%PORTNAME_FANCY%% needs an SSH daemon, so make sure sure you execute:

View file

@ -1,6 +1,8 @@
bin/gogs
bin/gogs-rm-data
@(%%GOGS_USER%%,%%GOGS_GROUP%%,640) libexec/gogs/custom/conf/app.ini
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%ETCDIR%%/conf
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%ETCDIR%%/https
@sample(%%GOGS_USER%%,%%GOGS_GROUP%%,640) %%ETCDIR%%/conf/app.ini.sample
etc/rc.d/gogs
libexec/gogs/conf/app.ini
libexec/gogs/conf/gitignore/Actionscript
@ -232,6 +234,7 @@ libexec/gogs/conf/locale/locale_zh-TW.ini
libexec/gogs/conf/locale/TRANSLATORS
libexec/gogs/conf/README.md
libexec/gogs/conf/readme/Default
libexec/gogs/custom
libexec/gogs/data
libexec/gogs/gogs
libexec/gogs/log
@ -1719,10 +1722,7 @@ libexec/gogs/templates/user/settings/security.tmpl
libexec/gogs/templates/user/settings/sshkeys.tmpl
libexec/gogs/templates/user/settings/two_factor_enable.tmpl
libexec/gogs/templates/user/settings/two_factor_recovery_codes.tmpl
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) libexec/gogs/custom/conf
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) libexec/gogs/custom/https
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%GOGS_DBDIR%%/data
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%GOGS_DBDIR%%/home
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%GOGS_DBDIR%%/repositories
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%GOGS_DBDIR%%
@dir(%%GOGS_USER%%,%%GOGS_GROUP%%,750) %%GOGS_LOGDIR%%