diff options
author | Mario Preksavec <mario at slackware dot hr> | 2019-05-18 06:43:50 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-05-18 06:43:50 +0700 |
commit | 4d8764c7cb268c2946c4e7b646fea759671825b1 (patch) | |
tree | b2007ac79f0d96adeb3c619e078c2bdea9aeaee7 | |
parent | 832fba7887d31db10bf533579caad343531896e7 (diff) |
system/dlm: Added (Distributed Lock Manager).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/dlm/README | 4 | ||||
-rw-r--r-- | system/dlm/README.SLACKWARE | 18 | ||||
-rw-r--r-- | system/dlm/dlm.SlackBuild | 108 | ||||
-rw-r--r-- | system/dlm/dlm.info | 10 | ||||
-rw-r--r-- | system/dlm/doinst.sh | 26 | ||||
-rw-r--r-- | system/dlm/patches/Check-sscanf-return-value.patch | 24 | ||||
-rw-r--r-- | system/dlm/patches/Debian-path-for-the-config-file.patch | 21 | ||||
-rw-r--r-- | system/dlm/patches/Don-t-link-dlm_stonith-against-libxml2.patch | 20 | ||||
-rw-r--r-- | system/dlm/patches/Enable-systemctl-help-dlm-to-show-relevant-man-pages.patch | 20 | ||||
-rw-r--r-- | system/dlm/patches/Use-CPPFLAGS-from-the-environment.patch | 71 | ||||
-rw-r--r-- | system/dlm/patches/series | 5 | ||||
-rw-r--r-- | system/dlm/slack-desc | 19 |
12 files changed, 346 insertions, 0 deletions
diff --git a/system/dlm/README b/system/dlm/README new file mode 100644 index 0000000000000..e9d8c9db5de8d --- /dev/null +++ b/system/dlm/README @@ -0,0 +1,4 @@ +DLM is the lock manager that provides a mechanism for other cluster +infrastructure components to synchronize their access to shared resources. + +More information post-install can be found in README.SLACKWARE diff --git a/system/dlm/README.SLACKWARE b/system/dlm/README.SLACKWARE new file mode 100644 index 0000000000000..1dcc2ecdfa9f6 --- /dev/null +++ b/system/dlm/README.SLACKWARE @@ -0,0 +1,18 @@ +Starting the daemon on boot +--------------------------- + +You may wish to add these lines to /etc/rc.d/rc.local to start the service: + + if [ -x /etc/rc.d/rc.dlm ]; then + /etc/rc.d/rc.dlm start + fi + +You may also add these lines to /etc/rc.d/rc.local_shutdown: + + if [ -x /etc/rc.d/rc.dlm ]; then + /etc/rc.d/rc.dlm stop + fi + +Remember to give executable permission to /etc/rc.d/rc.local_shutdown: + + chmod 0755 /etc/rc.d/rc.local_shutdown diff --git a/system/dlm/dlm.SlackBuild b/system/dlm/dlm.SlackBuild new file mode 100644 index 0000000000000..1c5638ea33a6f --- /dev/null +++ b/system/dlm/dlm.SlackBuild @@ -0,0 +1,108 @@ +#!/bin/sh + +# Slackware build script for dlm + +# Copyright 2019 Mario Preksavec, Zagreb, Croatia +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=dlm +VERSION=${VERSION:-4.0.8} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf {,$PRGNAM-}$PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION || cd $PRGNAM-$PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Thanks to Debian folks +for i in $(cat $CWD/patches/series) ; do patch -p1 <$CWD/patches/$i ; done + +# We don't have stack clash protection support yet +sed -i 's/-fstack-clash-protection//' */Makefile + +make install \ +PREFIX=/usr \ +LIBNUM=lib${LIBDIRSUFFIX} \ +MANDIR=/usr/man \ +UDEVDIR=/lib/udev/rules.d \ +USE_SD_NOTIFY=no \ +DESTDIR=$PKG + +# Copy init script and adjust for default config +install -D -m0755 -oroot -groot init/$PRGNAM.init $PKG/etc/rc.d/rc.$PRGNAM.new +install -D -m0644 -oroot -groot init/$PRGNAM.sysconfig $PKG/etc/default/$PRGNAM.new +sed -e "s|/etc/sysconfig|/etc/default|g" \ + -e "s|^progdir=.*|progdir=\"dlm_controld\"|" \ + -i $PKG/etc/rc.d/rc.$PRGNAM.new + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/dlm/dlm.info b/system/dlm/dlm.info new file mode 100644 index 0000000000000..f128b8592b5a6 --- /dev/null +++ b/system/dlm/dlm.info @@ -0,0 +1,10 @@ +PRGNAM="dlm" +VERSION="4.0.8" +HOMEPAGE="https://pagure.io/dlm" +DOWNLOAD="https://pagure.io/dlm/archive/dlm-4.0.8/dlm-dlm-4.0.8.tar.gz" +MD5SUM="61e63252f2e0b72207497daf83a69719" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="pacemaker" +MAINTAINER="Mario Preksavec" +EMAIL="mario at slackware dot hr" diff --git a/system/dlm/doinst.sh b/system/dlm/doinst.sh new file mode 100644 index 0000000000000..6aa62bb17a193 --- /dev/null +++ b/system/dlm/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.dlm.new +config etc/default/dlm.new diff --git a/system/dlm/patches/Check-sscanf-return-value.patch b/system/dlm/patches/Check-sscanf-return-value.patch new file mode 100644 index 0000000000000..719e294fca39e --- /dev/null +++ b/system/dlm/patches/Check-sscanf-return-value.patch @@ -0,0 +1,24 @@ +From: Valentin Vidic <Valentin.Vidic@CARNet.hr> +Date: Wed, 25 Apr 2018 23:13:29 +0200 +Subject: Check sscanf return value + +--- + dlm_tool/main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/dlm_tool/main.c b/dlm_tool/main.c +index 042caa9..1900236 100644 +--- a/dlm_tool/main.c ++++ b/dlm_tool/main.c +@@ -692,6 +692,11 @@ static void print_lkb(char *line, struct rinfo *ri) + (unsigned long long *)&lkb.timestamp, + (unsigned long long *)&lkb.time_bast); + ++ if (rv != 17) { ++ fprintf(stderr, "print_lkb error rv %d line \"%s\"\n", rv, line); ++ return; ++ } ++ + ri->lkb_count++; + + if (lkb.status == DLM_LKSTS_GRANTED) { diff --git a/system/dlm/patches/Debian-path-for-the-config-file.patch b/system/dlm/patches/Debian-path-for-the-config-file.patch new file mode 100644 index 0000000000000..f59ee39ca0c76 --- /dev/null +++ b/system/dlm/patches/Debian-path-for-the-config-file.patch @@ -0,0 +1,21 @@ +From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@niif.hu> +Date: Sun, 30 Aug 2015 16:48:15 +0200 +Subject: Debian path for the config file + +--- + init/dlm.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/init/dlm.service b/init/dlm.service +index 1db5925..5cd01c5 100644 +--- a/init/dlm.service ++++ b/init/dlm.service +@@ -7,7 +7,7 @@ After=corosync.service sys-kernel-config.mount + OOMScoreAdjust=-1000 + Type=notify + NotifyAccess=main +-EnvironmentFile=/etc/sysconfig/dlm ++EnvironmentFile=-/etc/default/dlm + ExecStartPre=/sbin/modprobe dlm + ExecStart=/usr/sbin/dlm_controld --foreground $DLM_CONTROLD_OPTS + #ExecStopPost=/sbin/modprobe -r dlm diff --git a/system/dlm/patches/Don-t-link-dlm_stonith-against-libxml2.patch b/system/dlm/patches/Don-t-link-dlm_stonith-against-libxml2.patch new file mode 100644 index 0000000000000..11a4a4091b7fa --- /dev/null +++ b/system/dlm/patches/Don-t-link-dlm_stonith-against-libxml2.patch @@ -0,0 +1,20 @@ +From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@debian.org> +Date: Mon, 19 Dec 2016 22:57:22 +0100 +Subject: Don't link dlm_stonith against libxml2 + +--- + fence/Makefile | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/fence/Makefile b/fence/Makefile +index d4a3c09..1382260 100644 +--- a/fence/Makefile ++++ b/fence/Makefile +@@ -22,7 +22,6 @@ CFLAGS += `xml2-config --cflags` + CFLAGS += -I../include + + LDFLAGS += -Wl,-z,relro -pie +-LDFLAGS += `xml2-config --libs` + LDFLAGS += -ldl + + all: $(BIN_TARGET) diff --git a/system/dlm/patches/Enable-systemctl-help-dlm-to-show-relevant-man-pages.patch b/system/dlm/patches/Enable-systemctl-help-dlm-to-show-relevant-man-pages.patch new file mode 100644 index 0000000000000..8e4fba92700a3 --- /dev/null +++ b/system/dlm/patches/Enable-systemctl-help-dlm-to-show-relevant-man-pages.patch @@ -0,0 +1,20 @@ +From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@niif.hu> +Date: Wed, 27 Apr 2016 12:00:43 +0200 +Subject: Enable systemctl help dlm to show relevant man pages + +--- + init/dlm.service | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/init/dlm.service b/init/dlm.service +index 5cd01c5..5854738 100644 +--- a/init/dlm.service ++++ b/init/dlm.service +@@ -2,6 +2,7 @@ + Description=dlm control daemon + Requires=corosync.service sys-kernel-config.mount + After=corosync.service sys-kernel-config.mount ++Documentation=man:dlm_controld man:dlm.conf man:dlm_stonith + + [Service] + OOMScoreAdjust=-1000 diff --git a/system/dlm/patches/Use-CPPFLAGS-from-the-environment.patch b/system/dlm/patches/Use-CPPFLAGS-from-the-environment.patch new file mode 100644 index 0000000000000..7f32d838d25d3 --- /dev/null +++ b/system/dlm/patches/Use-CPPFLAGS-from-the-environment.patch @@ -0,0 +1,71 @@ +From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@debian.org> +Date: Mon, 19 Dec 2016 21:36:05 +0100 +Subject: Use CPPFLAGS from the environment + +--- + dlm_controld/Makefile | 4 ++-- + dlm_tool/Makefile | 2 +- + fence/Makefile | 2 +- + libdlm/Makefile | 4 ++-- + 4 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile +index 75c5750..47af929 100644 +--- a/dlm_controld/Makefile ++++ b/dlm_controld/Makefile +@@ -58,10 +58,10 @@ endif + all: $(LIB_TARGET) $(BIN_TARGET) + + $(BIN_TARGET): $(BIN_SOURCE) +- $(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L. ++ $(CC) $(CPPFLAGS) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L. + + $(LIB_TARGET): $(LIB_SOURCE) +- $(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) ++ $(CC) $(CPPFLAGS) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) + ln -sf $(LIB_TARGET) $(LIB_SO) + ln -sf $(LIB_TARGET) $(LIB_SMAJOR) + +diff --git a/dlm_tool/Makefile b/dlm_tool/Makefile +index 80d7725..a9b3be0 100644 +--- a/dlm_tool/Makefile ++++ b/dlm_tool/Makefile +@@ -27,7 +27,7 @@ LDFLAGS += -lpthread -ldlm -ldlmcontrol + all: $(BIN_TARGET) + + $(BIN_TARGET): $(BIN_SOURCE) +- $(CC) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@ ++ $(CC) $(CPPFLAGS) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@ + + clean: + rm -f *.o *.so *.so.* $(BIN_TARGET) +diff --git a/fence/Makefile b/fence/Makefile +index b927879..d4a3c09 100644 +--- a/fence/Makefile ++++ b/fence/Makefile +@@ -28,7 +28,7 @@ LDFLAGS += -ldl + all: $(BIN_TARGET) + + $(BIN_TARGET): $(BIN_SOURCE) +- $(CC) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@ -L. ++ $(CC) $(CPPFLAGS) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@ -L. + + clean: + rm -f *.o *.so *.so.* $(BIN_TARGET) +diff --git a/libdlm/Makefile b/libdlm/Makefile +index ab32761..21addf8 100644 +--- a/libdlm/Makefile ++++ b/libdlm/Makefile +@@ -90,10 +90,10 @@ LLT_LDFLAGS += $(LDFLAGS) + all: $(LIB_TARGET) $(LLT_TARGET) $(LIB_PC) $(LLT_PC) + + $(LIB_O): $(SOURCE) +- $(CC) $< $(LIB_CFLAGS) -c -o $@ ++ $(CC) $(CPPFLAGS) $< $(LIB_CFLAGS) -c -o $@ + + $(LLT_O): $(SOURCE) +- $(CC) $< $(LLT_CFLAGS) -c -o $@ ++ $(CC) $(CPPFLAGS) $< $(LLT_CFLAGS) -c -o $@ + + $(LIB_TARGET): $(LIB_O) + $(CC) $^ $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR) diff --git a/system/dlm/patches/series b/system/dlm/patches/series new file mode 100644 index 0000000000000..3b61b57b9b177 --- /dev/null +++ b/system/dlm/patches/series @@ -0,0 +1,5 @@ +Debian-path-for-the-config-file.patch +Enable-systemctl-help-dlm-to-show-relevant-man-pages.patch +Use-CPPFLAGS-from-the-environment.patch +Don-t-link-dlm_stonith-against-libxml2.patch +Check-sscanf-return-value.patch diff --git a/system/dlm/slack-desc b/system/dlm/slack-desc new file mode 100644 index 0000000000000..465667dc4894e --- /dev/null +++ b/system/dlm/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +dlm: dlm (Distributed Lock Manager) +dlm: +dlm: DLM is the lock manager that provides a mechanism for other cluster +dlm: infrastructure components to synchronize their access to shared +dlm: resources. +dlm: +dlm: Homepage: https://pagure.io/dlm +dlm: +dlm: +dlm: +dlm: |