From e2cb5e2f9f3d4d839d72264a97002971189d9d7a Mon Sep 17 00:00:00 2001 From: Yth - Arnaud Date: Thu, 4 Apr 2024 11:04:09 +0700 Subject: system/redict: Added (Fork of redis). Signed-off-by: Willy Sudiarto Raharjo --- system/redict/README | 23 +++++++ system/redict/doinst.sh | 28 ++++++++ system/redict/rc.redict.new | 61 +++++++++++++++++ system/redict/redict.SlackBuild | 140 ++++++++++++++++++++++++++++++++++++++++ system/redict/redict.info | 10 +++ system/redict/redict.logrotate | 9 +++ system/redict/slack-desc | 19 ++++++ 7 files changed, 290 insertions(+) create mode 100644 system/redict/README create mode 100644 system/redict/doinst.sh create mode 100644 system/redict/rc.redict.new create mode 100644 system/redict/redict.SlackBuild create mode 100644 system/redict/redict.info create mode 100644 system/redict/redict.logrotate create mode 100644 system/redict/slack-desc (limited to 'system') diff --git a/system/redict/README b/system/redict/README new file mode 100644 index 0000000000..21e9808fc4 --- /dev/null +++ b/system/redict/README @@ -0,0 +1,23 @@ +Redict is an advanced key-value store. +It is similar to memcached but the dataset is not volatile, and values +can be strings, exactly like in memcached, but also lists, sets, and +ordered sets. +These data types can be manipulated with atomic operations to push/pop +elements, add/remove elements, perform server side union, intersection, +difference between sets, and so forth. +Redict supports different kinds of sorting abilities. + +Redict is a fork of Redis after licence went proprietary. + +Default port for starting the instance can be set with +REDICT_PORT=16379 +Defaults remains the Redis port at 6379, hence making it incompatible +out-of-the-package with a parallel Redis instance running. + +redict-cli is (for now) fully compatible with redis-cli, and defaults +to redis port 6379. + +Default directory and files are setup with redict name: +/var/lib/redict for data +/var/log/redict for logs +/etc/rc.d/rc.redict for RC script diff --git a/system/redict/doinst.sh b/system/redict/doinst.sh new file mode 100644 index 0000000000..ff94589414 --- /dev/null +++ b/system/redict/doinst.sh @@ -0,0 +1,28 @@ +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 +} + +config etc/redict/redict.conf.new +config etc/redict/sentinel.conf.new +config etc/logrotate.d/redict.new +preserve_perms etc/rc.d/rc.redict.new diff --git a/system/redict/rc.redict.new b/system/redict/rc.redict.new new file mode 100644 index 0000000000..9d1642d6ec --- /dev/null +++ b/system/redict/rc.redict.new @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Redict startup script for Slackware Linux + +PORT=6379 +SERV=/usr/bin/redict-server +CLI=/usr/bin/redict-cli +PIDFILE=/var/run/redict_${PORT}.pid +CONF=/etc/redict/redict.conf + +redict_start() { + if [ ! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "Redict appears to be already running?" + exit 1 + fi + + echo "Starting Redict server..." + $SERV $CONF +} + +redict_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + PID=$(cat $PIDFILE) + echo -n "Stopping Redict server..." + $CLI -p $PORT shutdown + while [ -d /proc/$PID ]; do + sleep 1 + echo -n "." + done + echo " done" +} + +redict_restart() { + redict_stop + sleep 3 + redict_start +} + +case "$1" in + start) + redict_start + ;; + stop) + redict_stop + ;; + restart) + redict_restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/system/redict/redict.SlackBuild b/system/redict/redict.SlackBuild new file mode 100644 index 0000000000..55ed027832 --- /dev/null +++ b/system/redict/redict.SlackBuild @@ -0,0 +1,140 @@ +#!/bin/bash + +# Slackware build script for redict + +# Copyright 2024 Yth | Pont-en-Royans, France | yth@ythogtha.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. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=redict +VERSION=${VERSION:-7.3.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +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" +elif [ "$ARCH" = "aarch64" ]; 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 +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM +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 {} \; + +# Use our CFLAGS. +sed -i "s|-O3||" deps/Makefile deps/hiredict/Makefile + +# No ./configure necessary. +# +# http://lists.slackbuilds.org/pipermail/slackbuilds-users/2013-January/010042.html +( unset ARCH ; CFLAGS="$SLKCFLAGS" make ) +make install PREFIX=$PKG/usr + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Use sample config and set some sane defaults. +install -D -m 0644 redict.conf $PKG/etc/redict/redict.conf.new +sed -i \ + -e 's|^daemonize no|daemonize yes|' \ + -e 's|^dir \.|dir /var/lib/redict|' \ + -e 's|^logfile ""|logfile /var/log/redict/redict.log|' \ + $PKG/etc/redict/redict.conf.new +install -D -m 0644 sentinel.conf $PKG/etc/redict/sentinel.conf.new + +# Create data directory. +mkdir -p $PKG/var/lib/redict +chmod 0700 $PKG/var/lib/redict + +# Create log directory. +mkdir -p $PKG/var/log/redict + +# Install init script. +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.redict.new > $PKG/etc/rc.d/rc.redict.new + +# Install logrotate script. +mkdir -p $PKG/etc/logrotate.d +cat $CWD/redict.logrotate > $PKG/etc/logrotate.d/redict.new + +# Specify default port number +if [ ! -z "$REDICT_PORT" ]; then + sed -i 's/6379/'$REDICT_PORT'/' $PKG/etc/rc.d/rc.redict.new + sed -i 's/6379/'$REDICT_PORT'/' $PKG/etc/redict/redict.conf.new + sed -i 's/default is '$REDICT_PORT'/default is 6379/' $PKG/etc/valkey/redict.conf.new + sed -i 's/6379/'$REDICT_PORT'/' $PKG/etc/redict/sentinel.conf.new +fi + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + CONTRIBUTING* README* CODE_OF_CONDUCT* SECURITY* TLS* LICENSES/ \ + $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 +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/system/redict/redict.info b/system/redict/redict.info new file mode 100644 index 0000000000..23b037820e --- /dev/null +++ b/system/redict/redict.info @@ -0,0 +1,10 @@ +PRGNAM="redict" +VERSION="7.3.0" +HOMEPAGE="https://redict.io/" +DOWNLOAD="https://codeberg.org/redict/redict/archive/7.3.0.tar.gz" +MD5SUM="0ea62d90b1642e7dd683aeda034036eb" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Yth - Arnaud" +EMAIL="yth@ythogtha.org" diff --git a/system/redict/redict.logrotate b/system/redict/redict.logrotate new file mode 100644 index 0000000000..edf55b6b02 --- /dev/null +++ b/system/redict/redict.logrotate @@ -0,0 +1,9 @@ +/var/log/redict/redict.log { + daily + rotate 7 + copytruncate + delaycompress + compress + notifempty + missingok +} diff --git a/system/redict/slack-desc b/system/redict/slack-desc new file mode 100644 index 0000000000..ad605c3218 --- /dev/null +++ b/system/redict/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------------------------------------------------------| +redict: redict (Key-Value Store) +redict: +redict: Redict is an advanced key-value store. It is similar to memcached but +redict: the dataset is not volatile, and values can be strings, exactly like +redict: in memcached, but also lists, sets, and ordered sets. These data +redict: types can be manipulated with atomic operations to push/pop elements, +redict: add/remove elements, perform server side union, intersection, +redict: Records are organized in hash table, B+ tree, or a fixed-length array. +redict: Redict supports different kinds of sorting abilities. +redict: +redict: Homepage: https://redict.io/ -- cgit v1.2.3