From 533ed20ff36ed7c9acfb82617867e4cb9f7dce9d Mon Sep 17 00:00:00 2001 From: Aaditya Bagga Date: Sat, 21 Sep 2019 12:43:22 +0700 Subject: system/runit-services: Added (services to use with runit). Signed-off-by: Willy Sudiarto Raharjo --- system/runit-services/README | 11 ++++ system/runit-services/doinst.sh | 25 +++++++++ system/runit-services/runit-services.SlackBuild | 71 +++++++++++++++++++++++++ system/runit-services/runit-services.info | 10 ++++ system/runit-services/slack-desc | 19 +++++++ 5 files changed, 136 insertions(+) create mode 100644 system/runit-services/README create mode 100644 system/runit-services/doinst.sh create mode 100644 system/runit-services/runit-services.SlackBuild create mode 100644 system/runit-services/runit-services.info create mode 100644 system/runit-services/slack-desc (limited to 'system') diff --git a/system/runit-services/README b/system/runit-services/README new file mode 100644 index 0000000000..8def46259e --- /dev/null +++ b/system/runit-services/README @@ -0,0 +1,11 @@ +Contains various services for using with runit. + +The services are installed in /etc/sv. + +To enable a service, simply symlink it to your service directory, ie, +/service or /var/service. + +Service logging is done via runit's svlogd or via syslog +as applicable. + +Check the project homepage for more information. diff --git a/system/runit-services/doinst.sh b/system/runit-services/doinst.sh new file mode 100644 index 0000000000..55e9fb3f73 --- /dev/null +++ b/system/runit-services/doinst.sh @@ -0,0 +1,25 @@ + +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... +} + +CONF_FILES=$() +while IFS= read -r -d ''; do + CONF_FILES+=( "$REPLY" ) +done < <(find -L etc/sv -type f -name conf.new -print0) + +for conf_file in "${CONF_FILES[@]}"; do + if [ "$conf_file" != '' ]; then + config "${conf_file}" + fi +done + diff --git a/system/runit-services/runit-services.SlackBuild b/system/runit-services/runit-services.SlackBuild new file mode 100644 index 0000000000..c5674fc7e7 --- /dev/null +++ b/system/runit-services/runit-services.SlackBuild @@ -0,0 +1,71 @@ +#!/bin/sh + +# Slackware build script for runit-services + +# Copyright 2019 Aaditya Bagga +# 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=runit-services +VERSION=${VERSION:-20190910} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +ARCH=noarch + +CWD=${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 {} \; + +# Install +make install DESTDIR="$PKG" + +# Fix some things +# ntp user does not exist in 14.2 +sed -i 's/ntp:daemon/daemon:adm/' -i "${PKG}/etc/sv/ntpd/log/conf" +echo "NTPD_USER=root # for slack 14.2" >> "${PKG}/etc/sv/ntpd/conf" + +# Backup config files +find -L "${PKG}/etc/sv" -type f -name conf -exec mv {} {}.new \; + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/doinst.sh > $PKG/install/doinst.sh +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/runit-services/runit-services.info b/system/runit-services/runit-services.info new file mode 100644 index 0000000000..4af7b8493f --- /dev/null +++ b/system/runit-services/runit-services.info @@ -0,0 +1,10 @@ +PRGNAM="runit-services" +VERSION="20190910" +HOMEPAGE="https://github.com/aadityabagga/runit-services" +DOWNLOAD="https://github.com/aadityabagga/runit-services/archive/20190910/runit-services-20190910.tar.gz" +MD5SUM="48c365aa57c740d3f37b6fccf575dc9a" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="runit pause" +MAINTAINER="Aaditya Bagga" +EMAIL="aaditya_gnulinux@zoho.com" diff --git a/system/runit-services/slack-desc b/system/runit-services/slack-desc new file mode 100644 index 0000000000..361d60d4b0 --- /dev/null +++ b/system/runit-services/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 ':'. + + |-----handy-ruler------------------------------------------------------| +runit-services: runit-services (services to use with runit) +runit-services: +runit-services: This package contains runit run scripts for services like +runit-services: syslogd, crond, dbus, dhcpcd, etc. +runit-services: +runit-services: The script collection comprises packages both in Slackware +runit-services: repository and addtional repositories like slackbuilds.org. +runit-services: +runit-services: Service logging is done via runit's svlogd or via syslog +runit-services: as applicable. +runit-services: -- cgit v1.2.3