Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #333 from kshlm/rpm-spec-and-requirements
Browse files Browse the repository at this point in the history
Add an RPM specfile
  • Loading branch information
prashanthpai authored Jul 4, 2017
2 parents 0be2455 + 24e66b6 commit 92bb106
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
3 changes: 3 additions & 0 deletions extras/rpms/glusterd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
localstatedir = "/var/lib/glusterd2"
logdir = "/var/log/glusterd2"
logfile = "glusterd2.log"
83 changes: 83 additions & 0 deletions extras/rpms/glusterd2.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
%global _dwz_low_mem_die_limit 0

%global provider github
%global provider_tld com
%global project gluster
%global repo glusterd2
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}

Name: %{repo}
Version: 4.0dev
Release: 7
Summary: The GlusterFS management daemon (preview)
License: GPLv2 or LGPLv3+
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/v%{version}-%{release}/%{name}-v%{version}-%{release}.tar.gz
Source1: glusterd.toml

ExclusiveArch: x86_64

BuildRequires: golang >= 1.8.0
BuildRequires: glide >= 0.12.0
BuildRequires: git
BuildRequires: mercurial
BuildRequires: systemd

Requires: glusterfs-server >= 3.11.0
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description
Preview release of the next generation GlusterFS management framework and daemon, coming with GlusterFS-4.0

%prep
%setup -q -n %{name}-v%{version}-%{release}

%build
export GOPATH=$(pwd):%{gopath}

mkdir -p src/%(dirname %{import_path})
ln -s ../../../ src/%{import_path}

pushd src/%{import_path}
# Install vendored packages
# TODO: See if we can build with unbundled packages
make vendor-install
# Build glusterd2
make glusterd2
popd

%install
#Install glusterd2 binary
install -D -p -m 0755 build/%{name} %{buildroot}%{_sbindir}/%{name}
#Install systemd unit
install -D -p -m 0644 extras/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
#Install glusterd config into etc
install -d -m 0755 %{buildroot}%{_sysconfdir}/glusterd
install -m 0644 -t %{buildroot}%{_sysconfdir}/glusterd %{SOURCE1}
# Create /var/lib/glusterd2
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
# logdir
install -d -m 0755 %{buildroot}%{_localstatedir}/log/%{name}

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun %{name}.service

%files
%{_sbindir}/%{name}
%config(noreplace) %{_sysconfdir}/glusterd
%{_unitdir}/%{name}.service
%dir %{_sharedstatedir}/%{name}
%dir %{_localstatedir}/log/%{name}

%changelog
* Mon Jul 03 2017 Kaushal M <kshlmster@gmail.com> - 4.0dev-7
- Initial spec
13 changes: 13 additions & 0 deletions extras/systemd/glusterd2.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=GlusterD2, the management service for GlusterFS (pre-release)
Requires=rpcbind.service
After=network.target rpcbind.service
Before=network-online.target
Conflicts=glusterd.service

[Service]
ExecStart=/usr/sbin/glusterd2
KillMode=process

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fi
GOBUILD_TAGS="novirt noaugeas "
VERSION=$($(dirname $0)/pkg-version --full)
LDFLAGS="-X github.com/gluster/glusterd2/gdctx.GlusterdVersion=$VERSION"
LDFLAGS+=" -B 0x$(head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n')"
BIN=$(basename $(go list -f '{{.ImportPath}}'))

if [ "$PLUGINS" == "yes" ]; then
Expand Down

0 comments on commit 92bb106

Please sign in to comment.