diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-10-05 06:41:14 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-10-05 06:41:14 +0700 |
commit | 4ee42f50aa960d276e37acf49f54f438e5e78220 (patch) | |
tree | 6c9df54c0ba1d9c91f4b50c167fc9a3fdb1bf7cd | |
parent | 9806cc87f246985e3547d4e4cb90e8898d7c3083 (diff) |
system/local-persist: Added (Create persistent local volumes).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/local-persist/README | 4 | ||||
-rw-r--r-- | system/local-persist/doinst.sh | 14 | ||||
-rw-r--r-- | system/local-persist/local-persist.SlackBuild | 85 | ||||
-rw-r--r-- | system/local-persist/local-persist.info | 10 | ||||
-rw-r--r-- | system/local-persist/rc.local-persist | 39 | ||||
-rw-r--r-- | system/local-persist/slack-desc | 19 |
6 files changed, 171 insertions, 0 deletions
diff --git a/system/local-persist/README b/system/local-persist/README new file mode 100644 index 0000000000000..7ebe8ec4a51b8 --- /dev/null +++ b/system/local-persist/README @@ -0,0 +1,4 @@ +Local-persist is a docker plugin that provides persistent local volumes. +This gives you the same benefits of standalone volumes that "docker +volume create" normally affords, while also allowing you to create +volumes that persist in arbitrary disk locations. diff --git a/system/local-persist/doinst.sh b/system/local-persist/doinst.sh new file mode 100644 index 0000000000000..9ec9b9d7972f9 --- /dev/null +++ b/system/local-persist/doinst.sh @@ -0,0 +1,14 @@ +#! /bin/sh +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... +} + +config etc/rc.d/rc.local-persist.new diff --git a/system/local-persist/local-persist.SlackBuild b/system/local-persist/local-persist.SlackBuild new file mode 100644 index 0000000000000..2aaa2fd26cdb5 --- /dev/null +++ b/system/local-persist/local-persist.SlackBuild @@ -0,0 +1,85 @@ +#!/bin/sh + +# Slackware build script for local-persist + +# Copyright 2019 Sergey Poznyakoff <gray@gnu.org> +# 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=local-persist +VERSION=${VERSION:-1.3.0} +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} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $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 {} \; + +# Make sure go binary is in PATH +if [ -x /etc/profile.d/go.sh ]; then + . /etc/profile.d/go.sh +fi + +go mod init local-persist +make binary + +mkdir -p $PKG/usr/bin $PKG/etc/rc.d $PKG/install +cp bin/local-persist $PKG/usr/bin +cp $CWD/rc.local-persist $PKG/etc/rc.d/rc.local-persist.new +chmod 775 $PKG/etc/rc.d/rc.local-persist.new +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +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 + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + README.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/local-persist/local-persist.info b/system/local-persist/local-persist.info new file mode 100644 index 0000000000000..ccbb3a815feec --- /dev/null +++ b/system/local-persist/local-persist.info @@ -0,0 +1,10 @@ +PRGNAM="local-persist" +VERSION="1.3.0" +HOMEPAGE="https://github.com/MatchbookLab/local-persist" +DOWNLOAD="https://github.com/MatchbookLab/local-persist/archive/v1.3.0/local-persist-1.3.0.tar.gz" +MD5SUM="a7857ed93992c3364ff2c3f55de7237e" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="google-go-lang" +MAINTAINER="Sergey Poznyakoff" +EMAIL="gray@gnu.org" diff --git a/system/local-persist/rc.local-persist b/system/local-persist/rc.local-persist new file mode 100644 index 0000000000000..30fa1d07cf48c --- /dev/null +++ b/system/local-persist/rc.local-persist @@ -0,0 +1,39 @@ +#! /bin/sh + +CMD=local-persist + +local_persist_start() { + if [ -n "$(/sbin/pidof $CMD)" ]; then + echo >&2 "$0: $CMD is already running" + else + /usr/bin/$CMD | /usr/bin/logger -t $CMD -p daemon.info & + fi +} + +local_persist_stop() { + /usr/bin/pkill $CMD +} + +local_persist_status() { + pid=$(/sbin/pidof $CMD) + if [ -n "$pid" ]; then + echo "$CMD is running (pid $pid)" + else + echo "$CMD is not running" + fi +} + +case $1 in + start) + local_persist_start + ;; + stop) + local_persist_stop + ;; + restart) + local_persist_stop + local_persist_start + ;; + status) + local_persist_status +esac diff --git a/system/local-persist/slack-desc b/system/local-persist/slack-desc new file mode 100644 index 0000000000000..3880ad9a52bb3 --- /dev/null +++ b/system/local-persist/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------------------------------------------------------| +local-persist: local-persist (Create persistent local volumes for docker) +local-persist: +local-persist: This docker plugin gives you the same benefits of standalone volumes +local-persist: that "docker volume create" normally affords, while also allowing you +local-persist: to create volumes that persist in arbitrary disk locations. +local-persist: +local-persist: Homepage: https://github.com/MatchbookLab/local-persist +local-persist: +local-persist: +local-persist: +local-persist: |