From 8c8e53bc7dfdb7fe59a0737f71dce5d47142a136 Mon Sep 17 00:00:00 2001 From: Ben Schermel Date: Wed, 27 May 2020 13:18:38 -0400 Subject: [PATCH] fix rpmbuild dirs Former-commit-id: 14bdd745d10c5e8efa3518445641629c79407992 --- .gitignore | 3 ++ pkg/rpm/generate_rpms.sh | 30 +++++++++---------- .../keydb_rpm/etc/logrotate.d/keydb | 9 ++++++ .../keydb-sentinel.service.d/limit.conf | 7 +++++ .../systemd/system/keydb.service.d/limit.conf | 7 +++++ 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100755 pkg/rpm/keydb_build/keydb_rpm/etc/logrotate.d/keydb create mode 100755 pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb-sentinel.service.d/limit.conf create mode 100755 pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb.service.d/limit.conf diff --git a/.gitignore b/.gitignore index 9ea2151e0..c169eca17 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ core *.so *.d !**/bash_completion.d +!**/logrotate.d +!**/keydb.service.d +!**/keydb-sentinel.service.d *.log dump.rdb src/keydb-server diff --git a/pkg/rpm/generate_rpms.sh b/pkg/rpm/generate_rpms.sh index 50634db22..21ccaf150 100755 --- a/pkg/rpm/generate_rpms.sh +++ b/pkg/rpm/generate_rpms.sh @@ -1,39 +1,39 @@ #! /bin/bash ### usage sudo ./generate_rpms - +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" version=$(grep KEYDB_REAL_VERSION ../../src/version.h | awk '{ printf $3 }' | tr -d \") release=1 # by default this will always be 1 for keydb version structure. If build release version needs to be update you can modify here arch=$(uname -m) dist=el$(rpm -q --queryformat '%{VERSION}' centos-release | cut -d. -f1) -if [ "$arch" != "aarch64" ] || [ "$arch" != "x86_64" ]; then +if [[ "$arch" != "aarch64" ]] && [[ "$arch" != "x86_64" ]]; then echo "This script is only valid and tested for aarch64 and x86_64 architectures. You are trying to use: $arch" fi # remove any old rpm packages -rm $PWD/rpm_files_generated/keydb* +rm $DIR/rpm_files_generated/keydb* # generate empty directories that github would otherwise delete (avoids .gitkeep in directory) -mkdir $PWD/keydb_build/keydb_rpm/usr/bin -mkdir $PWD/keydb_build/keydb_rpm/usr/lib64/redis/modules -mkdir $PWD/keydb_build/keydb_rpm/var/lib/keydb -mkdir $PWD/keydb_build/keydb_rpm/var/log/keydb +mkdir -p $DIR/keydb_build/keydb_rpm/usr/bin +mkdir -p $DIR/keydb_build/keydb_rpm/usr/lib64/redis/modules +mkdir -p $DIR/keydb_build/keydb_rpm/var/lib/keydb +mkdir -p $DIR/keydb_build/keydb_rpm/var/log/keydb # move binaries to bin -rm $PWD/keydb_build/keydb_rpm/usr/bin/* -cp $PWD/../../src/keydb-* $PWD/keydb_build/keydb_rpm/usr/bin/ +rm $DIR/keydb_build/keydb_rpm/usr/bin/* +cp $DIR/../../src/keydb-* $DIR/keydb_build/keydb_rpm/usr/bin/ # update spec file with build info -sed -i '2d' $PWD/keydb_build/keydb.spec -sed -i -E "1a\Version : $version" $PWD/keydb_build/keydb.spec -sed -i '3d' $PWD/keydb_build/keydb.spec -sed -i -E "2a\Release : $release%{?dist}" $PWD/keydb_build/keydb.spec +sed -i '2d' $DIR/keydb_build/keydb.spec +sed -i -E "1a\Version : $version" $DIR/keydb_build/keydb.spec +sed -i '3d' $DIR/keydb_build/keydb.spec +sed -i -E "2a\Release : $release%{?dist}" $DIR/keydb_build/keydb.spec # yum install -y scl-utils centos-release-scl rpm-build mkdir -p /root/rpmbuild/BUILDROOT/keydb-$version-$release.$dist.$arch cp -r ./keydb_build/keydb_rpm/* /root/rpmbuild/BUILDROOT/keydb-$version-$release.$dist.$arch/ -rpmbuild -bb /rpm_build/keydb.spec -mv /root/rpmbuild/RPMS/$arch/* .$PWD/rpm_files_generated +rpmbuild -bb /keydb_build/keydb.spec +mv /root/rpmbuild/RPMS/$arch/* $DIR/rpm_files_generated exit diff --git a/pkg/rpm/keydb_build/keydb_rpm/etc/logrotate.d/keydb b/pkg/rpm/keydb_build/keydb_rpm/etc/logrotate.d/keydb new file mode 100755 index 000000000..0ed7ae328 --- /dev/null +++ b/pkg/rpm/keydb_build/keydb_rpm/etc/logrotate.d/keydb @@ -0,0 +1,9 @@ +/var/log/keydb/*.log { + weekly + rotate 10 + copytruncate + delaycompress + compress + notifempty + missingok +} diff --git a/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb-sentinel.service.d/limit.conf b/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb-sentinel.service.d/limit.conf new file mode 100755 index 000000000..8003c2fc4 --- /dev/null +++ b/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb-sentinel.service.d/limit.conf @@ -0,0 +1,7 @@ +# If you need to change max open file limit +# for example, when you change maxclient in configuration +# you can change the LimitNOFILE value below +# see "man systemd.exec" for information + +[Service] +LimitNOFILE=10240 diff --git a/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb.service.d/limit.conf b/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb.service.d/limit.conf new file mode 100755 index 000000000..8003c2fc4 --- /dev/null +++ b/pkg/rpm/keydb_build/keydb_rpm/etc/systemd/system/keydb.service.d/limit.conf @@ -0,0 +1,7 @@ +# If you need to change max open file limit +# for example, when you change maxclient in configuration +# you can change the LimitNOFILE value below +# see "man systemd.exec" for information + +[Service] +LimitNOFILE=10240