1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-12-04 14:46:37 -05:00

Added install/uninstall support for Linux systemd

This commit is contained in:
Kim Holviala 2015-12-29 15:21:36 +02:00
parent fd80023b17
commit a214290935
5 changed files with 58 additions and 26 deletions

35
INSTALL
View File

@ -13,15 +13,11 @@ $ cd gophernicus-*
$ make $ make
$ sudo make install $ sudo make install
Then add the below line to your /etc/inetd.conf and restart That's it - Gophernicus should now be installed, preconfigured
inetd. If your system comes with something else than standard and running under gopher://<HOSTNAME>/. And more often than not,
inetd "make install" should have done the right thing already. It Just Works(tm). If gopher links don't seem to work you may
need to configure your public hostname explicitly in whatever
gopher stream tcp nowait nobody /usr/sbin/in.gophernicus in.gophernicus -h <hostname> config file Gophernicus is using.
The -h <hostname> parameter is mandatory for a properly working
Gophernicus. Other parameters can also be added, see the full
list by running "/usr/sbin/in.gophernicus -?"
By default Gophernicus serves gopher documents from /var/gopher By default Gophernicus serves gopher documents from /var/gopher
although that can be changed by using the -r <root> parameter. although that can be changed by using the -r <root> parameter.
@ -31,6 +27,16 @@ hostname (the one set with -h <hostname>) directory available
(mkdir /var/gopher/$HOSTNAME). (mkdir /var/gopher/$HOSTNAME).
Running with traditional inetd superserver
==========================================
If you want to run Gophernicus under the traditional Unix
inetd, add the below line to your /etc/inetd.conf and restart
the inetd process.
gopher stream tcp nowait nobody /usr/sbin/in.gophernicus in.gophernicus -h <hostname>
Compiling on Debian Linux (and Ubuntu) Compiling on Debian Linux (and Ubuntu)
====================================== ======================================
@ -44,14 +50,6 @@ of "sudo make install" you should just install the deb with
Work(tm). Work(tm).
Compiling on Mac OS X
=====================
When you run "make install" on OSX-like system with launchd
the install routine also installs a plist file and tells launchd
to start the server up. In other words, It Just Works(tm).
Cross-compiling Cross-compiling
=============== ===============
@ -100,9 +98,10 @@ Tested (and semi-supported) platforms include:
AIX 6 POWER4 gcc 4 AIX 6 POWER4 gcc 4
AIX 7 POWER5 gcc 4 AIX 7 POWER5 gcc 4
CentOS 5 x86_64 gcc 4 CentOS 5 x86_64 gcc 4
Debian Squeeze armv5tel gcc 4
Debian Wheezy i386 gcc 4 Debian Wheezy i386 gcc 4
Debian Wheezy x86_64 gcc 4 Debian Wheezy x86_64 gcc 4
Debian Squeeze armv5tel gcc 4 Debian Jessie x86_64 gcc 4
Maemo 5 armv7l gcc 4 Maemo 5 armv7l gcc 4
MacOSX 10.5 i386 gcc 4 MacOSX 10.5 i386 gcc 4
MacOSX 10.7 x86_64 llvm-gcc 4 MacOSX 10.7 x86_64 llvm-gcc 4

View File

@ -29,8 +29,9 @@ MAP = gophermap
INETD = /etc/inetd.conf INETD = /etc/inetd.conf
XINETD = /etc/xinetd.d XINETD = /etc/xinetd.d
LAUNCHD = /Library/LaunchDaemons LAUNCHD = /Library/LaunchDaemons
PLIST = org.gophernicus.server.plist PLIST = org.$(NAME).server.plist
NET_SRV = /boot/common/settings/network/services NET_SRV = /boot/common/settings/network/services
SYSTEMD = /lib/systemd/system
DIST = $(PACKAGE)-$(VERSION) DIST = $(PACKAGE)-$(VERSION)
TGZ = $(DIST).tar.gz TGZ = $(DIST).tar.gz
@ -129,8 +130,9 @@ install: ChangeLog
install-files install-docs install-root install-haiku install-done; ;; \ install-files install-docs install-root install-haiku install-done; ;; \
*) $(MAKE) install-files install-docs install-root; ;; \ *) $(MAKE) install-files install-docs install-root; ;; \
esac esac
@if [ -d "$(XINETD)" ]; then $(MAKE) install-xinetd install-done; fi @if [ -d "$(SYSTEMD)" ]; then $(MAKE) install-systemd install-done; \
@if [ -f "$(INETD)" ]; then $(MAKE) install-inetd; fi elif [ -d "$(XINETD)" ]; then $(MAKE) install-xinetd install-done; \
elif [ -f "$(INETD)" ]; then $(MAKE) install-inetd; fi
.PHONY: install .PHONY: install
@ -187,8 +189,7 @@ install-xinetd:
install-osx: install-osx:
if [ -d "$(LAUNCHD)" -a ! -f "$(LAUNCHD)/$(PLIST)" ]; then \ if [ -d "$(LAUNCHD)" -a ! -f "$(LAUNCHD)/$(PLIST)" ]; then \
sed -e "s/@HOSTNAME@/`hostname`/g" org.gophernicus.server.plist > \ sed -e "s/@HOSTNAME@/`hostname`/g" $(PLIST) > $(LAUNCHD)/$(PLIST); \
$(LAUNCHD)/$(PLIST); \
launchctl load $(LAUNCHD)/$(PLIST); \ launchctl load $(LAUNCHD)/$(PLIST); \
fi fi
@echo @echo
@ -203,7 +204,7 @@ install-haiku:
echo " family inet"; \ echo " family inet"; \
echo " protocol tcp"; \ echo " protocol tcp"; \
echo " port 70"; \ echo " port 70"; \
echo " launch in.gophernicus -h `hostname`"; \ echo " launch $(BINARY) -h `hostname`"; \
echo "}") >> $(NET_SRV); \ echo "}") >> $(NET_SRV); \
fi fi
@echo @echo
@ -213,10 +214,19 @@ install-haiku:
nohup /boot/system/servers/net_server >/dev/null 2>/dev/null & nohup /boot/system/servers/net_server >/dev/null 2>/dev/null &
@echo @echo
install-systemd:
if [ -d "$(SYSTEMD)" -a ! -f "$(SYSTEMD)/$(NAME).socket" ]; then \
$(INSTALL) -m 644 $(NAME).socket $(NAME)\@.service $(SYSTEMD); \
systemctl daemon-reload; \
systemctl enable $(NAME).socket; \
systemctl start $(NAME).socket; \
fi
@echo
# #
# Uninstall targets # Uninstall targets
# #
uninstall: uninstall-xinetd uninstall-launchd uninstall: uninstall-xinetd uninstall-launchd uninstall-systemd
rm -f $(SBINDIR)/$(BINARY) rm -f $(SBINDIR)/$(BINARY)
for DOC in $(DOCS); do rm -f $(DOCDIR)/$$DOC; done for DOC in $(DOCS); do rm -f $(DOCDIR)/$$DOC; done
rmdir -p $(SBINDIR) $(DOCDIR) 2>/dev/null || true rmdir -p $(SBINDIR) $(DOCDIR) 2>/dev/null || true
@ -239,6 +249,13 @@ uninstall-launchd:
fi fi
@echo @echo
uninstall-systemd:
if [ -d "$(SYSTEMD)" -a -f "$(SYSTEMD)/$(NAME).socket" ]; then \
systemctl stop $(NAME).socket; \
systemctl disable $(NAME).socket; \
rm -f $(SYSTEMD)/$(NAME).socket $(SYSTEMD)/$(NAME)\@.service; \
fi
@echo
# #
# Release targets # Release targets

View File

@ -26,7 +26,7 @@ Generic information:
=echo " description....: $SERVER_DESCRIPTION" =echo " description....: $SERVER_DESCRIPTION"
Server configuration: Server configuration:
=echo " config file....: `for FILE in /Library/LaunchDaemons/org.gophernicus.server.plist /boot/common/settings/network/services /etc/xinetd.d/gophernicus /etc/inetd.conf; do if [ -f $FILE ]; then echo $FILE; break; fi; done`" =echo " config file....: `for FILE in /Library/LaunchDaemons/org.gophernicus.server.plist /boot/common/settings/network/services /lib/systemd/system/gophernicus\@.service /etc/xinetd.d/gophernicus /etc/inetd.conf; do if [ -f $FILE ]; then echo $FILE; break; fi; done`"
=echo " server hostname: $SERVER_HOST" =echo " server hostname: $SERVER_HOST"
=echo " root directory.: $DOCUMENT_ROOT" =echo " root directory.: $DOCUMENT_ROOT"
=echo " running as user: `whoami`" =echo " running as user: `whoami`"

9
gophernicus.socket Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=Gophernicus gopher server
[Socket]
ListenStream=70
Accept=yes
[Install]
WantedBy=sockets.target

7
gophernicus@.service Normal file
View File

@ -0,0 +1,7 @@
[Unit]
Description=Gophernicus gopher server
[Service]
ExecStart=/usr/sbin/in.gophernicus -h %H
StandardInput=socket
User=nobody