Add building ArchLinux package of Memgraph
Reviewers: mferencevic, buda Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1101
This commit is contained in:
parent
007a7f1a6d
commit
456e95d12c
47
release/arch-pkg/PKGBUILD.proto
Normal file
47
release/arch-pkg/PKGBUILD.proto
Normal file
@ -0,0 +1,47 @@
|
||||
# Maintainer: tech@memgraph.com (Memgraph Ltd.)
|
||||
pkgname=memgraph
|
||||
pkgrel=1
|
||||
epoch=
|
||||
# TODO: Maybe take pkgdesc from CMake?
|
||||
pkgdesc="High performance, in-memory, transactional graph database"
|
||||
# TODO: Autogenerate architecture? Though, we only support x86_64...
|
||||
arch=('x86_64')
|
||||
url="https://memgraph.com"
|
||||
license=('custom')
|
||||
groups=()
|
||||
depends=('gcc-libs')
|
||||
makedepends=()
|
||||
checkdepends=()
|
||||
optdepends=()
|
||||
provides=()
|
||||
conflicts=()
|
||||
replaces=()
|
||||
backup=("etc/memgraph/memgraph.conf" "etc/logrotate.d/memgraph")
|
||||
options=()
|
||||
install=memgraph.install
|
||||
changelog=
|
||||
source=("$pkgname-$pkgver.tar.gz")
|
||||
noextract=()
|
||||
validpgpkeys=()
|
||||
|
||||
package() {
|
||||
cd $(find . -maxdepth 1 -type d -name 'memgraph*')
|
||||
# By default, we install the systemd service in /lib (as expected on Debian),
|
||||
# so move anything like that in /usr/lib.
|
||||
if [[ -d "lib" ]]; then
|
||||
mkdir -p usr/lib
|
||||
cp -a lib/* usr/lib
|
||||
rm -rf lib
|
||||
fi
|
||||
# In case the binary package is built with /usr/local prefix instead of /usr.
|
||||
if [[ -d "usr/local" ]]; then
|
||||
mkdir -p usr
|
||||
cp -a usr/local/* usr
|
||||
rm -rf usr/local
|
||||
fi
|
||||
# Move the license to Arch specific location.
|
||||
install -Dm644 usr/share/doc/memgraph/copyright usr/share/licenses/memgraph/LICENSE
|
||||
# We currently don't have anything in usr/share/doc/memgraph
|
||||
rm -rf usr/share/doc/memgraph
|
||||
cp -a . $pkgdir
|
||||
}
|
22
release/arch-pkg/memgraph.install
Normal file
22
release/arch-pkg/memgraph.install
Normal file
@ -0,0 +1,22 @@
|
||||
post_install() {
|
||||
# Add the 'memgraph' user and group and set permissions on
|
||||
# 'var/*/memgraph' directories.
|
||||
useradd --system memgraph
|
||||
res=$?
|
||||
if [[ "$res" != "0" && "$res" != "9" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
chown memgraph:memgraph /var/lib/memgraph || exit 1
|
||||
chmod 750 /var/lib/memgraph || exit 1
|
||||
chown memgraph:adm /var/log/memgraph || exit 1
|
||||
chmod 750 /var/log/memgraph || exit 1
|
||||
# Make examples directory immutable (optional)
|
||||
chattr +i -R /usr/share/memgraph/examples || true
|
||||
echo "Enable and start 'memgraph.service' to use Memgraph" || exit 1
|
||||
}
|
||||
|
||||
pre_remove() {
|
||||
# Remove optional immutability from examples directory to allow removal
|
||||
chattr -i -R /usr/share/memgraph/examples || true
|
||||
systemctl disable memgraph.service
|
||||
}
|
47
release/arch-pkg/package_arch
Executable file
47
release/arch-pkg/package_arch
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
function print_help () {
|
||||
echo "Usage: $0 MEMGPRAH_PACKAGE.tar.gz"
|
||||
echo "Optional arguments:"
|
||||
echo -e " -h|--help Print help."
|
||||
}
|
||||
|
||||
if [[ $# -ne 1 || "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "File '$1' does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract version from .tar.gz name
|
||||
tgz_name=`echo $(basename $1) | sed 's/.tar.gz//'`
|
||||
version=`echo ${tgz_name} | sed 's/.*[-_]\(.*\)-.*/\1/'`
|
||||
|
||||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
rm -rf ${script_dir}/_pack
|
||||
mkdir -p ${script_dir}/_pack
|
||||
# Copy the .tar.gz to packaging directory.
|
||||
cp "$1" ${script_dir}/_pack/memgraph-${version}.tar.gz
|
||||
|
||||
cd ${script_dir}/_pack
|
||||
|
||||
# Setup PKGBUILD.
|
||||
echo "pkgver=${version}" > PKGBUILD
|
||||
cat ../PKGBUILD.proto >> PKGBUILD
|
||||
# Copy the installation script.
|
||||
cp ../memgraph.install ./
|
||||
|
||||
# Check PKGBUILD validity
|
||||
updpkgsums PKGBUILD
|
||||
namcap PKGBUILD
|
||||
|
||||
makepkg
|
||||
# Check the final package archive validity and move it in parent directory.
|
||||
pkg_name=memgraph-${version}-1-x86_64.pkg.tar.xz
|
||||
namcap --exclude=emptydir $pkg_name
|
||||
cp $pkg_name ../
|
||||
echo "Built Arch Package at '${script_dir}/${pkg_name}'"
|
||||
rm -rf ${script_dir}/_pack
|
Loading…
Reference in New Issue
Block a user