4 include $(topdir
)/autoconf
/targets.mak
6 all-install
: install-openbsd
7 all-uninstall
: uninstall-openbsd
10 $(call DISTINST
,OpenBSD
)
12 $(call INSTPROG
,744,apcupsd
,/etc
/rc.apcupsd
)
13 $(VV
)-today
="`date +%Y%m%d%H%M`"; \
14 grep
-q
'# TAG_APCUPSD' /etc
/rc.shutdown
; \
15 if
[ $$?
-ne
0 ]; then \
16 echo
" PATCH $(DESTDIR)/etc/rc.shutdown"; \
17 rm -f
$(DESTDIR
)/etc
/rc.shutdown.
$$today; \
18 cp
-p
/etc
/rc.shutdown
$(DESTDIR
)/etc
/rc.shutdown.
$$today; \
19 ( echo
"# Do not remove the 'TAG_APCUPSD' text, below"; \
20 echo
"if [ -f $(PWRFAILDIR)/powerfail ]; then # TAG_APCUPSD";\
21 echo
" powerdown=YES # TAG_APCUPSD"; \
22 echo
" echo '' # TAG_APCUPSD"; \
23 echo
" echo 'Please ensure that the UPS has powered off before' # TAG_APCUPSD"; \
24 echo
" echo 'rebooting. Otherwise, the UPS may cut the power' # TAG_APCUPSD"; \
25 echo
" echo 'during the reboot.' # TAG_APCUPSD"; \
26 echo
" echo '' # TAG_APCUPSD"; \
27 echo
"fi # TAG_APCUPSD"; \
28 ) >> $(DESTDIR
)/etc
/rc.shutdown
; \
30 grep
-q
/etc
/rc.apcupsd
/etc
/rc.local
; \
31 if
[ $$?
-ne
0 ]; then \
32 echo
" PATCH $(DESTDIR)/etc/rc.local"; \
33 rm -f
$(DESTDIR
)/etc
/rc.local.
$$today; \
34 cp
-p
/etc
/rc.local
$(DESTDIR
)/etc
/rc.local.
$$today; \
35 ( echo
"# Start the UPS daemon. Do not remove the 'TAG_APCUPSD' text"; \
36 echo
"# if [ -x /etc/rc.apcupsd ]; then # TAG_APCUPSD"; \
37 echo
"# /etc/rc.apcupsd start # TAG_APCUPSD"; \
38 echo
"# fi # TAG_APCUPSD"; \
39 ) >> $(DESTDIR
)/etc
/rc.local
; \
41 ( echo
"While /etc/rc.local has been patched to run apcupsd,";\
42 echo
"the commands are currently commented out. You should"; \
43 echo
"examine the $(sysconfdir)/apcupsd.conf file to ensure"; \
44 echo
"that it is suitable for your site. Then run"; \
45 echo
"/etc/rc.apcupsd manually to ensure sane operation."; \
46 echo
"Once you are satisfied, uncomment the appropriate"; \
47 echo
"lines in /etc/rc.local" ) |
/usr
/bin
/fmt
; \
51 $(call DISTUNINST
,OpenBSD
)
52 -$(call UNINST
,/etc
/rc.apcupsd
)
53 $(VV
)-today
="`date +%Y%m%d%H%M`"; \
54 for f in
$(DESTDIR
)/etc
/rc.local
$(DESTDIR
)/etc
/rc.shutdown
; do \
55 grep
-q
'# TAG_APCUPSD' $$f; \
56 if
[ $$?
-eq
0 ]; then \
59 cp
-p
$$f $$f.
$$today; \
60 $(SED
) -e
'/TAG_APCUPSD/d;' \
61 < $$f.
$$today > $$f; \