~gsthnz/satellite

bef0728824cc75804ac848392aaa38c4dbfb37fc — Pedro Lucas Porcellis 3 years ago 16b300e
Add a Makefile to easily compile and install satellite
3 files changed, 51 insertions(+), 0 deletions(-)

A .gitignore
A Makefile
A config/satellite.toml.in
A .gitignore => .gitignore +2 -0
@@ 0,0 1,2 @@
satellite
satellite.toml

A Makefile => Makefile +33 -0
@@ 0,0 1,33 @@
GO?=go

GOSRC!=find . -name '*.go'
GOSRC+=go.mod go.sum

PREFIX?=/usr/local
BINDIR?=$(PREFIX)/bin
SHAREDIR?=$(PREFIX)/share/satellite
MANDIR?=$(PREFIX)/share/man

all: satellite satellite.toml

satellite: $(GOSRC)
	$(GO) build -o $@

satellite.toml: config/satellite.toml.in
	sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/satellite.toml.in

install: all
	mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(MANDIR)/man5 $(DESTDIR)$(MANDIR)/man7 \
		$(DESTDIR)$(SHAREDIR)
	install -m755 satellite $(DESTDIR)$(BINDIR)/satellite
	install -m644 satellite.toml $(DESTDIR)$(SHAREDIR)/satellite.toml

uninstall: all
	rm -r $(DESTDIR)$(BINDIR)/satellite
	rm -fr $(DESTDIR)$(SHAREDIR)

clean:
	rm -rf satellite satellite.toml

.PHONY:
	satellite satellite.toml clean

A config/satellite.toml.in => config/satellite.toml.in +16 -0
@@ 0,0 1,16 @@
# Address to listen to requests (default: 0.0.0.0:1965)
listen = "0.0.0.0"

[tls]
# Directory to save certificates
directory = "/var/lib/gemini/certs"

# Multiple domains can be set with the [[domain]] section
[[domain]]
name = "example.com"
root = "/srv/gemini/example.com"

[[domain]]
name = "example2.com"
root = "/srv/gemini/example2.com"