# Makefile template
#
# Copyright (C) 1999-2002 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
#

# Default variables
@VARIABLES@
# TOP source directory.
topdir = @topdir@
top_builddir = $(topdir)

# Include the default make targets: to be put before the all-targets: rule.
@TARGETS@

all-targets: Makefile

install:
	@if test -e /etc/apcupsd.conf; then \
		echo "Preserving old /etc/apcupsd.conf in @sysconfdir@/apcupsd.conf.old..." ; \
		mv /etc/apcupsd.conf @sysconfdir@/apcupsd.conf.old ; \
	fi

	@if test -e /etc/init.d/apcupsd; then \
		echo "Removing old /etc/init.d/apcupsd..." ; \
		rm -f /etc/init.d/apcupsd ; \
		echo "Attempting to remove old /etc/rc[n].d symlinks..." ; \
		/usr/sbin/update-rc.d apcupsd remove ; \
	fi

	@echo "Installing apcupsd boot script..."
	$(INSTALL_PROGRAM) -m 744 apcupsd /etc/init.d/apcupsd

	@echo "Installing symlinks..."
	/usr/sbin/update-rc.d apcupsd start 20 1 2 3 4 5 . stop 20 0 1 6 . 

	@if test -e /etc/init.d/ups-monitor; then \
		echo "Found a pre-existing copy of /etc/init.d/ups-monitor." ; \
		echo "Saving as /etc/init.d/ups-monitor.old..." ; \
		mv -i /etc/init.d/ups-monitor /etc/init.d/ups-monitor.old ; \
	fi

	@echo "Installing /etc/init.d/ups-monitor..."
	$(INSTALL_PROGRAM) -m 744 ups-monitor /etc/init.d/ups-monitor

	@echo "---------------------------------------------------------------------"
	@echo " NOTE: APCUPSD will almost certainly not work \"out of the box.\""
	@echo "       You MUST properly edit @sysconfdir@/apcupsd.conf or apcupsd"
	@echo "       will fail on startup.  Also, please see that your script"
	@echo "       at /etc/init.d/halt properly calls /etc/init.d/ups-monitor"
	@echo "       as shown in distributions/debian/examples/halt.ex."
	@echo "---------------------------------------------------------------------"

uninstall:
	@echo "Deactivating apcupsd..."
	sh /etc/init.d/apcupsd stop 
	sleep 6

	@echo "Removing apcupsd boot script..."
	@rm -f /etc/init.d/apcupsd

	@echo "Removing symlinks..."
	/usr/sbin/update-rc.d apcupsd remove

	@echo "Removing ups-monitor script..."
	@rm -f /etc/init.d/ups-monitor 

clean:

distclean:
	@rm -f Makefile apccontrol.sh apcupsd ups-monitor 
	@rm -rf CVS


syntax highlighted by Code2HTML, v. 0.9.1