mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-11-03 04:27:17 -05:00
Merge pull request #85 from gophernicus/new-build-system
Introduce new build system
This commit is contained in:
commit
430e8f9ee0
21
.gitignore
vendored
21
.gitignore
vendored
@ -6,26 +6,7 @@ src/files.h
|
||||
src/filetypes.h
|
||||
src/bin2c
|
||||
src/gophernicus
|
||||
Makefile
|
||||
|
||||
README
|
||||
README.options
|
||||
|
||||
#
|
||||
# Test leftovers
|
||||
#
|
||||
test.output
|
||||
|
||||
#
|
||||
# Release files
|
||||
#
|
||||
*.gz
|
||||
|
||||
#
|
||||
# Debian packaging leftovers
|
||||
#
|
||||
build-stamp
|
||||
debian/files
|
||||
debian/gophernicus.debhelper.log
|
||||
debian/gophernicus.postrm.debhelper
|
||||
debian/gophernicus.substvars
|
||||
debian/gophernicus/
|
||||
|
@ -23,7 +23,8 @@ addons:
|
||||
- debhelper
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ./configure --listener=systemd,inetd,xinetd --hostname=travis; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ./configure --listener=mac --hostname=travis; fi
|
||||
- make
|
||||
- sudo make install
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then make deb ; fi
|
||||
- .travis/test.sh
|
||||
|
157
INSTALL.md
157
INSTALL.md
@ -13,121 +13,65 @@ To compile and install run:
|
||||
```
|
||||
$ git clone -b 3.0.1 https://github.com/gophernicus/gophernicus.git
|
||||
$ cd gophernicus
|
||||
$ ./configure --listener=somelistener
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
after having set the correct public hostname in the `gophernicus.env`
|
||||
file. If this is wrong, selectors ("gopher links") won't work!
|
||||
Important configure arguments include:
|
||||
|
||||
On \*nix systems, `hostname` might give you an idea, but please
|
||||
note this might be completely wrong, especially on your personal
|
||||
machine at home or on some cheap virtual server. If you know you
|
||||
have a fixed numerical IP, you can also directly use that.
|
||||
For testing, just keep the default value of `localhost` which will
|
||||
result in selectors working only when you're connecting locally.
|
||||
- `--listener`. This is the only required argument. You must
|
||||
choose a listener that passes network requests to
|
||||
gophernicus, as gophernicus dosen't do this by itself. The
|
||||
options are:
|
||||
- systemd, a common init system on many Linux distributions
|
||||
that can do this without an external program.
|
||||
- inetd, an older, well-known implementation that is very
|
||||
simple.
|
||||
- xinetd, a modern reimplementation of inetd using specific
|
||||
config files.
|
||||
- mac, to be used on Mac OSX machines.
|
||||
- haiku, to be used on Haiku machines.
|
||||
- autodetect, which looks at what you have avaliable
|
||||
(unrecommended, please manually specify where possible).
|
||||
- `--hostname`. This is by default attempted to be autodetected
|
||||
by the configure script, using the command `hostname`. It is
|
||||
expected to be the publicly-accessible address of the server.
|
||||
However, this might be completely wrong, especially on your
|
||||
personal machine at home or on some cheap VPS. If you know you
|
||||
have a fixed numerical IP, you can also directly use that.
|
||||
For testing, just keep the default value of `localhost` which will
|
||||
result in selectors working only when you're connecting locally.
|
||||
- `--gopherroot`. The location in which your gopher server will
|
||||
serve from. By default is `/var/gopher`. Also can be changed
|
||||
later using the `-r <root>` parameter in configuration files.
|
||||
|
||||
That's it - Gophernicus should now be installed, preconfigured
|
||||
and running under gopher://<HOSTNAME>/. And more often than not,
|
||||
It Just Works(tm).
|
||||
|
||||
By default Gophernicus serves gopher documents from `/var/gopher`
|
||||
although that can be changed by using the `-r <root>` parameter.
|
||||
To enable virtual hosting create hostname directories under
|
||||
the gopher root and make sure you have at least the primary
|
||||
hostname (the one set with `-h <hostname>`) directory available
|
||||
(`mkdir /var/gopher/$HOSTNAME`).
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
These were obtained from a base docker installation.
|
||||
|
||||
### Ubuntu 18.04, 16.04, Debian Sid, Buster, Stretch, Jessie
|
||||
- build-essential
|
||||
- git
|
||||
- libwrap0-dev for tcp
|
||||
- fakeroot
|
||||
|
||||
### Centos 6, 7
|
||||
- the group 'Development Tools'. less is probably required, but
|
||||
I know this works and couldn't be bothered to find out what was
|
||||
actually required.
|
||||
|
||||
### Fedora 29, 30, rawhide
|
||||
- the group 'Development Tools'. less is probably required, but
|
||||
I know this works and couldn't be bothered to find out what was
|
||||
actually required.
|
||||
- net-tools
|
||||
|
||||
### OpenSuse Leap, Tumbleweed
|
||||
- the pattern devel_C_C++
|
||||
- the pattern devel_basis
|
||||
- git
|
||||
|
||||
### archlinux
|
||||
- base-devel
|
||||
- git
|
||||
|
||||
### Gentoo
|
||||
- git
|
||||
|
||||
### Alpine Linux
|
||||
- alpine-sdk. once again, less is probably required.. blah blah.
|
||||
|
||||
|
||||
### Other installation targets
|
||||
|
||||
Suppose your server runs systemd, but you'd rather have Gophernicus
|
||||
started with inetd or xinetd. To do that, do `make install-inetd`
|
||||
or `make install-xinetd`. Likewise use `make uninstall-inetd` or
|
||||
`make uninstall-xinetd` to uninstall Gophernicus.
|
||||
|
||||
|
||||
## Compiling with TCP wrappers
|
||||
|
||||
Gophernicus uses no extra libraries... well... except libwrap
|
||||
(TCP wrappers) if it is installed with headers in default Unix
|
||||
directories at the time of compiling. If you have the headers
|
||||
installed and don't want wrapper support, run 'make generic'
|
||||
instead of just 'make', and if you have wrappers installed in
|
||||
non-standard place and want to force compile with wrappers
|
||||
just run 'make withwrap'.
|
||||
installed and don't want wrapper support, too bad (for now, see
|
||||
issue #89).
|
||||
|
||||
For configuring IP access lists with TCP wrappers, take a look
|
||||
at the files `/etc/hosts.allow` and `/etc/hosts.deny` (because the
|
||||
manual pages suck). Use the daemon name "gophernicus" to
|
||||
make your access lists.
|
||||
|
||||
## Distributions
|
||||
|
||||
## Running with traditional inetd superserver
|
||||
|
||||
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/gophernicus gophernicus -h <hostname>
|
||||
```
|
||||
|
||||
The Makefile will automatically do this for you and remove it when
|
||||
uninstalling.
|
||||
|
||||
|
||||
## Compiling on Debian Linux (and Ubuntu)
|
||||
|
||||
The above commands work on Debian just fine, but if you prefer
|
||||
having everything installed as packages run `make deb` instead
|
||||
of plain `make`. If all the dependencies were in place you'll
|
||||
end up with an offical-looking deb package in the parent
|
||||
directory (don't ask - that's just how it works). And instead
|
||||
of `sudo make install` you should just install the deb with
|
||||
`dpkg -i ../gophernicus_*.deb` after which It Should Just
|
||||
Work(tm).
|
||||
|
||||
If you need TCP wrappers support on Debian/Ubuntu, please
|
||||
install libwrap0-dev before compiling.
|
||||
### Debian (and -based) (including Ubuntu) distributions
|
||||
|
||||
We used to distribute a `debian/` directory for people to `make
|
||||
deb` and then install a deb. However, thanks to the work of
|
||||
Ryan Kavanagh, gophernicus will be distributed in the official
|
||||
debian repositories in the next stable release! In the interim,
|
||||
either keep using the old version or install without deb.
|
||||
|
||||
## Cross-compiling
|
||||
|
||||
@ -137,7 +81,9 @@ must point to a local arch compiler, and CC to the target
|
||||
arch one.
|
||||
|
||||
```
|
||||
$ make HOSTCC=gcc CC=target-arch-gcc
|
||||
$ export HOSTCC=gcc CC=target-arch-gcc
|
||||
$ ./configure ....
|
||||
$ make
|
||||
```
|
||||
|
||||
## Shared memory issues
|
||||
@ -157,7 +103,6 @@ let Gophernicus recreate it - no harm done:
|
||||
$ sudo make clean-shm
|
||||
```
|
||||
|
||||
|
||||
## Porting to different platforms
|
||||
|
||||
If you need to port Gophernicus to a new platform, please take a look at
|
||||
@ -168,17 +113,15 @@ the patches to <gophernicus at gophernicus dot org> so we can include
|
||||
them into the next release -- or even better, commit them to your fork
|
||||
on Github and make a pull request!
|
||||
|
||||
## Supported Platforms
|
||||
## For packagers
|
||||
|
||||
| Platform | Versions |
|
||||
| ------------ | ---------------------------- |
|
||||
| Ubuntu | 18.04, 16.04 |
|
||||
| Debian | Sid, Buster, Stretch, Jessie |
|
||||
| Centos | 7, 6 |
|
||||
| Fedora | 29, 30, Rawhide |
|
||||
| Opensuse | Leap, Tumbleweed |
|
||||
| Arch Linux | up to date |
|
||||
| Gentoo | up to date |
|
||||
| Alpine Linux | Edge, 3.9 |
|
||||
| FreeBSD | 12.0 |
|
||||
| Darwin (Mac) | OSX 10.7 |
|
||||
Are you looking to package gophernicus for a Linux
|
||||
distribution? Thanks! Please see issue #50 to help. Some tips:
|
||||
|
||||
- Hostnames will need to be configured by users at runtime, the
|
||||
installed gophernicus.env will need to be a config file.
|
||||
- You probably want to support as many listeners as possible.
|
||||
We allow this through the use of a comma seperated list to
|
||||
`--listener`.
|
||||
- The default gopher root is `/var/gopher`; many disributions
|
||||
prefer `/srv`.
|
||||
|
269
Makefile
269
Makefile
@ -1,269 +0,0 @@
|
||||
NAME = gophernicus
|
||||
PACKAGE = $(NAME)
|
||||
BINARY = $(NAME)
|
||||
VERSION = 3.1
|
||||
CODENAME = Dungeon Edition
|
||||
|
||||
SOURCES = src/$(NAME).c src/file.c src/menu.c src/string.c src/platform.c src/session.c src/options.c src/log.c
|
||||
HEADERS = src/files.h src/filetypes.h
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
README = README.md
|
||||
|
||||
DESTDIR = /usr
|
||||
OSXDIR = /usr/local
|
||||
SBINDIR = $(DESTDIR)/sbin
|
||||
DOCDIR = $(DESTDIR)/share/doc/$(PACKAGE)
|
||||
MANPAGE = gophernicus.1
|
||||
MANDEST = $(DESTDIR)/share/man/man1/gophernicus.1
|
||||
|
||||
INSTALL = PATH=$$PATH:/usr/sbin ./install-sh -o 0 -g 0
|
||||
ROOT = /var/gopher
|
||||
OSXROOT = /Library/GopherServer
|
||||
WRTROOT = /gopher
|
||||
MAP = gophermap
|
||||
|
||||
INETD = /etc/inetd.conf
|
||||
XINETD = /etc/xinetd.d
|
||||
# get OPTIONS line from gophernicus.env and use that also for inetd
|
||||
INETOPT = $$(grep '^OPTIONS=' $(NAME).env | tail -n 1 | sed -e 's/OPTIONS="*//;s/"*$$//')
|
||||
INETLIN = "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) $(INETOPT)"
|
||||
INETPID = /var/run/inetd.pid
|
||||
LAUNCHD = /Library/LaunchDaemons
|
||||
PLIST = org.$(NAME).server.plist
|
||||
NET_SRV = /boot/common/settings/network/services
|
||||
SYSTEMD = /lib/systemd/system /usr/lib/systemd/system
|
||||
HAS_STD = /run/systemd/system
|
||||
SYSCONF = /etc/sysconfig
|
||||
DEFAULT = /etc/default
|
||||
|
||||
CC ?= cc
|
||||
CFLAGS := -O2 -Wall $(CFLAGS)
|
||||
LDFLAGS := $(LDFLAGS)
|
||||
|
||||
IPCRM = /usr/bin/ipcrm
|
||||
|
||||
all:
|
||||
@case $$(uname) in \
|
||||
Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDIr)" src/$(BINARY); ;; \
|
||||
Haiku) $(MAKE) LDFLAGS="$(LDFLAGS) -lnetwork" src/$(BINARY); ;; \
|
||||
*) if [ -f "/usr/include/tcpd.h" ]; then $(MAKE) withwrap; else $(MAKE) src/$(BINARY); fi; ;; \
|
||||
esac
|
||||
|
||||
withwrap:
|
||||
$(MAKE) CFLAGS="$(CFLAGS) -DHAVE_LIBWRAP" LDFLAGS="$(LDFLAGS) -lwrap" src/$(BINARY)
|
||||
|
||||
deb:
|
||||
dpkg-buildpackage -rfakeroot -uc -us
|
||||
|
||||
headers: $(HEADERS)
|
||||
|
||||
src/$(NAME).c: headers src/$(NAME).h
|
||||
|
||||
src/$(BINARY): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(CFLAGS) -o $@ $(LDFLAGS)
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -DVERSION="\"$(VERSION)\"" -DCODENAME="\"$(CODENAME)\"" -DDEFAULT_ROOT="\"$(ROOT)\"" $< -o $@
|
||||
|
||||
src/filetypes.h: src/filetypes.conf
|
||||
sh src/filetypes.sh < src/filetypes.conf > $@
|
||||
|
||||
src/bin2c: src/bin2c.c
|
||||
$(CC) src/bin2c.c -o $@
|
||||
|
||||
README: $(README)
|
||||
cat $(README) > $@
|
||||
|
||||
src/files.h: src/bin2c README
|
||||
sed -e '/^(end of option list)/,$$d' README > README.options
|
||||
./src/bin2c -0 -n README README.options > $@
|
||||
./src/bin2c -0 LICENSE >> $@
|
||||
./src/bin2c -n ERROR_GIF error.gif >> $@
|
||||
@echo
|
||||
|
||||
# Clean cases
|
||||
|
||||
clean: clean-build clean-deb
|
||||
|
||||
clean-build:
|
||||
rm -rf src/$(BINARY) $(OBJECTS) $(HEADERS) README.options README src/bin2c
|
||||
|
||||
clean-deb:
|
||||
if [ -d debian/$(PACKAGE) ]; then fakeroot debian/rules clean; fi
|
||||
|
||||
clean-shm:
|
||||
if [ -x $(IPCRM) ]; then $(IPCRM) -M $$(awk '/SHM_KEY/ { print $$3 }' src/$(NAME).h) || true; fi
|
||||
|
||||
# Install cases
|
||||
|
||||
install: clean-shm
|
||||
@case $$(uname) in \
|
||||
Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDIR)" install-files install-docs install-root install-osx install-done; ;; \
|
||||
Haiku) $(MAKE) SBINDIR=/boot/common/bin DOCDIR=/boot/common/share/doc/$(PACKAGE) \
|
||||
install-files install-docs install-root install-haiku install-done; ;; \
|
||||
*) $(MAKE) install-files install-docs install-root; ;; \
|
||||
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 install-done; fi
|
||||
|
||||
.PHONY: install
|
||||
|
||||
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
|
||||
@echo "Gopher URL...: gopher://$$(hostname)/"
|
||||
@for CONFFILE in /etc/sysconfig/gophernicus \
|
||||
/etc/default/gophernicus \
|
||||
/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 $$CONFFILE ]; then echo "Configuration: $$CONFFILE"; break; fi; done;
|
||||
@echo
|
||||
@echo "======================================================================"
|
||||
@echo
|
||||
|
||||
install-files: src/$(BINARY)
|
||||
mkdir -p $(SBINDIR)
|
||||
$(INSTALL) -s -m 755 src/$(BINARY) $(SBINDIR)
|
||||
@echo
|
||||
|
||||
install-docs:
|
||||
mkdir -p $(DOCDIR)
|
||||
$(INSTALL) -m 644 $(MANPAGE) $(MANDEST)
|
||||
@echo
|
||||
|
||||
install-root:
|
||||
if [ ! -d "$(ROOT)" -o ! -f "$(ROOT)/$(MAP)" ]; then \
|
||||
mkdir -p $(ROOT); \
|
||||
$(INSTALL) -m 644 $(MAP).sample $(ROOT); \
|
||||
ln -fs $(DOCDIR) $(ROOT)/docs; \
|
||||
fi
|
||||
@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-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; \
|
||||
fi
|
||||
@echo
|
||||
|
||||
install-osx:
|
||||
if [ -d "$(LAUNCHD)" -a ! -f "$(LAUNCHD)/$(PLIST)" ]; then \
|
||||
sed -e "s/@HOSTNAME@/$$(hostname)/g" src/$(PLIST) > $(LAUNCHD)/$(PLIST); \
|
||||
launchctl load $(LAUNCHD)/$(PLIST); \
|
||||
fi
|
||||
@echo
|
||||
chown -h root:admin $(ROOT) $(ROOT)/*
|
||||
chmod -h 0775 $(ROOT) $(ROOT)/docs
|
||||
@echo
|
||||
|
||||
install-haiku:
|
||||
if [ -f "$(NET_SRV)" -a ! "$$(grep -m1 gopher $(NET_SRV))" ]; then \
|
||||
(echo ""; \
|
||||
echo "service gopher {"; \
|
||||
echo " family inet"; \
|
||||
echo " protocol tcp"; \
|
||||
echo " port 70"; \
|
||||
echo " launch $(BINARY) -h $$(hostname)"; \
|
||||
echo "}") >> $(NET_SRV); \
|
||||
fi
|
||||
@echo
|
||||
chown user:root $(DOCDIR)/* $(SBINDIR)/$(BINARY) $(ROOT)/$(MAP)
|
||||
@echo
|
||||
ps | grep net_server | grep -v grep | awk '{ print $$2 }' | xargs kill
|
||||
nohup /boot/system/servers/net_server >/dev/null 2>/dev/null &
|
||||
@echo
|
||||
|
||||
install-systemd: install-files install-docs install-root
|
||||
if [ -d "$(HAS_STD)" ]; then \
|
||||
if [ -d "$(SYSCONF)" -a ! -f "$(SYSCONF)/$(NAME)" ]; then \
|
||||
$(INSTALL) -m 644 init/$(NAME).env $(SYSCONF)/$(NAME); \
|
||||
fi; \
|
||||
if [ ! -d "$(SYSCONF)" -a -d "$(DEFAULT)" -a ! -f $(DEFAULT)/$(NAME) ]; then \
|
||||
$(INSTALL) -m 644 init/$(NAME).env $(DEFAULT)/$(NAME); \
|
||||
fi; \
|
||||
for DIR in $(SYSTEMD); do \
|
||||
if [ -d "$$DIR" ]; then \
|
||||
$(INSTALL) -m 644 init/$(NAME).socket init/$(NAME)\@.service $$DIR; \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
if pidof systemd ; then \
|
||||
systemctl daemon-reload; \
|
||||
systemctl enable $(NAME).socket; \
|
||||
systemctl start $(NAME).socket; \
|
||||
fi; \
|
||||
fi
|
||||
@echo
|
||||
|
||||
# Uninstall cases
|
||||
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
|
||||
rm -rf $(MANDEST)
|
||||
@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; \
|
||||
[ -x /sbin/service ] && service xinetd reload; \
|
||||
fi
|
||||
@echo
|
||||
|
||||
uninstall-launchd:
|
||||
if [ -f $(LAUNCHD)/$(PLIST) ]; then \
|
||||
launchctl unload $(LAUNCHD)/$(PLIST); \
|
||||
rm -f $(LAUNCHD)/$(PLIST); \
|
||||
fi
|
||||
if [ -L $(ROOT) ]; then \
|
||||
rm -f $(ROOT); \
|
||||
fi
|
||||
@echo
|
||||
|
||||
uninstall-systemd:
|
||||
if [ -d "$(HAS_STD)" ]; then \
|
||||
for DIR in $(SYSTEMD); do \
|
||||
if [ -f "$$DIR/$(NAME).socket" ]; then \
|
||||
systemctl stop $(NAME).socket; \
|
||||
systemctl disable $(NAME).socket; \
|
||||
rm -f $$DIR/$(NAME).socket $$DIR/$(NAME)\@.service $(SYSCONF)/$(NAME) $(DEFAULT)/$(NAME); \
|
||||
systemctl daemon-reload; \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
@echo
|
157
Makefile.in
Normal file
157
Makefile.in
Normal file
@ -0,0 +1,157 @@
|
||||
NAME = gophernicus
|
||||
PACKAGE = $(NAME)
|
||||
BINARY = $(NAME)
|
||||
VERSION = 3.1
|
||||
CODENAME = Dungeon Edition
|
||||
|
||||
SOURCES = src/$(NAME).c src/file.c src/menu.c src/string.c src/platform.c src/session.c src/options.c src/log.c
|
||||
HEADERS = src/files.h src/filetypes.h
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
README = README.md
|
||||
MANPAGE = gophernicus.8
|
||||
MAP = gophermap
|
||||
|
||||
DESTDIR ?= /
|
||||
PREFIX = @PREFIX@
|
||||
BINDIR = @BINDIR@
|
||||
SBINDIR = @SBINDIR@
|
||||
MANDIR = @MANDIR@
|
||||
MAN8DIR = @MAN8DIR@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_ARGS = -o 0 -g 0
|
||||
ROOT = @ROOT@
|
||||
OSXROOT = /Library/GopherServer
|
||||
|
||||
INETD = @INETD_CONF@
|
||||
XINETD = @XINETD_CONF@
|
||||
# get OPTIONS line from gophernicus.env and use that also for inetd
|
||||
INETOPT = $$(grep '^OPTIONS=' init/$(NAME).env | tail -n 1 | sed -e 's/OPTIONS="*//;s/"*$$//')
|
||||
LAUNCHD = @LAUNCHD@
|
||||
PLIST = org.$(NAME).server.plist
|
||||
HAIKU_SRV = @HAIKUSRV@
|
||||
DEFAULT = @DEFAULT@
|
||||
SYSCONF = @SYSCONF@
|
||||
|
||||
CC ?= @CC@
|
||||
HOSTCC ?= @HOSTCC@
|
||||
CFLAGS := -O2 -Wall @LIBWRAP@ $(CFLAGS)
|
||||
LDFLAGS := $(LDFLAGS)
|
||||
|
||||
IPCRM ?= @IPCRM@
|
||||
MAKE ?= @MAKE@
|
||||
|
||||
all:
|
||||
$(MAKE) headers
|
||||
$(MAKE) src/$(BINARY)
|
||||
|
||||
headers: $(HEADERS)
|
||||
|
||||
src/$(NAME).c: src/$(NAME).h
|
||||
|
||||
src/$(BINARY): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(CFLAGS) -o $@ $(LDFLAGS)
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -DVERSION="\"$(VERSION)\"" -DCODENAME="\"$(CODENAME)\"" -DDEFAULT_ROOT="\"$(ROOT)\"" $< -o $@
|
||||
|
||||
src/filetypes.h: src/filetypes.conf
|
||||
sh src/filetypes.sh < src/filetypes.conf > $@
|
||||
|
||||
src/bin2c: src/bin2c.c
|
||||
$(HOSTCC) src/bin2c.c -o $@
|
||||
|
||||
src/files.h: src/bin2c
|
||||
sed -e '/^(end of option list)/,$$d' README.md > README.options
|
||||
./src/bin2c -0 -n README README.options > $@
|
||||
./src/bin2c -0 LICENSE >> $@
|
||||
./src/bin2c -n ERROR_GIF error.gif >> $@
|
||||
|
||||
# Clean cases
|
||||
|
||||
clean: @CLEAN_SHM@
|
||||
rm -rf src/$(BINARY) $(OBJECTS) $(HEADERS) README.options README src/bin2c
|
||||
|
||||
clean-shm:
|
||||
$(IPCRM) -M $$(awk '/SHM_KEY/ { print $$3 }' src/$(NAME).h) || true
|
||||
|
||||
# Install cases
|
||||
|
||||
install: src/$(BINARY) @CLEAN_SHM@ install-man @INSTALL_ROOT@ @INSTALL_OSX@ @INSTALL_HAIKU@ @INSTALL_SYSTEMD@ @INSTALL_XINETD@ @INSTALL_INETD_MANUAL@ @INSTALL_INETD_UPDATE@
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(SBINDIR)
|
||||
$(INSTALL) -s -m 755 -t $(DESTDIR)$(SBINDIR) src/$(BINARY)
|
||||
@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
|
||||
@echo "Gopher URL...: gopher://$$(hostname)/"
|
||||
@echo
|
||||
@echo "======================================================================"
|
||||
@echo
|
||||
|
||||
install-man:
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(MAN8DIR)
|
||||
$(INSTALL) -m 644 -t $(DESTDIR)$(MAN8DIR) $(MANPAGE)
|
||||
|
||||
install-root:
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(ROOT)
|
||||
$(INSTALL) -m 644 $(MAP).sample $(DESTDIR)$(ROOT)/gophermap
|
||||
|
||||
install-inetd-update: install-root
|
||||
update-inetd --add $$(sed -e "s/@BINARY_PATH@/$(DESTDIR)$(SBINDIR)$(BINARY)/g" -e "s/@BINARY_NAME@/$(BINARY)/g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in)
|
||||
|
||||
install-inetd-manual: install-root
|
||||
sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@BINARY_NAME@/$(BINARY)/g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in >> $(DESTDIR)$(INETD)
|
||||
|
||||
install-xinetd: install-root
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)/etc/xinetd.d
|
||||
$(INSTALL) -m 644 -T init/$(NAME).xinetd $(DESTDIR)$(XINETD)
|
||||
|
||||
install-osx: install-root
|
||||
$(INSTALL) -m 644 init/$(PLIST) $(DESTDIR)$(LAUNCHD)
|
||||
chown -h root:admin $(DESTDIR)$(ROOT) $(DESTDIR)$(ROOT)/*
|
||||
chmod -h 0775 $(DESTDIR)$(ROOT)
|
||||
|
||||
install-haiku: install-root
|
||||
sed -e "s/@BINARY@/$(BINARY)/g" init/haiku_snippet.in >> $(DESTDIR)$(HAIKU_SRV)
|
||||
chown user:root $(DESTDIR)$(DOCDIR)/* $(DESTDIR)$(SBINDIR)/$(BINARY) $(DESTDIR)$(ROOT)/$(MAP)
|
||||
|
||||
install-systemd: install-root
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(SYSCONF)
|
||||
$(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(SYSCONF)/$(NAME)
|
||||
$(INSTALL) -m 644 -T init/$(NAME).socket $(DESTDIR)$(SYSCONF)/$(NAME)
|
||||
$(INSTALL) -m 644 -T init/$(NAME)\@.service $(DESTDIR)$(SYSCONF)/$(NAME)
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(DEFAULT)
|
||||
$(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
$(INSTALL) -m 644 -T init/$(NAME).socket $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
$(INSTALL) -m 644 init/$(NAME)\@.service $(DESTDIR)$(DEFAULT)/$(NAME)
|
||||
|
||||
uninstall: @UNINSTALL_INETD_UPDATE@ @UNINSTALL_INETD_MANUAL@ @UNINSTALL_XINETD@ @UNINSTALL_OSX@ @UNINSTALL_SYSTEMD@
|
||||
rm -f $(DESTDIR)$(SBINDIR)/$(BINARY)
|
||||
rm -f $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
|
||||
|
||||
uninstall-inetd-update:
|
||||
update-inetd --remove "^gopher.*gophernicus"
|
||||
|
||||
uninstall-inetd-manual:
|
||||
sed -i '/^gopher/d' $(DESTDIR)$(INETD)
|
||||
|
||||
uninstall-xinetd:
|
||||
rm -f $(DESTDIR)$(XINETD)
|
||||
|
||||
uninstall-osx:
|
||||
rm -f $(DESTDIR)$(LAUNCHD)/$(PLIST)
|
||||
|
||||
uninstall-haiku:
|
||||
rm -f $(DESTDIR)$(HAIKU_SRV)
|
||||
|
||||
uninstall-systemd:
|
||||
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME).env
|
||||
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME).socket
|
||||
rm -f $(DESTDIR)$(SYSCONF)/$(NAME)/$(NAME)\@.service
|
||||
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME).env
|
||||
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME).socket
|
||||
rm -f $(DESTDIR)$(DEFAULT)/$(NAME)/$(NAME)\@.service
|
332
configure
vendored
Executable file
332
configure
vendored
Executable file
@ -0,0 +1,332 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Is similar to an autoconf configure script, but is written by hand
|
||||
|
||||
usage() {
|
||||
printf "Usage: %s [options]\\n\\n" "$0"
|
||||
printf " --prefix=/usr/local Prefix for all files\\n"
|
||||
printf " --bindir=PREFIX/bin Prefix for binaries\\n"
|
||||
printf " --sbindir=PREFIX/sbin Prefix for system binaries\\n"
|
||||
printf " --mandir=PREFIX/share/man Prefix for manpages\\n"
|
||||
printf " --man8dir=MANDIR/man8 Prefix for section 8 manpages\\n"
|
||||
printf " --gopherroot=/var/gopher Path to gopher root\\n"
|
||||
printf " --sysconfig=/etc/sysconfig Path to sysconfig directory\\n\\n"
|
||||
printf " --default=/etc/default Path to 'default' configuration directory\\n\\n"
|
||||
printf " --launchd=/Library/LaunchDaemons Path to launchd for MacOS\\n"
|
||||
printf " --haikusrv=/boot/common/settings/network/services Path to services directory in Haiku\\n\\n"
|
||||
printf " --os=autodetected Your target OS, one of linux, mac, haiku, netbsd, openbsd or freebsd\\n"
|
||||
printf " --listener=somelistener Program to recieve and pass network requests; one or more of systemd, inetd, xinetd, comma-seperated, or autodetect, mac or haiku (parameter required, mac/haiku required on respective OSes)\\n"
|
||||
printf " --hostname=autodetected Desired hostname for gophernicus to identify as\\n"
|
||||
}
|
||||
|
||||
# Set values for each option
|
||||
while [ "$#" -gt 0 ] ; do
|
||||
opt="${1%%=*}"
|
||||
opt="${opt##--}"
|
||||
value="${1##*=}"
|
||||
case "${opt}" in
|
||||
prefix) PREFIX="${value}"; shift ;;
|
||||
bindir) BINDIR="${value}"; shift ;;
|
||||
sbindir) SBINDIR="${value}"; shift ;;
|
||||
docdir) DOCDIR="${value}"; shift ;;
|
||||
mandir) MANDIR="${value}"; shift ;;
|
||||
man8dir) MAN8DIR="${value}"; shift ;;
|
||||
gopherroot) GOPHERROOT="${value}"; shift ;;
|
||||
sysconfig) SYSCONFIG="${value}"; shift ;;
|
||||
default) DEFAULTCONF="${value}"; shift ;;
|
||||
os) OS="${value}"; shift ;;
|
||||
launchd) LAUNCHD="${value}"; shift ;;
|
||||
haikusrv) HAIKUSRV="${value}"; shift ;;
|
||||
listener) LISTENER="${value}"; shift ;;
|
||||
hostname) HOSTNAME="${value}"; shift ;;
|
||||
help) usage; exit 0 ;;
|
||||
*) usage; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Set default values
|
||||
: ${PREFIX:=/usr/local}
|
||||
: ${BINDIR:=${PREFIX}/bin}
|
||||
: ${SBINDIR:=${PREFIX}/sbin}
|
||||
: ${DOCDIR:=${PREFIX}/share/doc}
|
||||
: ${MANDIR:=${PREFIX}/share/man}
|
||||
: ${MAN8DIR:=${MANDIR}/man8}
|
||||
: ${GOPHERROOT:=/var/gopher}
|
||||
: ${SYSCONFIG:=/etc/sysconfig}
|
||||
: ${DEFAULTCONF:=/etc/default}
|
||||
: ${LAUNCHD:=/Library/LaunchDaemons}
|
||||
: ${HAIKUSRV:=/boot/common/settings/network/services}
|
||||
: ${CC:=cc}
|
||||
: ${HOSTCC:=${CC}}
|
||||
: ${CFLAGS:=-O2}
|
||||
: ${HOSTNAME:=autodetect}
|
||||
|
||||
# Check for a compiler that actually works
|
||||
printf "checking for working compiler... "
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdlib.h>
|
||||
int main() { return 0; }
|
||||
EOF
|
||||
if ! ${CC} -o conftest conftest.c; then
|
||||
printf "no\\n"
|
||||
exit 1
|
||||
else
|
||||
printf "${CC}\\n"
|
||||
fi
|
||||
|
||||
# Autodetect the OS
|
||||
if [ -z "${OS}" ]; then
|
||||
# If it can't find uname, it needs to be manually specified
|
||||
printf "checking for uname... "
|
||||
if ! UNAME="$(command -v uname)"; then
|
||||
printf "please provide OS in options\\n"
|
||||
exit 1
|
||||
else
|
||||
printf "%s\\n" "${UNAME}"
|
||||
fi
|
||||
|
||||
# If it can, it presses on
|
||||
printf "checking for OS... "
|
||||
case "$(${UNAME})" in
|
||||
Linux) OS=linux ;;
|
||||
Haiku) OS=haiku
|
||||
INSTALL_HAIKU="install-haiku" ;;
|
||||
Darwin) OS=mac
|
||||
INSTALL_OSX="install-osx" ;;
|
||||
NetBSD) OS=netbsd ;;
|
||||
OpenBSD) OS=openbsd ;;
|
||||
FreeBSD) OS=freebsd ;;
|
||||
*) printf "unknown, pressing on anyway\\n" ;;
|
||||
esac
|
||||
printf "%s\\n" "${OS}"
|
||||
fi
|
||||
|
||||
# Checks for an install command and falls back to install-sh
|
||||
printf "checking for install... "
|
||||
if ! INSTALL="$(command -v install)"; then
|
||||
printf "install-sh"
|
||||
INSTALL=build-aux/install-sh
|
||||
else
|
||||
# Check it has required features (*cough* macos)
|
||||
mkdir testconf
|
||||
touch testfile
|
||||
${INSTALL} -t testconf testfile || INSTALL=build-aux/install-sh
|
||||
rm testconf/testfile
|
||||
${INSTALL} -T testfile testconf/testfile || INSTALL=build-aux/install-sh
|
||||
rm -r testconf testfile
|
||||
printf "%s" "${INSTALL}"
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
listeners="$(echo ${LISTENER} | tr ',' ' ')"
|
||||
for listener in ${listeners}; do
|
||||
# Check for listener validity and autodetect if required
|
||||
# Checks that take place:
|
||||
# mac OS = mac listener (both ways)
|
||||
# haiku OS = haiku listener (both ways)
|
||||
# systemd listener = linux OS
|
||||
printf "checking for listener... "
|
||||
if [ -z "${listener}" ]; then
|
||||
printf "not given\\n"
|
||||
exit 1
|
||||
elif [ "${listener}" = "mac" ] && [ "${OS}" != "mac" ]; then
|
||||
printf "mac listener only valid with macos\\n"
|
||||
exit 1
|
||||
elif [ "${listener}" = "haiku" ] && [ "${OS}" != "haiku" ]; then
|
||||
printf "haiku listener only valid with haiku\\n"
|
||||
exit 1
|
||||
elif [ "${listener}" = "systemd" ] && [ "${OS}" != "linux" ]; then
|
||||
printf "systemd listener only valid with linux\\n"
|
||||
exit 1
|
||||
elif [ "${listener}" = "autodetect" ]; then
|
||||
# OS-specific listeners
|
||||
case "${OS}" in
|
||||
mac)
|
||||
LISTENER=mac
|
||||
printf "mac\\n"
|
||||
break ;;
|
||||
haiku)
|
||||
LISTENER=haiku
|
||||
printf "haiku\\n"
|
||||
break ;;
|
||||
esac
|
||||
|
||||
if [ -d "/lib/systemd/system" ] ; then
|
||||
LISTENER=systemd
|
||||
printf "systemd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
printf "checking for inetd... "
|
||||
if command -v update-inetd; then
|
||||
LISTENER=inetd
|
||||
printf "inetd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
printf "checking for xinetd... "
|
||||
if XINETD="$(command -v xinetd)"; then
|
||||
LISTENER=xinetd
|
||||
printf "xinetd\\n"
|
||||
break
|
||||
fi
|
||||
|
||||
# Ensure we detected something
|
||||
if [ "${listener}" = "autodetect" ]; then
|
||||
printf "unable to autodetect, please manually specify\\n"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${OS}" = "haiku" ] && [ "${listener}" != "haiku" ]; then
|
||||
printf "only haiku listener supported on haiku\\n"
|
||||
exit 1
|
||||
elif [ "${OS}" = "mac" ] && [ "${listener}" != "mac" ]; then
|
||||
printf "only mac listener supported on mac\\n"
|
||||
exit 1
|
||||
else
|
||||
printf "%s\\n" "${listener}"
|
||||
fi
|
||||
|
||||
# Act accordingly based on whichever listener we are given
|
||||
case "${listener}" in
|
||||
systemd)
|
||||
INSTALL_SYSTEMD="install-systemd"
|
||||
UNINSTALL_SYSTEMD="uninstall-systemd" ;;
|
||||
xinetd)
|
||||
INSTALL_XINETD="install-xinetd"
|
||||
UNINSTALL_XINETD="uninstall-xinetd"
|
||||
XINETD_CONF="/etc/xinetd.d/gophernicus" ;;
|
||||
inetd)
|
||||
INSTALL_INETD="install-inetd"
|
||||
INETD_CONF="/etc/inetd.conf"
|
||||
printf "checking for update-inetd... "
|
||||
if ! UPDATE_INETD="$(command -v update-inetd)"; then
|
||||
printf "not found\\n"
|
||||
INSTALL_INETD_MANUAL="install-inetd-manual"
|
||||
UNINSTALL_INETD_UPDATE="uninstall-inetd-manual"
|
||||
else
|
||||
printf "%s\\n" "${UPDATE_INETD}"
|
||||
INSTALL_INETD_UPDATE="install-inetd-update"
|
||||
UNINSTALL_INETD_UPDATE="uninstall-inetd-update"
|
||||
fi
|
||||
;;
|
||||
mac) INSTALL_OSX="install-osx" UNINSTALL_OSX="uninstall-osx" ;;
|
||||
haiku) INSTALL_HAIKU="install-haiku" UNINSTALL_HAIKU="uninstall-haiku" ;;
|
||||
*) printf "The listener %s is not offically supported; continuing anyway.\\n" "${listener}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Try to detect hostname
|
||||
printf "checking current hostname... "
|
||||
if [ "${HOSTNAME}" = "autodetect" ]; then
|
||||
HOSTNAME="$(hostname)"
|
||||
# If no hostname then we couldn't autodetect
|
||||
if [ $? != 0 ] || [ -z "${HOSTNAME}" ]; then
|
||||
printf "unable to detect hostname\\n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
printf "%s\\n" "${HOSTNAME}"
|
||||
|
||||
# Use libwrap when it is avaliable
|
||||
printf "checking for libwrap... "
|
||||
cat > conftest.c <<EOF
|
||||
#include <tcpd.h>
|
||||
int main() {}
|
||||
EOF
|
||||
if ${CC} -o conftest -lwrap conftest.c 2>/dev/null; then
|
||||
LIBWRAP="-DHAVE_LIBWRAP -lwrap"
|
||||
printf "yes"
|
||||
else
|
||||
LIBWRAP=
|
||||
printf "no, but program will still work"
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
# Check and use SHM if avaliable
|
||||
printf "checking for ipcrm (SHM management)... "
|
||||
if ! IPCRM="$(command -v ipcrm)"; then
|
||||
printf "not found"
|
||||
else
|
||||
printf "%s" "${IPCRM}"
|
||||
CLEAN_SHM="clean-shm"
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
# Trying to autodetect make
|
||||
printf "checking for make... "
|
||||
if ! MAKE="$(command -v make)"; then
|
||||
printf "not found, please pass MAKE=/path/to/make to make invocation"
|
||||
MAKE="make"
|
||||
else
|
||||
printf "%s" "${MAKE}"
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
# Don't replace an existing root
|
||||
printf "checking for existing gopher root... "
|
||||
if [ -d "${GOPHERROOT}" ] || [ -f "${GOPHERROOT}/gophermap" ]; then
|
||||
INSTALL_ROOT="install-root"
|
||||
printf "yes"
|
||||
else
|
||||
printf "no"
|
||||
fi
|
||||
printf "\\n"
|
||||
|
||||
# Sub in values
|
||||
cp Makefile.in Makefile
|
||||
|
||||
printf "creating Makefile... "
|
||||
sed -i -e "s:@CC@:${CC}:" Makefile
|
||||
sed -i -e "s:@HOSTCC@:${HOSTCC}:" Makefile
|
||||
sed -i -e "s:@LIBWRAP@:${LIBWRAP}:" Makefile
|
||||
sed -i -e "s:@INSTALL@:${INSTALL}:" Makefile
|
||||
sed -i -e "s:@MAKE@:${MAKE}:" Makefile
|
||||
|
||||
sed -i -e "s:@PREFIX@:${PREFIX}:" Makefile
|
||||
sed -i -e "s:@BINDIR@:${BINDIR}:" Makefile
|
||||
sed -i -e "s:@SBINDIR@:${SBINDIR}:" Makefile
|
||||
sed -i -e "s:@DOCDIR@:${DOCDIR}:" Makefile
|
||||
sed -i -e "s:@MANDIR@:${MANDIR}:" Makefile
|
||||
sed -i -e "s:@MAN8DIR@:${MAN8DIR}:" Makefile
|
||||
|
||||
sed -i -e "s:@IPCRM@:${IPCRM}:" Makefile
|
||||
sed -i -e "s:@CLEAN_SHM@:${CLEAN_SHM}:" Makefile
|
||||
|
||||
sed -i -e "s:@SYSCONF@:${SYSCONFIG}:" Makefile
|
||||
sed -i -e "s:@DEFAULT@:${DEFAULTCONF}:" Makefile
|
||||
sed -i -e "s:@HOSTNAME@:${HOSTNAME}:" Makefile
|
||||
sed -i -e "s:@ROOT@:${GOPHERROOT}:" Makefile
|
||||
|
||||
sed -i -e "s:@HAIKUSRV@:${HAIKUSRV}:" Makefile
|
||||
sed -i -e "s:@LAUNCHD@:${LAUNCHD}:" Makefile
|
||||
sed -i -e "s:@INSTALL_ROOT@:${INSTALL_ROOT}:" Makefile
|
||||
|
||||
sed -i -e "s:@INSTALL_OSX@:${INSTALL_OSX}:" Makefile
|
||||
sed -i -e "s:@INSTALL_INETD_MANUAL@:${INSTALL_INETD_MANUAL}:" Makefile
|
||||
sed -i -e "s:@INSTALL_INETD_UPDATE@:${INSTALL_INETD_UPDATE}:" Makefile
|
||||
sed -i -e "s:@INSTALL_XINETD@:${INSTALL_XINETD}:" Makefile
|
||||
sed -i -e "s:@INSTALL_SYSTEMD@:${INSTALL_SYSTEMD}:" Makefile
|
||||
sed -i -e "s:@INSTALL_HAIKU@:${INSTALL_HAIKU}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_OSX@:${UNINSTALL_OSX}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_INETD_MANUAL@:${UNINSTALL_INETD_MANUAL}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_INETD_UPDATE@:${UNINSTALL_INETD_UPDATE}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_XINETD@:${UNINSTALL_XINETD}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_SYSTEMD@:${UNINSTALL_SYSTEMD}:" Makefile
|
||||
sed -i -e "s:@UNINSTALL_HAIKU@:${UNINSTALL_HAIKU}:" Makefile
|
||||
|
||||
sed -i -e "s:@INETD_CONF@:${INETD_CONF}:" Makefile
|
||||
sed -i -e "s:@XINETD_CONF@:${XINETD_CONF}:" Makefile
|
||||
|
||||
printf "done\\n"
|
||||
|
||||
# Also sub in $HOSTNAME to the various init systems (whether or not we really
|
||||
# use them, its just easier)
|
||||
for f in gophernicus.env haiku_snippet org.gophernicus.server.plist \
|
||||
gophernicus.xinetd; do
|
||||
printf "creating init/${f}... "
|
||||
sed -e "s:@HOSTNAME@:${HOSTNAME}:" "init/${f}.in" > "init/${f}"
|
||||
printf "done\\n"
|
||||
done
|
||||
|
||||
# Cleanup
|
||||
rm -f conftest conftest.c
|
89
debian/changelog
vendored
89
debian/changelog
vendored
@ -1,89 +0,0 @@
|
||||
gophernicus (3.1-1) experimental; urgency=medium
|
||||
|
||||
* .gitignore for restructure
|
||||
* src/bin2c.c should not be executable
|
||||
* corrected some typos in author's names (#55)
|
||||
* Merge pull request #54 from emilengler/2020-01-make-force-symlink
|
||||
* build: macOS travis fix
|
||||
* build: Force create symlink
|
||||
* Merge pull request #52 from emilengler/2020-01-new-travis
|
||||
* ci: New Travis system for linux and macOS builds and installs
|
||||
* Merge pull request #51 from emilengler/2020-01-refactor-hierarchy
|
||||
* refactor: New hierarchy and refactored Makefile
|
||||
* re-add travis
|
||||
* use user-defined CC by default
|
||||
* update development version to 3.1; next release will be 3.1
|
||||
* gophermap -> gophermap.sample debian
|
||||
* Merge pull request #47 from tallship/patch-1
|
||||
* Update gophernicus.1.man
|
||||
* gophermap -> gophermap.sample, be more descriptive with the name
|
||||
* add manpage
|
||||
* clean up Makefile
|
||||
* add -b option to git clone instead of git checkout
|
||||
* add fakeroot as dependency for dpkg
|
||||
* changelog update, todo makefile fix
|
||||
* Merge pull request #44 from tallship/patch-1
|
||||
* Update README.md
|
||||
* remove TODO
|
||||
* Merge pull request #17 from vext01/pledge-unveil
|
||||
* Add OpenBSD pledge(2) and unveil(2) support.
|
||||
* utf-8 default charset in readme.md
|
||||
* update changelog
|
||||
* Merge pull request #40 from fosslinux/utf8-charset
|
||||
* change default charset to utf-8
|
||||
* change max-width to 67 (#39)
|
||||
* change indentation from tabs to spaces
|
||||
* fix copyright
|
||||
* update copyright in README.md
|
||||
* Update INSTALL.md
|
||||
* No longer relevant
|
||||
* remove <>, was screwing up email
|
||||
* remove obselete .travis.yml
|
||||
* Update LICENSE
|
||||
* forgot to change makefile
|
||||
* Merge pull request #36 from gophernicus/3.0.1
|
||||
|
||||
-- gophernicus developers <gophernicus@gophernicus.org> Mon, 31 Dec 9999 11:59:59 +0000
|
||||
|
||||
gophernicus (3.0.1-1) unstable; urgency=medium
|
||||
|
||||
* add installation notes to git checkout before installing
|
||||
* fix typo in debian packaging (fixes `make deb`)
|
||||
* update docs to reflect new changes
|
||||
* fix indenting and typos in docs
|
||||
|
||||
-- gophernicus developers <gophernicus@gophernicus.org> Sun, 21 Jul 2019 18:36:08 +1000
|
||||
|
||||
gophernicus (3.0-1.1) unstable; urgency=medium
|
||||
|
||||
* N.B. this version has two important changes that may make it
|
||||
backwards-incompatible:
|
||||
* binary changed from in.gophernicus to gophernicus
|
||||
* virtual hosting NEVER WORKED and does not work in the way previously
|
||||
described
|
||||
* Other changes:
|
||||
* prevent leak of executable gophermap contents
|
||||
* make sure {x,}inetd works when systemd is on the system
|
||||
* allow -j flag to work
|
||||
* add h9bnks (yargo) and fosslinux into developer roles
|
||||
* add -nx flag, blocks executable gophermaps
|
||||
* add -nu flag, disable ~/public_gopher
|
||||
* modify various documentation to markdown
|
||||
* fix various formattings and typos
|
||||
* allow inetd targets to work without update-inetd
|
||||
* correct handling of inetd.conf
|
||||
* remove list of supported platforms
|
||||
* remove example gophermaps
|
||||
* add dependencies for various distros to INSTALL.md
|
||||
* fix query urls
|
||||
* add travis ci
|
||||
* add documentation about CI
|
||||
* Upgrade guide:
|
||||
* If you are running gophernicus on a **production** system, **do not** upgrade
|
||||
to 3.0. Wait for 3.1.
|
||||
* As a general guide,
|
||||
* If you are running 101 and haven't upgraded to newer versions **because** of
|
||||
instability worries, **wait for 3.1**.
|
||||
* If you were running other rolling-release versions, **upgrade now**.
|
||||
|
||||
-- gophernicus developers <gophernicus@gophernicus.org> Sun, 16 Jun 2019 17:49:46 +0000
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
||||
10
|
16
debian/control
vendored
16
debian/control
vendored
@ -1,16 +0,0 @@
|
||||
Source: gophernicus
|
||||
Section: net
|
||||
Priority: extra
|
||||
Maintainer: gophernicus developers <gophernicus@gophernicus.org>
|
||||
Build-Depends: debhelper (>= 5), libwrap0-dev
|
||||
Standards-Version: 3.7.3
|
||||
Homepage: https://github.com/gophernicus/gophernicus
|
||||
|
||||
Package: gophernicus
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, debconf, netbase, libwrap0, openbsd-inetd | inet-superserver | systemd
|
||||
Recommends: lsb-release
|
||||
Suggests: php5-cli
|
||||
Description: Modern full-featured gopher server
|
||||
Gophernicus is a modern full-featured (and hopefully) secure
|
||||
gopher daemon.
|
23
debian/copyright
vendored
23
debian/copyright
vendored
@ -1,23 +0,0 @@
|
||||
Gophernicus - Copyright (c) 2009-2018 Kim Holviala <kimholviala@fastmail.com>
|
||||
2019 gophernicus developers <gophernicus@gophernicus.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDERS 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.
|
||||
|
5
debian/dirs
vendored
5
debian/dirs
vendored
@ -1,5 +0,0 @@
|
||||
usr/sbin
|
||||
var/gopher
|
||||
var/log/gophernicus
|
||||
usr/lib/gophernicus/filters
|
||||
lib/systemd/system
|
4
debian/docs
vendored
4
debian/docs
vendored
@ -1,4 +0,0 @@
|
||||
gophernicus.1
|
||||
README.gophermap
|
||||
changelog
|
||||
gophertag
|
14
debian/gophernicus.config
vendored
14
debian/gophernicus.config
vendored
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Source debconf library
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
# Ask for a hostname
|
||||
db_input high gophernicus/fqdn || true
|
||||
db_go
|
||||
|
||||
# Clear old config on reconfigure
|
||||
if [ "$1" = "reconfigure" -a -x /usr/sbin/update-inetd ]; then
|
||||
/usr/sbin/update-inetd --remove "#<off># gopher"
|
||||
fi
|
||||
|
13
debian/gophernicus.default
vendored
13
debian/gophernicus.default
vendored
@ -1,13 +0,0 @@
|
||||
# Options for Gophernicus for use with systemd
|
||||
#
|
||||
# If you are using Gophernicus with inetd this configuration file
|
||||
# is ignored and the real configuration is in /etc/inetd.conf
|
||||
#
|
||||
# See README or run "gophernicus -?" to see a full list of
|
||||
# configuration options.
|
||||
#
|
||||
# Example:
|
||||
# OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\""
|
||||
#
|
||||
# Add your options here:
|
||||
OPTIONS="-h __HOSTNAME__ -l __LOGDIR__/server.log -f /usr/lib/__PACKAGE__/filters"
|
4
debian/gophernicus.logcheck.ignore.server
vendored
4
debian/gophernicus.logcheck.ignore.server
vendored
@ -1,4 +0,0 @@
|
||||
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ gophernicus\[[0-9]+\]: request for "[^"]*" from [._[:alnum:]:-]+$
|
||||
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ gophernicus\[[0-9]+\]: error "No such file or directory" for request "[^"]*" from [._[:alnum:]:-]+$
|
||||
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ gophernicus\[[0-9]+\]: error "User not found" for request "/~[^"]*" from [._[:alnum:]:-]+$
|
||||
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ systemd\[1\]: Start(ing|ed) Gophernicus gopher server \([^[:space:]]+\)\.+$
|
7
debian/gophernicus.logrotate
vendored
7
debian/gophernicus.logrotate
vendored
@ -1,7 +0,0 @@
|
||||
/var/log/gophernicus/server.log {
|
||||
rotate 6
|
||||
weekly
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
}
|
4
debian/gophernicus.templates
vendored
4
debian/gophernicus.templates
vendored
@ -1,4 +0,0 @@
|
||||
Template: gophernicus/fqdn
|
||||
Type: string
|
||||
Default:
|
||||
Description: Fully-qualified hostname for the gopher server:
|
46
debian/postinst
vendored
46
debian/postinst
vendored
@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
# Source debconf library.
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
# Configuration
|
||||
HOSTNAME="$(hostname)"
|
||||
ROOT=/var/gopher
|
||||
PACKAGE=gophernicus
|
||||
LOGDIR=/var/log/$PACKAGE
|
||||
LIBDIR=/usr/lib/$PACKAGE
|
||||
BINARY=gophernicus
|
||||
DEFAULT=/etc/default/$PACKAGE
|
||||
USER=nobody
|
||||
|
||||
# Get hostname from debconf
|
||||
db_get gophernicus/fqdn
|
||||
if [ "$RET" ]; then
|
||||
HOSTNAME="$(echo $RET | tr -cd 'A-Za-z0-9.-')"
|
||||
fi
|
||||
|
||||
# Configure gophernicus
|
||||
if [ "$1" = "configure" ]; then
|
||||
if [ ! -f "$ROOT/gophermap" ]; then
|
||||
cp $LIBDIR/gophermap.sample $ROOT/gophermap
|
||||
fi
|
||||
|
||||
chown $USER.adm $LOGDIR
|
||||
chmod 0750 $LOGDIR
|
||||
|
||||
sed -i -e "s|-h [^ ]* |-h $HOSTNAME |" $DEFAULT
|
||||
sed -i -e "s|__PACKAGE__|$PACKAGE|g" $DEFAULT
|
||||
sed -i -e "s|__LOGDIR__|$LOGDIR|g" $DEFAULT
|
||||
|
||||
if [ -x /usr/bin/deb-systemd-helper -a -d /run/systemd/system ]; then
|
||||
/usr/bin/deb-systemd-helper enable gophernicus.socket
|
||||
/usr/bin/deb-systemd-invoke start gophernicus.socket
|
||||
else
|
||||
if [ -f /etc/inetd.conf -a -x /usr/sbin/update-inetd ]; then
|
||||
/usr/sbin/update-inetd --add "gopher\t\tstream\ttcp\tnowait\t$USER\t/usr/sbin/$BINARY\t$BINARY -h $HOSTNAME -l $LOGDIR/server.log -f /usr/lib/$PACKAGE/filters"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
11
debian/postrm
vendored
11
debian/postrm
vendored
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "purge" -a -f /etc/inetd.conf -a -x /usr/sbin/update-inetd ]; then
|
||||
/usr/sbin/update-inetd --remove "#<off># gopher"
|
||||
fi
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl --system daemon-reload >/dev/null || true
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
12
debian/prerm
vendored
12
debian/prerm
vendored
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /etc/inetd.conf -a -x /usr/sbin/update-inetd ]; then
|
||||
/usr/sbin/update-inetd --disable gopher
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/deb-systemd-helper ]; then
|
||||
/usr/bin/deb-systemd-helper disable gophernicus.socket >/dev/null
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
85
debian/rules
vendored
85
debian/rules
vendored
@ -1,85 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Gophernicus debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# Installation directory
|
||||
DEST=$(CURDIR)/debian/gophernicus
|
||||
|
||||
configure:
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
|
||||
$(MAKE)
|
||||
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
|
||||
$(MAKE) clean-build
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/gophernicus
|
||||
$(MAKE) DESTDIR=$(DEST)/usr install-files
|
||||
rm -rf $(DEST)/tmp
|
||||
ln -s /usr/share/doc/gophernicus/ $(DEST)/var/gopher/docs
|
||||
ln -s /usr/bin/php5 $(DEST)/usr/lib/gophernicus/filters/php
|
||||
cp $(CURDIR)/gophermap.sample $(DEST)/usr/lib/gophernicus/gophermap
|
||||
cp $(CURDIR)/init/gophernicus.socket $(CURDIR)/init/gophernicus@.service $(DEST)/lib/systemd/system/
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs changelog
|
||||
dh_installdocs
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
dh_installdebconf
|
||||
dh_installlogrotate
|
||||
dh_installlogcheck
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_python
|
||||
dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
# dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
# dh_perl
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
||||
1.0
|
5
init/.gitignore
vendored
Normal file
5
init/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
haiku_snippet
|
||||
org.gophernicus.server.plist
|
||||
gophernicus.xinetd
|
||||
inetlin
|
||||
gophernicus.env
|
@ -7,4 +7,4 @@
|
||||
# OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\""
|
||||
#
|
||||
# modify and set your options here:
|
||||
OPTIONS="-h localhost -nv"
|
||||
OPTIONS="-h beast -nv"
|
||||
|
10
init/gophernicus.env.in
Normal file
10
init/gophernicus.env.in
Normal file
@ -0,0 +1,10 @@
|
||||
# Options for Gophernicus
|
||||
#
|
||||
# See README or run "gophernicus -?" to see a full list of
|
||||
# configuration options.
|
||||
#
|
||||
# Example:
|
||||
# OPTIONS="-h full.hostname -D \"I find your lack of gopher disturbing.\""
|
||||
#
|
||||
# modify and set your options here:
|
||||
OPTIONS="-h @HOSTNAME@ -nv"
|
7
init/haiku_snippet.in
Normal file
7
init/haiku_snippet.in
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
service gopher {
|
||||
family inet
|
||||
protocol tcp
|
||||
port 70
|
||||
launch @BINARY@ -h @HOSTNAME@
|
||||
}
|
1
init/inetlin.in
Normal file
1
init/inetlin.in
Normal file
@ -0,0 +1 @@
|
||||
gopher stream tcp nowait @BINARY_PATH@ @BINARY_NAME@ @OPTIONS@
|
Loading…
Reference in New Issue
Block a user