1
0
Fork 0
arangodb/Installation/rpm/arangodb.spec.in

337 lines
11 KiB
Plaintext

#
# spec file for package arangodb
#
#
# Copyright (c) 2014 info@arangodb.org
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
## -----------------------------------------------------------------------------
## --SECTION-- global variables
## -----------------------------------------------------------------------------
%global with_systemd 0
%if @IS_SYSTEMD_INSTALL@
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%global with_systemd 1
%endif
%endif
%define _cfgdir %{_sysconfdir}/arangodb3
%define _databasedir %{_localstatedir}/lib/arangodb3
%define _appdir %{_localstatedir}/lib/arangodb3-apps
%define _logdir %{_localstatedir}/log/arangodb3
%if 0%{?suse_version} >= 1230
%define _piddir /run/arangodb
%else
%define _piddir %{_localstatedir}/run/arangodb
%endif
%define _skipFdupes 0
## -----------------------------------------------------------------------------
## --SECTION-- package data
## -----------------------------------------------------------------------------
Name: @CPACK_PACKAGE_NAME@
Version: @CPACK_PACKAGE_VERSION@
Release: @ARANGODB_RPM_REVISION@
Summary: The open-source, multi-model NoSQL database
License: Apache-2.0
Group: Productivity/Databases/Servers
Conflicts: arangodb, @CPACKG_PACKAGE_CONFLICTS@, @CPACKG_PACKAGE_CONFLICTS@-client, @CPACK_PACKAGE_NAME@-client
Url: http://www.arangodb.com
Vendor: @CPACK_PACKAGE_VENDOR@
Prefix: @CPACK_PACKAGING_INSTALL_PREFIX@
BuildRoot: @CMAKE_CURRENT_BINARY_DIR@/_CPack_Packages/Linux/RPM/@CPACK_PACKAGE_FILE_NAME@
%if %{with_systemd}
BuildRequires: systemd-units
Requires: systemd-units
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%{?systemd_requires}
%define debug_package %{nil}
## -----------------------------------------------------------------------------
## --SECTION-- build dependencies
## -----------------------------------------------------------------------------
%package client
Summary: ArangoDB shell as stand-alone package
Group: Productivity/Databases/Servers
Conflicts: arangodb, @CPACKG_PACKAGE_CONFLICTS@, @CPACKG_PACKAGE_CONFLICTS@-client, @CPACK_PACKAGE_NAME@
## -----------------------------------------------------------------------------
## --SECTION-- build dependencies
## -----------------------------------------------------------------------------
%package debuginfo
Summary: ArangoDB debug symbols
Group: Productivity/Databases/Servers
## -----------------------------------------------------------------------------
## --SECTION-- description
## -----------------------------------------------------------------------------
%description
ArangoDB is a durable, reliable, transactional multi-model database. Its key-features are: joins, transaction, and flexible data modelling.
The ArangoDB consists of a server, a separate shell, which allows you to administrate the server, and a set of client APIs for various languages.
It is written in C/C++.
%description client
The ArangoDB shell as stand-alone program. It also contains the utility programs: arangobench (benchmark), arangorestore & arangodump (backup), arangoimport (import).
%description debuginfo
Debug symbols for the arangodb database
## -----------------------------------------------------------------------------
## --SECTION-- build
## -----------------------------------------------------------------------------
# requires source:
%prep
#%setup -q -n arangodb-%{version}
#%setup -q -n arangodb-%{version} -T -D -a 1
## -----------------------------------------------------------------------------
## --SECTION-- install
## -----------------------------------------------------------------------------
mkdir -p %{buildroot}%{_databasedir}
mkdir -p %{buildroot}%{_appdir}
mkdir -p %{buildroot}%{_logdir}
mkdir -p %{buildroot}%{_piddir}
## -----------------------------------------------------------------------------
## --SECTION-- check
## -----------------------------------------------------------------------------
%check
## -----------------------------------------------------------------------------
## --SECTION-- files
## -----------------------------------------------------------------------------
%files
%defattr(-,root,root,0755)
#@CPACK_PACKAGING_INSTALL_PREFIX@/@LIB_INSTALL_DIR@/*
#@CPACK_PACKAGING_INSTALL_PREFIX@/bin/*
#%doc README
#%doc README.md
#%doc LICENSE
#%doc LICENSES-OTHER-COMPONENTS.md
/usr/share/doc/arangodb3/LICENSE.txt
/usr/share/doc/arangodb3/LICENSES-OTHER-COMPONENTS.md
/usr/share/doc/arangodb3/README.md
/usr/share/doc/arangodb3/README.txt
%attr(0755,arangodb,arangodb) %{_databasedir}
%attr(0755,arangodb,arangodb) %{_appdir}
%attr(0755,arangodb,arangodb) %{_logdir}
%ghost %attr(0755,arangodb,arangodb) %{_piddir}
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/*/*
%{_datadir}/arangodb3
%{_sysconfdir}/init.d/arangodb3
%if @IS_SYSTEMD_INSTALL@
@SYSTEMD_UNIT_DIR@/@CPACK_PACKAGE_NAME@.service
%endif
/etc/logrotate.d/@CPACK_PACKAGE_NAME@
%files client
%defattr(-,root,root,0755)
#%doc README
#%doc README.md
#%doc LICENSE
#%doc LICENSES-OTHER-COMPONENTS.md
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/arangosh.conf
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/arangoimport.conf
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/arangodump.conf
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/arangorestore.conf
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/arangobench.conf
%config(noreplace) %attr(-,arangodb,arangodb) %{_cfgdir}/foxx-manager.conf
%{_bindir}/arangosh
%{_bindir}/arangoimport
%{_bindir}/arangodump
%{_bindir}/arangorestore
%{_bindir}/arangobench
%{_bindir}/foxx-manager
%{_mandir}/*/arangosh*
%{_mandir}/*/arangorestore*
%{_mandir}/*/arangobench*
%{_mandir}/*/arangodump*
%{_mandir}/*/arangoimport*
%{_datadir}/arangodb3/@ARANGODB_JS_VERSION@/common
%{_datadir}/arangodb3/@ARANGODB_JS_VERSION@/client
%{_datadir}/arangodb3/@ARANGODB_JS_VERSION@/node
%files debuginfo
@CPACK_DEBUG_DIRECTORY_PATTERN@
## -----------------------------------------------------------------------------
## --SECTION-- post
## -----------------------------------------------------------------------------
%post
%if 0%{?suse_version}
%{fillup_and_insserv -f -y arangodb3}
%restart_on_update arangodb3
%if @IS_SYSTEMD_INSTALL@
%if 0%{?systemd_post:1}
%systemd_post @CPACK_PACKAGE_NAME@.service
%else
%service_add_post @CPACK_PACKAGE_NAME@.service
if [ $1 = 1 ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%endif
%endif
%endif
%if 0%{?suse_version} < 1210
chkconfig --level 2345 arangodb3 on
%endif
echo "
ArangoDB 3 (https://www.arangodb.com)
The multi-model NoSQL database: distributed free and open-source database
with a flexible data model for documents, graphs, and key-values. Build
high performance applications using a convenient SQL-like query language
or JavaScript extensions.
First Steps with ArangoDB:
https://docs.arangodb.com/latest/Manual/GettingStarted/
Upgrading ArangoDB:
https://docs.arangodb.com/Installing/Upgrading.html
Configuring the storage Engine:
https://docs.arangodb.com/latest/Manual/Administration/Configuration/GeneralArangod.html#storage-engine
Upgrading ArangoDB database files:
> /etc/init.d/arangodb3 upgrade
Configuration file:
/etc/arangodb3/arangod.conf
Start ArangoDB shell client:
> %{_bindir}/arangosh
"
%if @IS_SYSTEMD_INSTALL@
echo "Start ArangoDB service:
> systemctl start arangodb3.service
Enable ArangoDB service:
> systemctl enable arangodb3.service
"
%else
echo "Start ArangoDB service:
> /etc/init.d/arangodb3 start
"
%endif
export ARANGODB_DEFAULT_ROOT_PASSWORD=`(uname -a ; cat /etc/hostname) | md5sum | awk '{print $1}'`
echo "SECURITY HINT:"
echo "run 'arango-secure-installation' to set a root password"
echo "the current password is '$ARANGODB_DEFAULT_ROOT_PASSWORD'"
echo "(You should do this for a FRESH install! For an UPGRADE the password does not need to be changed)"
/usr/sbin/arango-init-database --uid arangodb --gid arangodb --server.rest-server false --server.statistics false --foxx.queues false || true
exit 0
## -----------------------------------------------------------------------------
## --SECTION-- postun
## -----------------------------------------------------------------------------
%postun
%if 0%{?suse_version}
%restart_on_update arangodb3
%insserv_cleanup
%if @IS_SYSTEMD_INSTALL@
%service_del_postun arangodb3.service
%endif
%else
exit 0
%endif
## -----------------------------------------------------------------------------
## --SECTION-- pre
## -----------------------------------------------------------------------------
%pre
# create arangodb group only if it doesn't already exist
if ! getent group arangodb >/dev/null 2>&1; then
/usr/sbin/groupadd -r arangodb
fi
# create arangodb user only if it doesn't already exist
if ! getent passwd arangodb >/dev/null 2>&1; then
/usr/sbin/useradd -r -g arangodb --home %{_localstatedir}/arangodb arangodb
/usr/sbin/usermod -c "Arango Server" arangodb
fi
%if 0%{?suse_version}
%if @IS_SYSTEMD_INSTALL@
%service_add_pre arangodb3.service
%endif
%endif
## -----------------------------------------------------------------------------
## --SECTION-- preun
## -----------------------------------------------------------------------------
%preun
%if @IS_SYSTEMD_INSTALL@
%stop_on_removal arangodb3
%if 0%{?suse_version}
%service_del_preun arangodb3.service
%else
%systemd_preun arangodb3
%endif
%else
%{_sysconfdir}/init.d/arangodb stop > /dev/null 2>&1 || true
chkconfig --del arangodb3
exit 0
%endif
## -----------------------------------------------------------------------------
## --SECTION-- changelog
## -----------------------------------------------------------------------------
%changelog