Browse Source
network/gem: Added (Gemini Server).
network/gem: Added (Gemini Server).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>pull/256/head
committed by
Willy Sudiarto Raharjo
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
7 changed files with 287 additions and 0 deletions
-
38network/gem/README
-
26network/gem/doinst.sh
-
47network/gem/gem.8
-
116network/gem/gem.SlackBuild
-
10network/gem/gem.info
-
31network/gem/rc.gem
-
19network/gem/slack-desc
@ -0,0 +1,38 @@ |
|||||
|
a simple gemini server |
||||
|
|
||||
|
It supports: |
||||
|
* mime types |
||||
|
* directory listing |
||||
|
* chunked file transfer |
||||
|
* passes most gemini-diagnostics tests |
||||
|
* user-defined charset/lang meta attributes |
||||
|
|
||||
|
The script will create ssl certificate with CN=localhost |
||||
|
If you wish change domain of ssl certificate: use DOMAIN variable |
||||
|
before execution of SlackBuild script. |
||||
|
|
||||
|
DOMAIN=slackbuilds.org ./gem.SlackBuild |
||||
|
|
||||
|
Is created 'gmi' directory as database in /var |
||||
|
Certificates are saved in /var/gmi/tls path. |
||||
|
Capsule content must be save in /var/gmi/capsule path. |
||||
|
|
||||
|
Overview: |
||||
|
|
||||
|
/var/gmi [ root:root | 755 ] |
||||
|
├── capsule [ root:users | 775 ] |
||||
|
├── log [ root:users | 664 ] |
||||
|
└── tls [ root:root | 755 ] |
||||
|
├── server.crt [ root:root | 644 ] |
||||
|
└── server.key [ root:users | 640 ] |
||||
|
|
||||
|
* daemon: that SlackBuild package have script for /etc/rc.d |
||||
|
|
||||
|
NOTE: Here is already existent gem binary (package manager for Ruby), |
||||
|
then create alias for gem (gemini server): |
||||
|
|
||||
|
alias gem="/usr/sbin/gem" |
||||
|
alias gemd="(ba)sh /etc/rc.d/rc.gem" - /bin/sh already appoint for bash |
||||
|
on Slackware. |
||||
|
|
||||
|
* run gem as regular user, preferably - security questions. |
@ -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.gem.new |
||||
|
setcap cap_sys_chroot+ep usr/sbin/gem |
@ -0,0 +1,47 @@ |
|||||
|
.TH GEM 8 "12 November 2024" |
||||
|
|
||||
|
.SH NAME |
||||
|
gem \- a simple gemini server |
||||
|
|
||||
|
.SH SYNOPSIS |
||||
|
.B gem |
||||
|
[\fI\,OPTION\/\fR]... |
||||
|
|
||||
|
.SH DESCRIPTION |
||||
|
gemini server with TLS and script for generating working TLS certs |
||||
|
|
||||
|
It supports: mime types; directory listing; chunked file transfer; |
||||
|
passes most gemini-diagnostics tests; user-defined charset/lang meta |
||||
|
attributes. |
||||
|
|
||||
|
.SH OPTIONS |
||||
|
.TP 5 |
||||
|
\fB\,-k\/\fR [\fI\,pub key path\/\fR] |
||||
|
(default: /var/gmi/tls/server.crt) |
||||
|
.TP 5 |
||||
|
\fB\,-c\/\fR [\fI\,priv key path\/\fR] |
||||
|
(default: /var/gmi/tls/server.key) |
||||
|
.TP 5 |
||||
|
\fB\,-h\/\fR [\fI\,hostname\/\fR] |
||||
|
(default: localhost) |
||||
|
.TP 5 |
||||
|
\fB\,-p\/\fR [\fI\,port\/\fR] |
||||
|
(default: 1965) |
||||
|
.TP 5 |
||||
|
\fB\,-d\/\fR [\fI\,doc root\/\fR] |
||||
|
(default: \fB\,null\/\fR) |
||||
|
.TP 5 |
||||
|
\fB\,-i\/\fR [\fI\,index file\/\fR] |
||||
|
(default: index.gmi) |
||||
|
.TP 5 |
||||
|
.BR -e |
||||
|
enumerate directories without an index file |
||||
|
.TP 5 |
||||
|
.BR -a |
||||
|
permit requests with a different hostname |
||||
|
.TP 5 |
||||
|
.BR -v |
||||
|
verbose: print request information |
||||
|
|
||||
|
.SH AUTHOR |
||||
|
William Clark <wrvc96@gmail.com> |
@ -0,0 +1,116 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# Slackware build script for gem |
||||
|
|
||||
|
# Copyright 2024 G. Galdini <jake@dioniso.com.br> Brazil |
||||
|
# 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=gem |
||||
|
VERSION=${VERSION:-20241113_d1a2873} |
||||
|
COMMIT="d1a287326225a0596f3698013374953c33502218" |
||||
|
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} |
||||
|
|
||||
|
if [ "$ARCH" = "i586" ]; then |
||||
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
||||
|
elif [ "$ARCH" = "i686" ]; then |
||||
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
||||
|
elif [ "$ARCH" = "x86_64" ]; then |
||||
|
SLKCFLAGS="-O2 -fPIC" |
||||
|
elif [ "$ARCH" = "aarch64" ]; then |
||||
|
SLKCFLAGS="-O2 -fPIC" |
||||
|
else |
||||
|
SLKCFLAGS="-O2" |
||||
|
fi |
||||
|
|
||||
|
: ${DOMAIN:=localhost} |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
rm -rf $PKG |
||||
|
mkdir -p $TMP $PKG $OUTPUT |
||||
|
cd $TMP |
||||
|
rm -rf $PRGNAM-$COMMIT |
||||
|
tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz |
||||
|
cd $PRGNAM-$COMMIT |
||||
|
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 {} \; |
||||
|
|
||||
|
if [ "$DOMAIN" != 'localhost' ]; then |
||||
|
sed -i "s/localhost/$DOMAIN/" Makefile $CWD/rc.${PRGNAM} |
||||
|
fi |
||||
|
|
||||
|
sed -i \ |
||||
|
-e "s,-O3,$SLKCFLAGS," \ |
||||
|
-e "s,tls,$PKG/var/gmi/tls,g" \ |
||||
|
Makefile |
||||
|
|
||||
|
sed -i 's,tls/,/var/gmi/tls/,g' config.h main.c |
||||
|
|
||||
|
make ssl |
||||
|
make |
||||
|
|
||||
|
chmod 640 $PKG/var/gmi/tls/server.key |
||||
|
mkdir -m 775 $PKG/var/gmi/capsule |
||||
|
> $PKG/var/gmi/log && chmod 664 $PKG/var/gmi/log |
||||
|
chown root:users $PKG/var/gmi/{log,capsule,tls/server.key} |
||||
|
|
||||
|
install -m 755 -D $PRGNAM $PKG/usr/sbin/$PRGNAM |
||||
|
install -m 644 -D $CWD/$PRGNAM.8 $PKG/usr/man/man8/$PRGNAM.8 |
||||
|
install -m 644 -D $CWD/rc.${PRGNAM} $PKG/etc/rc.d/rc.${PRGNAM}.new |
||||
|
|
||||
|
strip --strip-unneeded $PKG/usr/sbin/$PRGNAM |
||||
|
gzip -9 $PKG/usr/man/man?/*.? |
||||
|
|
||||
|
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 |
||||
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh |
||||
|
|
||||
|
cd $PKG |
||||
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |
@ -0,0 +1,10 @@ |
|||||
|
PRGNAM="gem" |
||||
|
VERSION="20241113_d1a2873" |
||||
|
HOMEPAGE="https://github.com/wrclark/gem" |
||||
|
DOWNLOAD="https://github.com/wrclark/gem/archive/d1a2873/gem-d1a287326225a0596f3698013374953c33502218.tar.gz" |
||||
|
MD5SUM="6040fcc9a63632527a68cd5ebe6285f7" |
||||
|
DOWNLOAD_x86_64="" |
||||
|
MD5SUM_x86_64="" |
||||
|
REQUIRES="" |
||||
|
MAINTAINER="G. Galdini" |
||||
|
EMAIL="jake@dioniso.com.br" |
@ -0,0 +1,31 @@ |
|||||
|
#!/bin/sh |
||||
|
# |
||||
|
# /etc/rc.d/rc.gem: start/stop/status gem daemon |
||||
|
# |
||||
|
# Written by G. Galdini <jake@dioniso.com.br> |
||||
|
|
||||
|
case "$1" in |
||||
|
start) |
||||
|
( /usr/sbin/gem -d /var/gmi/capsule -h localhost -aev \ |
||||
|
>> /var/gmi/log 2>&1 ) & |
||||
|
;; |
||||
|
stop) |
||||
|
pid="$(pidof gem)" |
||||
|
[ -z "$pid" ] && { echo "already stop" ; exit 1 ;} |
||||
|
kill -9 "$pid" |
||||
|
;; |
||||
|
restart) |
||||
|
sh $0 stop |
||||
|
sh $0 start |
||||
|
;; |
||||
|
status) |
||||
|
if &>/dev/null pidof 'gem' ; then |
||||
|
echo "running" |
||||
|
else |
||||
|
echo "stop" |
||||
|
fi |
||||
|
;; |
||||
|
*) |
||||
|
echo "usage: $0 [start|stop|restart|status]" |
||||
|
;; |
||||
|
esac |
@ -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------------------------------------------------------| |
||||
|
gem: gem (a simple gemini server) |
||||
|
gem: |
||||
|
gem: gemini server with TLS and script for generating working TLS certs |
||||
|
gem: |
||||
|
gem: It supports: mime types; directory listing; chunked file transfer; |
||||
|
gem: passes most gemini-diagnostics tests; user-defined charset/lang |
||||
|
gem: meta attributes. |
||||
|
gem: |
||||
|
gem: Homepage: https://github.com/wrclark/gem |
||||
|
gem: |
||||
|
gem: |
Write
Preview
Loading…
Cancel
Save
Reference in new issue