diff --git a/INSTALL b/INSTALL index aaef7fe..2932057 100644 --- a/INSTALL +++ b/INSTALL @@ -13,15 +13,11 @@ $ cd gophernicus-* $ make $ sudo make install -Then add the below line to your /etc/inetd.conf and restart -inetd. If your system comes with something else than standard -inetd "make install" should have done the right thing already. - -gopher stream tcp nowait nobody /usr/sbin/in.gophernicus in.gophernicus -h - -The -h parameter is mandatory for a properly working -Gophernicus. Other parameters can also be added, see the full -list by running "/usr/sbin/in.gophernicus -?" +That's it - Gophernicus should now be installed, preconfigured +and running under gopher:///. And more often than not, +It Just Works(tm). If gopher links don't seem to work you may +need to configure your public hostname explicitly in whatever +config file Gophernicus is using. By default Gophernicus serves gopher documents from /var/gopher although that can be changed by using the -r parameter. @@ -31,6 +27,16 @@ hostname (the one set with -h ) directory available (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 + + Compiling on Debian Linux (and Ubuntu) ====================================== @@ -44,14 +50,6 @@ of "sudo make install" you should just install the deb with 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 =============== @@ -100,9 +98,10 @@ Tested (and semi-supported) platforms include: AIX 6 POWER4 gcc 4 AIX 7 POWER5 gcc 4 CentOS 5 x86_64 gcc 4 + Debian Squeeze armv5tel gcc 4 Debian Wheezy i386 gcc 4 Debian Wheezy x86_64 gcc 4 - Debian Squeeze armv5tel gcc 4 + Debian Jessie x86_64 gcc 4 Maemo 5 armv7l gcc 4 MacOSX 10.5 i386 gcc 4 MacOSX 10.7 x86_64 llvm-gcc 4 diff --git a/Makefile b/Makefile index da21198..b4abaa7 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,9 @@ MAP = gophermap INETD = /etc/inetd.conf XINETD = /etc/xinetd.d LAUNCHD = /Library/LaunchDaemons -PLIST = org.gophernicus.server.plist +PLIST = org.$(NAME).server.plist NET_SRV = /boot/common/settings/network/services +SYSTEMD = /lib/systemd/system DIST = $(PACKAGE)-$(VERSION) TGZ = $(DIST).tar.gz @@ -129,8 +130,9 @@ install: ChangeLog install-files install-docs install-root install-haiku install-done; ;; \ *) $(MAKE) install-files install-docs install-root; ;; \ esac - @if [ -d "$(XINETD)" ]; then $(MAKE) install-xinetd install-done; fi - @if [ -f "$(INETD)" ]; then $(MAKE) install-inetd; fi + @if [ -d "$(SYSTEMD)" ]; then $(MAKE) install-systemd install-done; \ + elif [ -d "$(XINETD)" ]; then $(MAKE) install-xinetd install-done; \ + elif [ -f "$(INETD)" ]; then $(MAKE) install-inetd; fi .PHONY: install @@ -187,8 +189,7 @@ install-xinetd: install-osx: if [ -d "$(LAUNCHD)" -a ! -f "$(LAUNCHD)/$(PLIST)" ]; then \ - sed -e "s/@HOSTNAME@/`hostname`/g" org.gophernicus.server.plist > \ - $(LAUNCHD)/$(PLIST); \ + sed -e "s/@HOSTNAME@/`hostname`/g" $(PLIST) > $(LAUNCHD)/$(PLIST); \ launchctl load $(LAUNCHD)/$(PLIST); \ fi @echo @@ -203,7 +204,7 @@ install-haiku: echo " family inet"; \ echo " protocol tcp"; \ echo " port 70"; \ - echo " launch in.gophernicus -h `hostname`"; \ + echo " launch $(BINARY) -h `hostname`"; \ echo "}") >> $(NET_SRV); \ fi @echo @@ -213,10 +214,19 @@ install-haiku: nohup /boot/system/servers/net_server >/dev/null 2>/dev/null & @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: uninstall-xinetd uninstall-launchd +uninstall: uninstall-xinetd uninstall-launchd uninstall-systemd rm -f $(SBINDIR)/$(BINARY) for DOC in $(DOCS); do rm -f $(DOCDIR)/$$DOC; done rmdir -p $(SBINDIR) $(DOCDIR) 2>/dev/null || true @@ -239,6 +249,13 @@ uninstall-launchd: fi @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 diff --git a/gophermap b/gophermap index 776965f..283b5d4 100644 --- a/gophermap +++ b/gophermap @@ -26,7 +26,7 @@ Generic information: =echo " description....: $SERVER_DESCRIPTION" 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 " root directory.: $DOCUMENT_ROOT" =echo " running as user: `whoami`" diff --git a/gophernicus.socket b/gophernicus.socket new file mode 100644 index 0000000..8aec71f --- /dev/null +++ b/gophernicus.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Gophernicus gopher server + +[Socket] +ListenStream=70 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/gophernicus@.service b/gophernicus@.service new file mode 100644 index 0000000..6272703 --- /dev/null +++ b/gophernicus@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Gophernicus gopher server + +[Service] +ExecStart=/usr/sbin/in.gophernicus -h %H +StandardInput=socket +User=nobody