diff options
author | Slack Coder <slackcoder@server.ky> | 2024-10-12 08:43:00 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-10-12 09:40:52 +0700 |
commit | 74177438d65866c4bb29f4b21ec1f16ee2bc99c0 (patch) | |
tree | 8492eb222bc3930f211d6fff16c84c6766ff1192 | |
parent | a7fad4210ca9b3f9bcaef737d05ba7091b9a5c16 (diff) | |
download | slackbuilds-74177438d65866c4bb29f4b21ec1f16ee2bc99c0.tar.gz slackbuilds-74177438d65866c4bb29f4b21ec1f16ee2bc99c0.tar.xz |
network/gmid: Added (Gemini server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | network/gmid/README | 24 | ||||
-rw-r--r-- | network/gmid/doinst.sh | 26 | ||||
-rw-r--r-- | network/gmid/files/gmid.conf.new | 30 | ||||
-rw-r--r-- | network/gmid/files/rc.gmid.new | 93 | ||||
-rw-r--r-- | network/gmid/gmid.SlackBuild | 83 | ||||
-rw-r--r-- | network/gmid/gmid.info | 10 | ||||
-rw-r--r-- | network/gmid/slack-desc | 19 |
7 files changed, 285 insertions, 0 deletions
diff --git a/network/gmid/README b/network/gmid/README new file mode 100644 index 0000000000..263b79c496 --- /dev/null +++ b/network/gmid/README @@ -0,0 +1,24 @@ +It can serve static files, has optional FastCGI and proxying support, +and a rich configuration syntax. + +To have the gmid daemon start and stop with your host, add to +/etc/rc.d/rc.local: + + if [ -x /etc/rc.d/rc.gmid ]; then + /etc/rc.d/rc.gmid start + fi + +and to /etc/rc.d/rc.local_shutdown (creating it if needed): + + if [ -x /etc/rc.d/rc.gmid ]; then + /etc/rc.d/rc.gmid stop + fi + +The service is configured to run as the 'gmid' user. To add this user: + + useradd gmid \ + --comment 'gmid gemini server' \ + --gid 387 \ + --home-dir /srv/gmid \ + --system \ + --uid 387 diff --git a/network/gmid/doinst.sh b/network/gmid/doinst.sh new file mode 100644 index 0000000000..912cfff3f5 --- /dev/null +++ b/network/gmid/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/gmid.conf.new +preserve_perms etc/rc.d/rc.gmid.new diff --git a/network/gmid/files/gmid.conf.new b/network/gmid/files/gmid.conf.new new file mode 100644 index 0000000000..c725e4f69b --- /dev/null +++ b/network/gmid/files/gmid.conf.new @@ -0,0 +1,30 @@ +# Directory to isolate process. +# +# Only available when starting gmid as root. +chroot "/srv/gmid" + +# User to run daemon as. Mandatory if chroot is used. +user "gmid" + +# An example of a server block: +server "example.com" { + listen on * port 1965 + + # Path to the root directory of your capsule. + root "example.com" + + # Set self-signed TLS cert and key. It is better to keep the keys + # outside the chroot. + # + # This key expires after 365 days, keep in mind to renew it. + # + # openssl req -x509 \ + # -newkey rsa:4096 \ + # -days 365 \ + # -nodes \ + # -out /etc/ssl/gmid/example.com.pem \ + # -keyout /etc/ssl/gmid/example.com.key \ + # -subj "/CN=example.com" + cert "/etc/ssl/gmid/example.com.pem" + key "/etc/ssl/gmid/example.com.key" +} diff --git a/network/gmid/files/rc.gmid.new b/network/gmid/files/rc.gmid.new new file mode 100644 index 0000000000..9438b36c2f --- /dev/null +++ b/network/gmid/files/rc.gmid.new @@ -0,0 +1,93 @@ +#!/bin/sh +# +# Startup/shutdown script for the gmid gemini service. +# + +GMID_USER=${GMID_USER:-root} + +create_gmid_run_dir() { + if [ ! -d /run/gmid/ ]; then + mkdir -p /run/gmid + chown gmid:gmid /run/gmid + fi +} + +gmid_reload() +{ + create_gmid_run_dir + + local pid="$(2>/dev/null cat /run/gmid/gmid.pid)" + + if [ -z "$pid" ] || ! kill -0 "$pid" >/dev/null; then + echo "gmid is not running" + + return + fi + + echo "Reloading gmid configuration" + kill -HUP "$pid" +} + +gmid_start() { + create_gmid_run_dir + + local pid="$(2>/dev/null cat /run/gmid/gmid.pid)" + + if [ -n "$pid" ] || kill -0 "$pid" 2>/dev/null; then + echo "gmid is already running" + + return + fi + + echo "Starting gmid gemini service" + sudo -u "$GMID_USER" -- gmid \ + -c /etc/gmid.conf \ + -P /run/gmid/gmid.pid +} + +gmid_status() { + create_gmid_run_dir + + local pid="$(2>/dev/null cat /run/gmid/gmid.pid)" + + if [ -z "$pid" ] || ! kill -0 "$pid" 2>/dev/null; then + echo "gmid is not running" + + return + fi + + echo "gmid is running" +} + +gmid_stop() { + echo "Stopping gmid gemini service" + create_gmid_run_dir + + local pid="$(2>/dev/null cat /run/gmid/gmid.pid)" + + if [ -z "$pid" ] || ! kill -0 "$pid" 2>/dev/null; then + echo "gmid is not running" + + return + fi + + sudo -u "$GMID_USER" -- kill -TERM "$pid" +} + +case "$1" in +reload) + gmid_reload + ;; +start) + gmid_start + ;; +status) + gmid_status + ;; +stop) + gmid_stop + ;; +*) + echo "Usage: $0 {reload|start|status|stop}" + exit 1 +esac diff --git a/network/gmid/gmid.SlackBuild b/network/gmid/gmid.SlackBuild new file mode 100644 index 0000000000..24c23d8c03 --- /dev/null +++ b/network/gmid/gmid.SlackBuild @@ -0,0 +1,83 @@ +#!/bin/bash + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=gmid +VERSION=${VERSION:-2.1.1} +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 [ ! -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} + +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 {} \; + + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --mandir=/usr/man + +make +make install DESTDIR=$PKG + +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +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 +cp -a \ + ChangeLog \ + LICENSE \ + README.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cp "$CWD/README" "$PKG/usr/doc/$PRGNAM-$VERSION/README_slackware.md" + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +mkdir -p "$PKG/etc" +cp -R "$CWD/files/gmid.conf.new" "$PKG/etc" + +mkdir -p "$PKG/etc/rc.d" +cp -R "$CWD/files/rc.gmid.new" "$PKG/etc/rc.d/" + +mkdir -p "$PKG/srv/gmid" + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/network/gmid/gmid.info b/network/gmid/gmid.info new file mode 100644 index 0000000000..d1284c8290 --- /dev/null +++ b/network/gmid/gmid.info @@ -0,0 +1,10 @@ +PRGNAM="gmid" +VERSION="2.1.1" +HOMEPAGE="https://gmid.omarpolo.com" +DOWNLOAD="https://ftp.omarpolo.com/gmid-2.1.1.tar.gz" +MD5SUM="fda53ff9cd666ca1de9c5f56511a3465" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Slack Coder" +EMAIL="slackcoder@server.ky" diff --git a/network/gmid/slack-desc b/network/gmid/slack-desc new file mode 100644 index 0000000000..0d24c6a04c --- /dev/null +++ b/network/gmid/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------------------------------------------------------| +gmid: gmid (Gemini server) +gmid: +gmid: It can serve static files, has optional FastCGI and proxying +gmid: support, and a rich configuration syntax. +gmid: +gmid: +gmid: +gmid: +gmid: +gmid: +gmid: |