mirror of https://github.com/gogits/gogs.git
T.J. Yang
9 years ago
3 changed files with 158 additions and 0 deletions
@ -0,0 +1,50 @@
|
||||
RPM=rpm
|
||||
|
||||
ALL=$(RPM)
|
||||
|
||||
WDIR=$(HOME)
|
||||
##############################################################################
|
||||
# standard targets (all, clean, distclean, devclean, install)
|
||||
|
||||
all: $(ALL) |
||||
|
||||
clean: |
||||
find .. -type f -name "*~" -exec rm -f {} \;
|
||||
(rm -rf $(WDIR)/rpmbuild/RPMS/x86_64/gogs-0.9-20.x86_64.rpm \
|
||||
$(WDIR)/rpmbuild/SRPMS/gogs-0.9-20.src.rpm \
|
||||
../gogs-0.9.20.tar.gz)
|
||||
|
||||
|
||||
# rpm making automation for CentOS/RHEL.
|
||||
ARCH ?= $(shell arch)
|
||||
ifeq ($(ARCH),x86_64) |
||||
RPM_ARCH := x86_64
|
||||
else |
||||
ifeq ($(ARCH),i686)
|
||||
RPM_ARCH := i386
|
||||
else
|
||||
$(error Unknown arch "$(ARCH)".) |
||||
endif
|
||||
endif |
||||
|
||||
# RPM_ARCH := noarch
|
||||
rpm: |
||||
# @create gogs tar ball.
|
||||
(cd ..;rm -f gogs-0.9.20)
|
||||
(cd ..;ln -s . gogs-0.9.20)
|
||||
(cd ..;tar zhcf gogs-0.9.20.tar.gz --exclude gogs-0.9.20/gogs-0.9.20.tar.gz --exclude gogs-0.9.20/gogs-0.9.20 --exclude RCS --exclude CVS --exclude build-* --exclude *~ --exclude .git* gogs-0.9.20/)
|
||||
(cd ..;rm -f gogs-0.9.20)
|
||||
# build the rpm using rpmbuild from ./rmbuild as topdir
|
||||
rm -rf ${WDIR}/rpmbuild && mkdir -p ${WDIR}/rpmbuild/SOURCES
|
||||
cp ../gogs-0.9.20.tar.gz ${WDIR}/rpmbuild/SOURCES/gogs-0.9.20.tar.gz
|
||||
rpmbuild -ba --define "_topdir ${WDIR}/rpmbuild" ./gogs.spec
|
||||
gitcommit: |
||||
git commit -a -m "lazy commit via make gitpush"
|
||||
|
||||
gitpush: |
||||
git push origin develop
|
||||
|
||||
installrpm: |
||||
sudo $(RPM) -Uvh $(home)/rpmbuild/RPMS/x86_64/gogs-0.9-20.x86_64.rpm
|
||||
removerpm: |
||||
sudo $(RPM) -e gogs
|
@ -0,0 +1,26 @@
|
||||
[Unit]o |
||||
Description=Gogs (Go Git Service) |
||||
After=syslog.target |
||||
After=network.target |
||||
After=mysqld.service |
||||
#After=postgresql.service |
||||
#After=memcached.service |
||||
#After=redis.service |
||||
|
||||
[Service] |
||||
# Modify these two values and uncomment them if you have |
||||
# repos with lots of files and get an HTTP error 500 because |
||||
# of that |
||||
### |
||||
LimitMEMLOCK=infinity |
||||
LimitNOFILE=65535 |
||||
Type=simple |
||||
User=root |
||||
Group=root |
||||
WorkingDirectory=/usr/local/gogs |
||||
ExecStart=/usr/local/gogs/gogs web |
||||
#Restart=always |
||||
Environment=USER=gogs HOME=/home/gogs |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target |
@ -0,0 +1,82 @@
|
||||
Name: gogs |
||||
Version: 0.9 |
||||
Release: 20 |
||||
|
||||
Summary: A painless self-hosted Git service |
||||
License: MIT |
||||
Packager: T.J. Yang <tjyang2001@gmail.com> |
||||
Group: Applications/System |
||||
Url: https://github.com/gogits/gogs |
||||
Source0: gogs-0.9.20.tar.gz |
||||
BuildArch: x86_64 |
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root |
||||
BuildRequires: golang |
||||
# Allow newer compiler to suppress warnings |
||||
%if 0%{?el6} |
||||
Requires: sqlite,mysql-server |
||||
%else |
||||
Requires: sqlite,mariadb-server,mariadb |
||||
%endif |
||||
|
||||
|
||||
|
||||
%description |
||||
Gogs is a painless self-hosted Git Service written in Go. It aims to make the easiest, fastest and most painless way to set up a self-hosted Git service. With Go, this can be done in independent binary distribution across ALL platforms that Go supports, including Linux, Mac OS X, and Windows. |
||||
|
||||
%prep |
||||
|
||||
%setup -q -n %{name}-0.9.20 |
||||
|
||||
%install |
||||
rm -rf %{buildroot} |
||||
mkdir -p %{buildroot} |
||||
mkdir -p %{buildroot}/usr/local/gogs |
||||
mkdir -p %{buildroot}/var/log/gogs |
||||
touch %{buildroot}/var/log/gogs/gogs.log |
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/gogs/log |
||||
rsync -azp . --exclude=gogs/rpmbuild --exclude=#.* %{buildroot}/usr/local/gogs |
||||
|
||||
# systemd gogs.service file |
||||
mkdir -p %{buildroot}/etc/systemd/system |
||||
sudo rsync -azpv %{buildroot}/usr/local/gogs/contrib/gogs.service %{buildroot}/etc/systemd/system/gogs.service |
||||
#touch /var/log/gogs.log && chown gogs:gogs /var/log/gogs.log |
||||
%preun |
||||
#shutdown gogs if running |
||||
#if [ $1 = 0 ] ; then |
||||
#/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : |
||||
#fi |
||||
|
||||
# https://www.redhat.com/archives/rpm-list/2008-September/msg00007.html |
||||
%files |
||||
%ghost %{_localstatedir}/log/gogs/%{name}.log |
||||
%attr(-,gogs,gogs) %{_localstatedir}/log/gogs/%{name}.log |
||||
|
||||
%ghost /etc/systemd/system/gogs.service |
||||
%attr(-,root,root) /etc/systemd/system/gogs.service |
||||
|
||||
%dir /usr/local/%{name} |
||||
%attr(-,gogs,gogs) /usr/local/%{name} |
||||
|
||||
%post |
||||
# remove all the binary and configs |
||||
# hack before fix |
||||
rsync -azp /usr/local/gogs/contrib/gogs.service /etc/systemd/system/gogs.service |
||||
chmod 755 /etc/systemd/system/gogs.service |
||||
chown root:root /etc/systemd/system/gogs.service |
||||
# run a mysql -root to drop all data in gogsdb ? |
||||
# |
||||
# |
||||
%changelog |
||||
* Sun Apr 17 2016 T.J. Yang <tjyang2001@gmail.com> 1.0 |
||||
- Initial rpm.spec file for gogs. |
||||
- TODOs: |
||||
- 1. Adding pre/post install script |
||||
- 2. Support CentOS 7 systemd and Centos 6 init scripts. |
||||
- 3. roll in the go build -x process into this rpm one. |
||||
- 4. Detect packageio.in's gogs rpm package. |
||||
- 5. remove all gogs db in mariadb also ? |
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue