3 changed files with 288 additions and 0 deletions
@ -0,0 +1,52 @@
|
||||
## |
||||
## app.ini -- Gogs global configuration |
||||
## |
||||
|
||||
APP_NAME = Gogs: Git Repository Hosting Service |
||||
RUN_USER = @l_rusr@ |
||||
RUN_MODE = prod |
||||
|
||||
[repository] |
||||
ROOT = @l_prefix@/var/gogs/repo |
||||
|
||||
[server] |
||||
PROTOCOL = http |
||||
DOMAIN = localhost |
||||
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/ |
||||
HTTP_ADDR = 127.0.0.1 |
||||
HTTP_PORT = 3000 |
||||
DISABLE_SSH = true |
||||
STATIC_ROOT_PATH = @l_prefix@/share/gogs |
||||
ENABLE_GZIP = true |
||||
|
||||
[database] |
||||
DB_TYPE = sqlite3 |
||||
HOST = |
||||
NAME = |
||||
USER = |
||||
PASSWD = |
||||
PATH = @l_prefix@/var/gogs/db/gogs.db |
||||
|
||||
[admin] |
||||
|
||||
[security] |
||||
INSTALL_LOCK = false |
||||
SECRET_KEY = !#@FDEWREWR&*( |
||||
|
||||
[service] |
||||
REGISTER_EMAIL_CONFIRM = false |
||||
DISABLE_REGISTRATION = false |
||||
REQUIRE_SIGNIN_VIEW = false |
||||
|
||||
[mailer] |
||||
ENABLED = false |
||||
SUBJECT = %(APP_NAME)s |
||||
HOST = localhost:22 |
||||
FROM = "Gogs" <gogs@example.com> |
||||
|
||||
[log] |
||||
ROOT_PATH = @l_prefix@/var/gogs/log |
||||
MODE = file |
||||
BUFFER_LEN = 10000 |
||||
LEVEL = Trace |
||||
|
||||
@ -0,0 +1,173 @@
|
||||
## |
||||
## gogs.spec -- OpenPKG RPM Package Specification |
||||
## Copyright (c) 2000-2015 OpenPKG Foundation e.V. <http://openpkg.net/> |
||||
## |
||||
## Permission to use, copy, modify, and distribute this software for |
||||
## any purpose with or without fee is hereby granted, provided that |
||||
## the above copyright notice and this permission notice appear in all |
||||
## copies. |
||||
## |
||||
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
||||
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||||
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||||
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
||||
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||||
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
||||
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
||||
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
## SUCH DAMAGE. |
||||
## |
||||
|
||||
# package information |
||||
%define V_gogs_base 0.5.13 |
||||
%define V_gogs_snap 20150316 |
||||
|
||||
# package information |
||||
Name: gogs |
||||
Summary: Git Hosting Service |
||||
URL: http://gogs.io/ |
||||
Vendor: GoGits |
||||
Packager: OpenPKG Foundation e.V. |
||||
Distribution: OpenPKG Community |
||||
Class: EVAL |
||||
Group: Database |
||||
License: MIT |
||||
Version: %{V_gogs_base} |
||||
Release: 20150316 |
||||
|
||||
# list of sources |
||||
Source0: http://download.openpkg.org/components/versioned/gogs/gogs-%{V_gogs_snap}.tar.xz |
||||
Source1: rc.gogs |
||||
Source2: app.ini |
||||
|
||||
# build information |
||||
BuildPreReq: OpenPKG, openpkg >= 20140101, go |
||||
PreReq: OpenPKG, openpkg >= 20140101 |
||||
PreReq: git |
||||
|
||||
%description |
||||
Gogs is a hosting service for the Git version control system. |
||||
|
||||
%track |
||||
prog gogs = { |
||||
version = %{V_gogs_snap} |
||||
url = https://github.com/gogits/gogs/releases |
||||
regex = v(__VER__)\.tar\.gz |
||||
} |
||||
|
||||
%prep |
||||
%setup -q -n gogs |
||||
|
||||
%build |
||||
# build program |
||||
( export GOPATH=`pwd` |
||||
cd $GOPATH/src/github.com/gogits/gogs |
||||
go build -tags "sqlite" -x -o gogs |
||||
) || exit $? |
||||
|
||||
# remove spaces from filenames |
||||
( cd src/github.com/gogits/gogs/conf/license |
||||
mv "Mozilla Public License Version 2.0" MPL-2.0 |
||||
mv "CC0 1.0 Universal" CC0-1.0 |
||||
mv "MIT License" MIT |
||||
mv "BSD license" BSD |
||||
mv "GPL v2" GPL-2.0 |
||||
mv "Eclipse Public License v1.0" EPL-1.0 |
||||
mv "Affero GPL" AGPL-3.0 |
||||
mv "LGPL v2.1" LGPL-2.1 |
||||
mv "Apache v2 License" Apache-2.0 |
||||
mv "LGPL v3" LGPL-3.0 |
||||
mv "BSD (3-Clause) License" BSD-3C |
||||
mv "ISC license" ISC |
||||
mv "Artistic License 2.0" Artistic-2.0 |
||||
mv "GPL v3" GPL-3.0 |
||||
) || exit $? |
||||
( cd src/github.com/gogits/gogs/conf/gitignore |
||||
mv "C Sharp" "C-Sharp" |
||||
mv "Google Go" "Google-Go" |
||||
) || exit $? |
||||
|
||||
%install |
||||
# create directory hierarchy |
||||
%{l_shtool} mkdir -f -p -m 755 \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/bin \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/sbin \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/etc/gogs \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/custom/conf \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/run \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/log \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/tmp \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/db \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/data \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/var/gogs/repo |
||||
|
||||
# install program |
||||
%{l_shtool} install -c -s -m 755 \ |
||||
src/github.com/gogits/gogs/gogs \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/sbin/ |
||||
|
||||
# install run-time files |
||||
( cd src/github.com/gogits/gogs |
||||
cp -r conf public templates \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/ |
||||
) || exit $? |
||||
|
||||
# install default configuration |
||||
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
||||
%{SOURCE app.ini} \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/etc/gogs/ |
||||
|
||||
# provide links to final location |
||||
ln -s ../../../../etc/gogs/app.ini \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/custom/conf/app.ini |
||||
ln -s ../../var/gogs/data \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/data |
||||
ln -s ../../sbin/gogs \ |
||||
$RPM_BUILD_ROOT%{l_prefix}/share/gogs/gogs |
||||
|
||||
# install run-command script |
||||
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
||||
%{SOURCE rc.gogs} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
||||
|
||||
# determine installation files |
||||
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
||||
%{l_files_std} \ |
||||
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/gogs/*' \ |
||||
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/gogs/*' \ |
||||
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/gogs/*/*' |
||||
|
||||
%files -f files |
||||
|
||||
%clean |
||||
|
||||
%post |
||||
# after upgrade, restart service |
||||
if [ $1 -eq 1 ]; then |
||||
# display information about next steps |
||||
( echo "After starting Gogs with" |
||||
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc gogs start" |
||||
echo "you should configure it by visiting:" |
||||
echo " http://localhost:3000/" |
||||
) | %{l_rpmtool} msg -b -t notice |
||||
elif [ $1 -eq 2 ] || exit 0 |
||||
eval `%{l_rc} gogs status 2>/dev/null` |
||||
[ ".$gogs_active" = .yes ] && %{l_rc} gogs restart |
||||
fi |
||||
exit 0 |
||||
|
||||
%preun |
||||
# before erase, stop service and remove log files |
||||
[ $1 -eq 0 ] || exit 0 |
||||
%{l_rc} gogs stop 2>/dev/null |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/log/* >/dev/null 2>&1 || true |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/run/* >/dev/null 2>&1 || true |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/tmp/* >/dev/null 2>&1 || true |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/db/* >/dev/null 2>&1 || true |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/repo/* >/dev/null 2>&1 || true |
||||
rm -rf $RPM_INSTALL_PREFIX/var/gogs/data/* >/dev/null 2>&1 || true |
||||
exit 0 |
||||
|
||||
@ -0,0 +1,63 @@
|
||||
#!@l_prefix@/bin/openpkg rc |
||||
## |
||||
## rc.gogs -- Run-Commands |
||||
## |
||||
|
||||
%config |
||||
gogs_enable="$openpkg_rc_def" |
||||
gogs_flags="" |
||||
gogs_log_prolog="true" |
||||
gogs_log_epilog="true" |
||||
gogs_log_numfiles="10" |
||||
gogs_log_minsize="1M" |
||||
gogs_log_complevel="9" |
||||
|
||||
%common |
||||
gogs_cfgfile="@l_prefix@/etc/gogs/app.ini" |
||||
gogs_pidfile="@l_prefix@/var/gogs/run/gogs.pid" |
||||
gogs_logfile="@l_prefix@/var/gogs/log/gogs.log" |
||||
gogs_signal () { |
||||
[ -f $gogs_pidfile ] && kill -$1 `cat $gogs_pidfile` |
||||
} |
||||
|
||||
%status -u @l_rusr@ -o |
||||
gogs_usable="unknown" |
||||
gogs_active="no" |
||||
rcService gogs enable yes && \ |
||||
gogs_signal 0 && gogs_active="yes" |
||||
echo "gogs_enable=\"$gogs_enable\"" |
||||
echo "gogs_usable=\"$gogs_usable\"" |
||||
echo "gogs_active=\"$gogs_active\"" |
||||
|
||||
%start -u @l_rusr@ |
||||
rcService gogs enable yes || exit 0 |
||||
rcService gogs active yes && exit 0 |
||||
( cd @l_prefix@/share/gogs |
||||
PATH=@l_prefix@/bin:$PATH; export PATH |
||||
HOME=@l_prefix@/var/gogs/tmp; export HOME |
||||
nohup @l_prefix@/share/gogs/gogs web --config "$gogs_cfgfile" $gogs_flags \ |
||||
</dev/null >>$gogs_logfile 2>&1 & |
||||
echo $! >$gogs_pidfile |
||||
) >/dev/null 2>&1 |
||||
|
||||
%stop -u @l_rusr@ |
||||
rcService gogs enable yes || exit 0 |
||||
rcService gogs active no && exit 0 |
||||
gogs_signal TERM |
||||
sleep 2 |
||||
rm -f $gogs_pidfile >/dev/null 2>&1 || true |
||||
|
||||
%restart -u @l_rusr@ |
||||
rcService gogs enable yes || exit 0 |
||||
rcService gogs active no && exit 0 |
||||
rc gogs stop start |
||||
|
||||
%daily -u @l_rusr@ |
||||
rcService gogs enable yes || exit 0 |
||||
shtool rotate -f \ |
||||
-n ${gogs_log_numfiles} -s ${gogs_log_minsize} -d \ |
||||
-z ${gogs_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ |
||||
-P "${gogs_log_prolog}" \ |
||||
-E "${gogs_log_epilog}; rc gogs restart" \ |
||||
$gogs_logfile |
||||
|
||||
Loading…
Reference in new issue