diff --git a/SOURCES/ergo.service b/SOURCES/ergo.service new file mode 100644 index 0000000..2c5b8dd --- /dev/null +++ b/SOURCES/ergo.service @@ -0,0 +1,17 @@ +[Unit] +Description=ergo +After=network.target mysql.service + +[Service] +Type=notify +User=ergo +WorkingDirectory=/var/lib/ergo +ExecStart=/usr/bin/ergo run --conf /etc/ergo/ircd.yaml +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure +LimitNOFILE=1048576 +NotifyAccess=main +PrivateNetwork=true + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/ergo.spec b/SPECS/ergo.spec new file mode 100644 index 0000000..9d45645 --- /dev/null +++ b/SPECS/ergo.spec @@ -0,0 +1,66 @@ +%define debug_package %{nil} + +Name : ergo +Version : 2.7.0 +Release : 1%{?dist} +Summary : A modern IRC server (daemon/ircd) written in Go +Group : System/Web +License : MIT License +URL : https://gohugo.io/ +Source0 : ergo.service +BuildRequires : golang +BuildRequires : git +Requires : git + +%description + + +%prep +%setup -T -q -c %{name}-%{version} +mkdir -p go/src/github.com/ergochat/ +cd go/src/github.com/ergochat/ +git clone https://github.com/ergochat/ergo + + +%build +export GOPATH=`pwd`/go +export GO111MODULE=on +cd go/src/github.com/ergochat/ergo +git checkout tags/v%{version} +export SHORTCOMMIT=$(git rev-parse --short HEAD) +export BUILDDATE=$(date +%Y%m%d) +%ifarch ppc64 +export CGO_ENABLED=1 +%endif +go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}" -X 'main.commit="$SHORTCOMMIT"'" -o ergo +%ifarch ppc64 +unset CGO_ENABLED +%endif + + +%install +install -p -D -m 0555 go/src/github.com/ergochat/ergo/ergo %{buildroot}%{_bindir}/ergo +install -p -D -m 0644 go/src/github.com/ergochat/ergo/default.yaml %{buildroot}%{_sysconfdir}/ergo/ircd.yaml +install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/ergo.service + + +%post +%systemd_post ergo.service + + +%preun +%systemd_preun ergo.service + + +%postun +%systemd_postun ergo.service + + +%files +%doc +%{_bindir}/ergo +%{_sysconfdir}/ergo/ircd.yaml +%{_unitdir}/ergo.service + + +%changelog