.spec file and scripts to build RPM for Fedora

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Takuya ASADA 2015-09-02 04:32:54 +09:00 committed by Pekka Enberg
parent db6d48a695
commit 795c7a5df6
3 changed files with 102 additions and 0 deletions

27
dist/redhat/build_rpm.sh vendored Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh -e
SCYLLA_VER=0.00
RPMBUILD=~/rpmbuild
if [ ! -e dist/redhat/build_rpm.sh ]; then
echo "run build_rpm.sh in top of scylla-jmx dir"
exit 1
fi
if [ ! -f /usr/bin/git ] || [ ! -f /usr/bin/yum-builddep ] || [ ! -f /usr/bin/rpmbuild ]; then
sudo yum install -y yum-utils git rpm-build rpmdevtools
fi
mkdir -p $RPMBUILD/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
curdir=`basename $(pwd)`
cd ..
if [ "$curdir" != "scylla-jmx-$SCYLLA_VER" ]; then
echo "WARNING: base directory name should be 'scylla-jmx-$SCYLLA_VER'"
ln -s $curdir scylla-jmx-$SCYLLA_VER
fi
tar --exclude-vcs --exclude-vcs-ignores -cpf $RPMBUILD/SOURCES/scylla-jmx-$SCYLLA_VER.tar scylla-jmx-$SCYLLA_VER $curdir
if [ "$curdir" != "scylla-jmx-$SCYLLA_VER" ]; then
rm scylla-jmx-$SCYLLA_VER
fi
cd -
cp dist/redhat/scylla-jmx.spec $RPMBUILD/SPECS
sudo yum-builddep -y $RPMBUILD/SPECS/scylla-jmx.spec
rpmbuild --define "_topdir $RPMBUILD" -ba $RPMBUILD/SPECS/scylla-jmx.spec

60
dist/redhat/scylla-jmx.spec vendored Normal file
View File

@ -0,0 +1,60 @@
Name: scylla-jmx
Version: 0.00
Release: 1%{?dist}
Summary: Scylla JMX
Group: Applications/Dataases
License: Proprietary
URL: http://www.seastar-project.org/
Source0: %{name}-%{version}.tar
BuildArch: noarch
BuildRequires: maven java-1.8.0-openjdk
Requires: maven java-1.8.0-openjdk
%description
%prep
%setup -q
%build
env JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk mvn install
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/scylla/
install -m644 dist/redhat/systemd/scylla-jmx.service $RPM_BUILD_ROOT%{_unitdir}/
install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla
install -d -m755 $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx
install -m644 target/urchin-mbean-1.0.jar $RPM_BUILD_ROOT%{_prefix}/lib/scylla/jmx/
%pre
/usr/sbin/groupadd scylla 2> /dev/null || :
/usr/sbin/useradd -g scylla -s /sbin/nologin -r -d ${_sharedstatedir}/scylla scylla 2> /dev/null || :
%post
%systemd_post scylla-jmx.service
%preun
%systemd_preun scylla-jmx.service
%postun
%systemd_postun
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_unitdir}/scylla-jmx.service
%{_prefix}/lib/scylla/jmx/urchin-mbean-1.0.jar
%changelog
* Fri Aug 7 2015 Takuya ASADA Takuya ASADA <syuu@cloudius-systems.com>
- inital version of scylla-tools.spec

15
dist/redhat/systemd/scylla-jmx.service vendored Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Scylla JMX
Requires=scylla-server.service
After=scylla-server.service
[Service]
Type=simple
User=scylla
Group=scylla
ExecStart=/usr/bin/java -jar /usr/lib/scylla/jmx/urchin-mbean-1.0.jar
KillMode=process
Restart=always
[Install]
WantedBy=multi-user.target