1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-09-22 04:35:56 -04:00

Merge pull request #5 from DavidGriffith/makefile

merge several improvements for safety options, makefile, markdown
* Prevent possible leak of executable gophermap contents.
* Allow for installation for xinetd or inetd when systemd is present.
* Add an uninstall-inetd target.
* Allow for the -j flag (parallel make) to work.
* Remove stray trailing spaces.
* add -nx flag to block execution of all files and scripts
* remove unnecessary naming, prepare for taking Kim out of developer responsibility
* Use update-inetd(1) instead of telling admin to edit inetd.conf directly.
* Fix indent.
* Add -nu flag to disable personal spaces.
* bump default version, markdownify README and adapt Makefile
* Correct typo.
* begin inetd handling without update-inetd
* correct handling of inetd.conf modification and restart
* add uninstall-inetd without update-inetd
* Slight tweak to make update-inetd happy.
* Caps nit
* Another caps nit
This commit is contained in:
Yargo 2019-03-14 20:01:38 +00:00 committed by GitHub
commit acc8344d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 24 deletions

10
INSTALL
View File

@ -47,12 +47,16 @@ make your access lists.
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.
If you want to run Gophernicus under the traditional Unix inetd, the
below line should be added to your /etc/inetd.conf and the inetd
process restarted.
gopher stream tcp nowait nobody /usr/sbin/in.gophernicus in.gophernicus -h <hostname>
The Makefile will automatically do this for you if you have the
update(1) script installed, which is the usual case in most current
flavors of Linux and BSD.
Compiling on Debian Linux (and Ubuntu)
======================================

View File

@ -33,6 +33,8 @@ MAP = gophermap
INETD = /etc/inetd.conf
XINETD = /etc/xinetd.d
INETLIN = "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) -h `hostname`"
INETPID = /var/run/inetd.pid
LAUNCHD = /Library/LaunchDaemons
PLIST = org.$(NAME).server.plist
NET_SRV = /boot/common/settings/network/services
@ -44,7 +46,7 @@ DEFAULT = /etc/default
CC = gcc
HOSTCC = $(CC)
CFLAGS = -O2 -Wall
LDFLAGS =
LDFLAGS =
IPCRM = /usr/bin/ipcrm
@ -52,7 +54,7 @@ IPCRM = /usr/bin/ipcrm
#
# Platform support, compatible with both BSD and GNU make
#
all:
all: headers
@case `uname` in \
Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDEST)" $(BINARY); ;; \
Haiku) $(MAKE) EXTRA_LIBS="-lnetwork" $(BINARY); ;; \
@ -85,8 +87,8 @@ ChangeLog:
#
# Building
#
$(NAME).c: $(NAME).h $(HEADERS)
$(NAME).c: headers $(NAME).h
$(BINARY): $(OBJECTS)
$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(OBJECTS) $(EXTRA_LIBS) -o $@
@ -149,7 +151,7 @@ install: ChangeLog clean-shm
esac
@if [ -d "$(HAS_STD)" ]; then $(MAKE) install-systemd install-done; \
elif [ -d "$(XINETD)" ]; then $(MAKE) install-xinetd install-done; \
elif [ -f "$(INETD)" ]; then $(MAKE) install-inetd; fi
elif [ -f "$(INETD)" ]; then $(MAKE) install-inetd install-done; fi
.PHONY: install
@ -157,6 +159,7 @@ install-done:
@echo
@echo "======================================================================"
@echo
@echo "If there were no errors shown above,"
@echo "Gophernicus has now been succesfully installed. To try it out, launch"
@echo "your favorite gopher browser and navigate to your gopher root."
@echo
@ -173,7 +176,7 @@ install-done:
@echo "======================================================================"
@echo
install-files:
install-files: $(BINARY)
mkdir -p $(SBINDIR)
$(INSTALL) -s -m 755 $(BINARY) $(SBINDIR)
@echo
@ -191,21 +194,20 @@ install-root:
fi
@echo
install-inetd:
@echo
@echo "======================================================================"
@echo
@echo "Looks like your system has the traditional internet superserver inetd."
@echo "Automatic installations aren't supported, so please add the following"
@echo "line to the end of your /etc/inetd.conf and restart or kill -HUP the"
@echo "inetd process."
@echo
@echo "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) -h `hostname`"
@echo
@echo "======================================================================"
install-inetd: install-files install-docs install-root
@if update-inetd --add $(INETLIN); then \
echo update-inetd install worked ; \
else if grep '^gopher' $(INETD) >/dev/null 2>&1 ; then \
echo "::::: Gopher entry in $(INETD) already present -- please check! :::::"; \
else echo "Trying to add gopher entry to $(INETD)" ; \
echo "$(INETLIN)" >> $(INETD) ; \
if [ -r $(INETPID) ] ; then kill -HUP `cat $(INETPID)` ; \
else echo "::::: No PID for inetd found, not restarted -- please check! :::::" ; fi ; \
fi ; \
fi
@echo
install-xinetd:
install-xinetd: install-files install-docs install-root
if [ -d "$(XINETD)" -a ! -f "$(XINETD)/$(NAME)" ]; then \
sed -e "s/@HOSTNAME@/`hostname`/g" $(NAME).xinetd > $(XINETD)/$(NAME); \
[ -x /sbin/service ] && /sbin/service xinetd reload; \
@ -239,7 +241,7 @@ install-haiku:
nohup /boot/system/servers/net_server >/dev/null 2>/dev/null &
@echo
install-systemd:
install-systemd: install-files install-docs install-root
if [ -d "$(HAS_STD)" ]; then \
if [ -d "$(SYSCONF)" -a ! -f "$(SYSCONF)/$(NAME)" ]; then \
$(INSTALL) -m 644 $(NAME).env $(SYSCONF)/$(NAME); \
@ -262,12 +264,24 @@ install-systemd:
#
# Uninstall targets
#
uninstall: uninstall-xinetd uninstall-launchd uninstall-systemd
uninstall: uninstall-xinetd uninstall-launchd uninstall-systemd uninstall-inetd
rm -f $(SBINDIR)/$(BINARY)
for DOC in $(DOCS); do rm -f $(DOCDIR)/$$DOC; done
rmdir -p $(SBINDIR) $(DOCDIR) 2>/dev/null || true
@echo
uninstall-inetd:
@if [ -f "$(INETD)" ] && update-inetd --remove "^gopher.*gophernicus" ; then \
echo update-inetd remove worked ; \
else if grep '^gopher' $(INETD) >/dev/null 2>&1 && \
sed -i .bak -e 's/^gopher/#gopher/' $(INETD) ; then \
echo "commented out gopher entry in $(INETD), reloading inetd" ; \
[ -r $(INETPID) ] && kill -HUP `cat $(INETPID)` ; \
else echo "::::: could not find gopher entry in $(INETD) :::::" ; \
fi ; \
fi
@echo
uninstall-xinetd:
if grep -q $(BINARY) "$(XINETD)/gopher" 2>/dev/null; then \
rm -f $(XINETD)/gopher; \