~ubuntu-branches/debian/wheezy/ledcontrol/wheezy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
EXTRA_DIST = garbage.pl ANIMATIONS THANKS MANUAL SCRIPTS gled.glade Coding \
             PROBLEMS ledcontrol.spec test-ledd.conf test-ledd.sh \
             test-startup.sh

if DO_GLED
gled_dir=gled
gled_man=gled.1
endif

SUBDIRS = ledd scripts $(gled_dir)

man_MANS = ledcontrol.1 ledcontrol.conf.5 ledd.8 ledd.conf.5 \
           startup.sh.8 $(gled_man)

bin_SCRIPTS = ledcontrol

install-data-local:
	@#
	@# Smart installation of ledd.conf, don't overwrite previous one.
	@# Versioning seemed a stupid thing to do,  may it rest in peace.
	@#
	mkdir -p `dirname $(DESTDIR)@sysconfdir_int@/ledd.conf`
	@if test -e "$(DESTDIR)@sysconfdir_int@/ledd.conf" ; then \
	  if ! diff ledd.conf.sample "$(DESTDIR)@sysconfdir_int@/ledd.conf" 1>/dev/null 2>/dev/null; then \
	    echo $(INSTALL_DATA) ledd.conf.sample "$(DESTDIR)@sysconfdir_int@/ledd.conf.sample" ;\
	    $(INSTALL_DATA) ledd.conf.sample "$(DESTDIR)@sysconfdir_int@/ledd.conf.sample" ;\
	    echo LEDDCONF >> /tmp/MSG.ledcontrol ;\
	  fi ;\
	else \
	  echo $(INSTALL_DATA) ledd.conf.sample "$(DESTDIR)@sysconfdir_int@/ledd.conf" ;\
	  $(INSTALL_DATA) ledd.conf.sample "$(DESTDIR)@sysconfdir_int@/ledd.conf" ;\
	  echo LEDDCONFNEW >> /tmp/MSG.ledcontrol ;\
	fi
	@#
	@# Make sure path for default pipefile/pidfile exists.
	@# No need for errors here...
	@#
	mkdir -p "$(DESTDIR)/var/run" || true
	@#
	@# Install the init script, if desired and root.
	@#
	@# Removes old rc files and installs anew (there should be no
	@# user-made changes to them, so backups aren't neccessary).
	@#
	@if test "@sysv_install@" = YES; then \
	  if test "`whoami`" != root -a -z "$(DESTDIR)"; then \
	    echo NOROOTSYSV >>/tmp/MSG.ledcontrol ;\
	  else \
	    mkdir -p "$(DESTDIR)@sysv_base@/rc0.d" "$(DESTDIR)@sysv_base@/rc1.d" \
	             "$(DESTDIR)@sysv_base@/rc2.d" "$(DESTDIR)@sysv_base@/rc3.d" \
	             "$(DESTDIR)@sysv_base@/rc4.d" "$(DESTDIR)@sysv_base@/rc5.d" \
	             "$(DESTDIR)@sysv_base@/rc6.d" "$(DESTDIR)@sysv_base@/init.d" ;\
	    echo $(INSTALL_SCRIPT) ledd-sysv-@sysv_type@ $(DESTDIR)@sysv_base@/init.d/ledd ;\
	    $(INSTALL_SCRIPT) ledd-sysv-@sysv_type@ $(DESTDIR)@sysv_base@/init.d/ledd ;\
	    ON="@sysv_runlevel_on@" ;\
	    OFF="@sysv_runlevel_off@" ;\
	    test -n "$$ON$$OFF" && rm -f $(DESTDIR)@sysv_base@/rc[$$ON$$OFF].d/[SK][0-9][0-9]ledd ;\
	    if test -n "$$ON"; then \
	      for DIR in $(DESTDIR)@sysv_base@/rc[$$ON].d; do \
	        echo ln -sf @sysv_base@/init.d/ledd $(DESTDIR)$$DIR/S95ledd ;\
	        ln -sf @sysv_base@/init.d/ledd $(DESTDIR)$$DIR/S95ledd ;\
	      done ;\
	    fi ;\
	    if test -n "$$OFF"; then \
	      for DIR in $(DESTDIR)@sysv_base@/rc[$$OFF].d; do \
	        echo ln -sf @sysv_base@/init.d/ledd $(DESTDIR)$$DIR/K05ledd ;\
	        ln -sf @sysv_base@/init.d/ledd $(DESTDIR)$$DIR/K05ledd ;\
	      done ;\
	    fi ;\
	    echo SYSVOK >>/tmp/MSG.ledcontrol ;\
	  fi ;\
	fi
	@#
	@# Print smart messaging messages last.
	@#
	@echo LASTMSG >> /tmp/MSG.ledcontrol
	@if test -e /tmp/MSG.ledcontrol; then \
	  rm -f /tmp/MSG2.ledcontrol ;\
	  for CMT in `cat /tmp/MSG.ledcontrol`; do \
	    echo "" >>/tmp/MSG2.ledcontrol ;\
	    @AWK@ 'BEGIN { FS="|" } /^'$$CMT'\|/{ print $$2 }' configtext >>/tmp/MSG2.ledcontrol ;\
	  done ;\
	  echo "" >>/tmp/MSG2.ledcontrol ;\
	  if test "@bsd_tr@" = YES; then \
	    MARKLINE="`cat /tmp/MSG2.ledcontrol | tr "[:print:]" "=" | sort | tail -n 1`" ;\
	  else \
	    MARKLINE="======================================" ;\
	  fi ;\
	  echo "" ;\
	  echo "$$MARKLINE" ;\
	  cat /tmp/MSG2.ledcontrol ;\
	  echo "$$MARKLINE" ;\
	  echo "" ;\
	  rm -f /tmp/MSG.ledcontrol /tmp/MSG2.ledcontrol ;\
	fi

# Test ledd
test: all
	./test-ledd.sh