Merge pull request #1 from F4FXL/feature/Systemd

SystemD improvements and Makefile cleanups
feature/IndividualCalls
Geoffrey Merck 6 years ago committed by GitHub
commit f4b2e26e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,8 +1,8 @@
# Copyright (c) 2017 by Thomas A. Early N7TAE # Copyright (c) 2017 by Thomas A. Early N7TAE
# if you change these locations, make sure the sgs-xl.service file is updated! # if you change these locations, make sure the sgs-xl.service file is updated!
BINDIR=/usr/local/bin BINDIR=/usr/sbin
CFGDIR=/usr/local/etc CFGDIR=/etc/sgs-xl
# choose this if you want debugging help # choose this if you want debugging help
#CPPFLAGS=-g -ggdb -W -Wall -std=c++11 -DCFG_DIR=\"$(CFGDIR)\" #CPPFLAGS=-g -ggdb -W -Wall -std=c++11 -DCFG_DIR=\"$(CFGDIR)\"
@ -20,40 +20,50 @@ sgs-xl : GitVersion.h $(OBJS)
g++ $(CPPFLAGS) -MMD -MD -c $< -o $@ g++ $(CPPFLAGS) -MMD -MD -c $< -o $@
.PHONY: clean .PHONY: clean
clean: clean:
$(RM) GitVersion.h $(OBJS) $(DEPS) sgs-xl $(RM) GitVersion.h $(OBJS) $(DEPS) sgs-xl
-include $(DEPS) -include $(DEPS)
# install, uninstall and removehostfiles need root priviledges # install, uninstall and removehostfiles need root priviledges
.PHONY: newhostfiles
newhostfiles : newhostfiles :
/usr/bin/wget http://www.pistar.uk/downloads/DExtra_Hosts.txt && sudo /bin/mv -f DExtra_Hosts.txt $(CFGDIR) /bin/mkdir -p $(CFGDIR)
/usr/bin/wget http://www.pistar.uk/downloads/DCS_Hosts.txt && sudo /bin/mv -f DCS_Hosts.txt $(CFGDIR) /usr/bin/wget -O $(CFGDIR)/DExtra_Hosts.txt http://www.pistar.uk/downloads/DExtra_Hosts.txt
/usr/bin/wget -O $(CFGDIR)/DCS_Hosts.txt http://www.pistar.uk/downloads/DCS_Hosts.txt
install : sgs-xl .PHONY: install
install : newhostfiles sgs-xl
/bin/mkdir -p $(CFGDIR)
/bin/cp -f sgs-xl.cfg $(CFGDIR) /bin/cp -f sgs-xl.cfg $(CFGDIR)
/bin/cp -f sgs-xl $(BINDIR) /bin/cp -f sgs-xl $(BINDIR)
/bin/cp -f sgs-xl.service /lib/systemd/system /bin/cp -f sgs-xl.service /lib/systemd/system
/usr/bin/sed -i "s|REPLACEME|/usr/sbin/sgs-xl /etc/sgs-xl/sgs-xl.cfg|g" /lib/systemd/system/sgs-xl.service
systemctl enable sgs-xl.service systemctl enable sgs-xl.service
systemctl daemon-reload systemctl daemon-reload
systemctl start sgs-xl.service systemctl start sgs-xl.service
.PHONY: uninstall
uninstall : uninstall :
systemctl stop sgs-xl.service systemctl stop sgs-xl.service
systemctl disable sgs-xl.service systemctl disable sgs-xl.service
/bin/rm -f /lib/systemd/system/sgs-xl.service /bin/rm -f /lib/systemd/system/sgs-xl.service
systemctl daemon-reload systemctl daemon-reload
/bin/rm -f $(BINDIR)/sgs-xl /bin/rm -f $(BINDIR)/sgs-xl
/bin/rm -f $(CFGDIR)/sgs-xl.cfg /bin/rm -rf $(CFGDIR)
.PHONY: removehostfiles
removehostfiles : removehostfiles :
/bin/rm -f $(CFGDIR)/DExtra_Hosts.txt /bin/rm -f $(CFGDIR)/DExtra_Hosts.txt
/bin/rm -f $(CFGDIR)/DCS_Hosts.txt /bin/rm -f $(CFGDIR)/DCS_Hosts.txt
GitVersion.h: GitVersion.h: force
ifneq ("$(wildcard .git/index)","") ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@ echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@ echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif endif
.PHONY: force
force:
@true

@ -1,10 +1,11 @@
[Unit] [Unit]
Description=Smart Group Server Description=Smart Group Server
After=systemd-user-session.service After=network-online.target
Wants=network-online.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/local/bin/sgs /usr/local/etc/sgs.cfg ExecStart=REPLACEME
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

Loading…
Cancel
Save

Powered by TurnKey Linux.