summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Heß2016-06-05 17:09:56 +0200
committerJanne Heß2016-06-05 17:10:46 +0200
commitba79d60be040e45740595b1732de49d997f845fc (patch)
tree734dffdf013d2e06cc4761ae19b561321ec363d8
parent096133ed8769e51eca3f0f53fd29b1075d7915c4 (diff)
downloadaur-ba79d60be040e45740595b1732de49d997f845fc.tar.gz
Update for systemd and fix a lot of stuff
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD74
-rw-r--r--gofish-www.service23
-rw-r--r--gofish.install28
-rw-r--r--gofish.service23
-rwxr-xr-xgopherd.rc.d38
6 files changed, 121 insertions, 83 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 59339958b1b8..2f13db196815 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,19 +1,23 @@
+# Generated by mksrcinfo v8
+# Sun Jun 5 15:10:37 UTC 2016
pkgbase = gofish
pkgdesc = Simple gopher/web server with HTTP support
pkgver = 1.2
- pkgrel = 1
+ pkgrel = 2
url = http://gofish.sourceforge.net/
install = gofish.install
arch = i686
arch = x86_64
license = GPL-2
provides = gopherd
- backup = etc/gofish.conf
- backup = etc/gofish-www.conf
- source = http://downloads.sourceforge.net/gofish/gofish-1.2.tar.gz
- source = gopherd.rc.d
- md5sums = a44fc268354ec97324fa25572910c412
- md5sums = 23ff978124baeec51950beb9ff2973ae
+ backup = etc/gofish/gofish.conf
+ backup = etc/gofish/gofish-www.conf
+ source = http://downloads.sourceforge.net/project/gofish/gofish/1.2/gofish-1.2.tar.gz
+ source = gofish.service
+ source = gofish-www.service
+ sha512sums = f7999a5e2b4f80d6402f26d9434f844b26b47b43a6b00055e72ba399426672ed299ca759252d8eb732b23a4c2c369a92c11c0d496f16f4bf3a999398cf6c5bee
+ sha512sums = 735884a93a0c33dd9442315ec6d658454fc8d7235466013504f000824a9f42248b8b5ef12cd6af2b48cef38b0cabfa893ef4de20f95837cf1fa295bb60215236
+ sha512sums = 74891090106d5134f9886a2f554b7fe9120c4562f6d47e9319a9feae64e6332551df00048d4f4b9a4eca0a78690cca0cb7addf8fd13456004a4d0e1a8f67f9f0
pkgname = gofish
diff --git a/PKGBUILD b/PKGBUILD
index 646119758ce8..291514995ead 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,34 +1,70 @@
-# Maintainer: Kaiting Chen <kaitocracy@gmail.com>
+# Maintainer: Janne Heß <jannehess@gmail.com>
+# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Mark Rosenstand <mark@archlinux.org>
# Contributor: Nathan Owe <ndowens04+AUR @ gmail.com>
pkgname='gofish'
pkgver='1.2'
-pkgrel='1'
+pkgrel=2
pkgdesc='Simple gopher/web server with HTTP support'
license=('GPL-2')
url='http://gofish.sourceforge.net/'
arch=('i686' 'x86_64')
-backup=('etc/gofish.conf' 'etc/gofish-www.conf')
+backup=('etc/gofish/gofish.conf' 'etc/gofish/gofish-www.conf')
provides=('gopherd')
install='gofish.install'
-md5sums=('a44fc268354ec97324fa25572910c412'
- '23ff978124baeec51950beb9ff2973ae')
-source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
- 'gopherd.rc.d')
+sha512sums=('f7999a5e2b4f80d6402f26d9434f844b26b47b43a6b00055e72ba399426672ed299ca759252d8eb732b23a4c2c369a92c11c0d496f16f4bf3a999398cf6c5bee'
+ '735884a93a0c33dd9442315ec6d658454fc8d7235466013504f000824a9f42248b8b5ef12cd6af2b48cef38b0cabfa893ef4de20f95837cf1fa295bb60215236'
+ '74891090106d5134f9886a2f554b7fe9120c4562f6d47e9319a9feae64e6332551df00048d4f4b9a4eca0a78690cca0cb7addf8fd13456004a4d0e1a8f67f9f0')
+source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz"
+ 'gofish.service'
+ 'gofish-www.service')
build() {
- cd "${srcdir}/${pkgname}"
-
- install -Dm755 $srcdir/gopherd.rc.d \
- $pkgdir/etc/rc.d/gopherd
-
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --disable-mmap-cache \
- --with-gopherroot=/var/gopher \
- --with-gopheruser=gopher
- make; make DESTDIR=$pkgdir install
+ cd "${srcdir}/${pkgname}"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc/gofish \
+ --localstatedir=/var \
+ --disable-mmap-cache \
+ --with-gopherroot=/srv/gopher \
+ --with-gopheruser=gopher
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+
+ make DESTDIR="${pkgdir}" install
+ install -dm755 "${pkgdir}/srv/gopherweb"
+
+ # move sbin
+ mv "${pkgdir}/usr/sbin/gofish" "${pkgdir}/usr/bin/"
+ ln -s /usr/bin/gofish "${pkgdir}/usr/bin/gopherd"
+ rm -r "${pkgdir}/usr/sbin"
+
+ # correct for /srv
+ sed -i \
+ -e 's/^;root/root/g' \
+ -e 's/^;logfile/logfile/g' \
+ -e 's/^;pidfile/pidfile/g' \
+ -e 's:/var/gopher:/srv/gopher:g' \
+ -e 's:/var/log/gopherd.log:/var/log/gofish/gofish.log:g' \
+ -e 's:/var/run/gopherd.pid:/run/gofish/gofish.pid:g' \
+ "${pkgdir}/etc/gofish/gofish.conf"
+ sed -i \
+ -e 's:/var/www/html:/srv/gopherweb:g' \
+ -e 's:/var/log/gofish.log:/var/log/gofish/gofish-www.log:g' \
+ -e 's:/var/run/gofish.pid:/run/gofish/gofish-www.pid:g' \
+ "${pkgdir}/etc/gofish/gofish-www.conf"
+ sed -i 's:/var/gopher:/srv/gopher:g' "${pkgdir}/srv/gopher/Configure_GoFish"
+ sed -i 's:/var/gopher:/srv/gopher:g' "${pkgdir}/usr/bin/check-files"
+
+ # systemd
+ install -Dm644 "${srcdir}/gofish.service" "${pkgdir}/usr/lib/systemd/system/gofish.service"
+ install -Dm644 "${srcdir}/gofish-www.service" "${pkgdir}/usr/lib/systemd/system/gofish-www.service"
+
+ # Logging
+ install -dm755 "${pkgdir}/var/log/gofish"
}
diff --git a/gofish-www.service b/gofish-www.service
new file mode 100644
index 000000000000..e4d9b90a6926
--- /dev/null
+++ b/gofish-www.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Gofish WWW Daemon
+
+[Service]
+# Allow modifying settings
+Environment=MAXCONNS=25
+Environment=CONFIG=/etc/gofish/gofish-www.conf
+EnvironmentFile=-/etc/conf.d/gofish-www
+
+Type=forking
+ExecStart=/usr/bin/gofish -d -c $CONFIG -m $MAXCONNS
+PIDFile=/run/gofish/gofish-www.pid
+# Lock process down
+ReadOnlyDirectories=/srv/gopher
+PrivateTmp=true
+PrivateDevices=true
+ProtectHome=true
+ProtectSystem=full
+RuntimeDirectory=gofish
+RuntimeDirectoryMode=700
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gofish.install b/gofish.install
index 0bca92e058eb..7c795cab3d7f 100644
--- a/gofish.install
+++ b/gofish.install
@@ -1,27 +1,17 @@
post_install() {
- echo -n "Adding gopher system group... "
- groupadd -g 41 gopher && echo "done."
-
- echo -n "Adding gopher system user... "
- useradd -g 41 -u 41 -d /var/gopher \
- -s /bin/false gopher && echo "done."
- passwd -l gopher &> /dev/null
-
- post_upgrade $1
+ post_upgrade
+ chgrp -R gopher /srv/gopher /srv/gopherweb
+ chmod -R g-w /srv/gopher /srv/gopherweb
+ chown -R gopher /var/log/gofish
}
post_upgrade() {
- echo -n "Refreshing directory caches... "
- mkcache -r &> /dev/null && echo "done."
+ getent group gopher >/dev/null || groupadd -r gopher
+ getent passwd gopher >/dev/null || useradd -r -g gopher -d /srv/gopher -s /sbin/nologin -c "Gopher server user" gopher
+ mkcache -r &> /dev/null
}
post_remove() {
- echo -n "Removing gopher system user... "
- userdel gopher &> /dev/null && echo "done."
- echo -n "Removing gopher system group... "
- groupdel gopher &> /dev/null && echo "done."
+ userdel gopher &>/dev/null || true
+ groupdel gopher &>/dev/null || true
}
-
-op=$1
-shift
-$op $*
diff --git a/gofish.service b/gofish.service
new file mode 100644
index 000000000000..29109914c284
--- /dev/null
+++ b/gofish.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Gofish Gopher Daemon
+
+[Service]
+# Allow modifying settings
+Environment=MAXCONNS=25
+Environment=CONFIG=/etc/gofish/gofish.conf
+EnvironmentFile=-/etc/conf.d/gofish
+
+Type=forking
+ExecStart=/usr/bin/gofish -d -c $CONFIG -m $MAXCONNS
+PIDFile=/run/gofish/gofish.pid
+# Lock process down
+ReadOnlyDirectories=/srv/gopher
+PrivateTmp=true
+PrivateDevices=true
+ProtectHome=true
+ProtectSystem=full
+RuntimeDirectory=gofish
+RuntimeDirectoryMode=700
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gopherd.rc.d b/gopherd.rc.d
deleted file mode 100755
index d220c2befdfd..000000000000
--- a/gopherd.rc.d
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-### /etc/rc.d/gopherd: Initscript for Gopher Daemon
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pidof -o %PPID /usr/sbin/gopherd`
-case "$1" in
- start)
- stat_busy "Starting Gopher Daemon"
- [ -z "$PID" ] && \
- /usr/sbin/gopherd -d &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else stat_done; add_daemon gopherd
- echo $PID > /var/run/gopherd.pid
- fi ;;
- stop)
- stat_busy "Stopping Gopher Daemon"
- [ ! -z "$PID" ] \
- && kill $PID &>/dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done; rm_daemon gopherd
- fi ;;
- restart)
- $0 stop
- sleep 1
- $0 start ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-
-exit 0
-
-### /etc/rc.d/gopherd: Initscript for Gopher Daemon