added init script, plus install/uninstall rules in the makefile

git-svn-id: svn+ssh://svn.code.sf.net/p/spacenav/code/spacenavd@8 ef983eb1-d774-4af8-acfd-baaf7b16a646
pull/1/head
John Tsiombikas 2007-11-08 00:37:14 +00:00
rodzic 16ac12f3ef
commit 14f1522aba
2 zmienionych plików z 38 dodań i 0 usunięć

Wyświetl plik

@ -1,7 +1,11 @@
# change the prefix to install elsewhere
PREFIX = /usr/local
obj = spnavd.o
bin = spacenavd
CC = gcc
INSTALL = install
CFLAGS = -pedantic -Wall -g -DUSE_X11
LDFLAGS = -lX11
@ -11,3 +15,16 @@ $(bin): $(obj)
.PHONY: clean
clean:
rm -f $(obj) $(bin)
.PHONY: install
install: $(bin)
$(INSTALL) -d $(PREFIX)/bin
$(INSTALL) -m 755 $(bin) $(PREFIX)/bin/$(bin)
$(INSTALL) -m 755 init_script /etc/init.d/$(bin)
cd /etc/rc2.d && rm -f S99$(bin) && ln -s ../init.d/$(bin) S99$(bin)
.PHONY: uninstall
uninstall:
rm -f $(PREFIX)/bin/$(bin)
rm -f /etc/init.d/$(bin)
rm -f /etc/rc2.d/S99$(bin)

21
init_script 100755
Wyświetl plik

@ -0,0 +1,21 @@
#!/bin/sh
DAEMON=/usr/local/bin/spacenavd
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
echo 'Starting spacenavd daemon'
$DAEMON
;;
stop)
echo 'Stopping spacenavd daemon'
kill `pidof spacenavd`
;;
reload|restart|force-reload)
$0 stop && $0 start
;;
esac