Here is a makefile to do the mon install. 

Pop it into the mon-99.2 dir when you untar.  A "make install" will
install everything (alerts, monitors, mon, mon-clients, etc...) into
/usr/lib/mon and update the /etc/services file, while a "make uninstall"
tries to do the opposite.  

There are no dependancy checks done, so you must make sure that the
software requirements listed in the INSTALL file are met.

If anyone would like to use this, please send me info about bugs.

-Tom Scanlan


On Tue, 20 Aug 2002, Andrew Ryan wrote:

> At 09:48 PM 8/16/02 -0400, Daniel J Urist wrote:
> >B) Installation and upgrading are difficult. Some sort of package
> >with an install script is sorely needed, and mon needs an appropriate
> >default installation setup.
> 
> Installation being more difficult than some of the other packages out there 
> I agree with. It would be nice if someone would write one. Upgrades, I 
> haven't experienced much problem with, in fact they've been easy for me, as 
> long as I've spent the time to test things in advance and stage them.
> 


PWD:=$(shell pwd)
#INSTALLTO=$(PWD)/test-install-root
INSTALLTO=/usr/lib/mon
CC=gcc
CFLAGS=-O2 -Wall -g

MANDIR=$(INSTALLTO)/man
BINDIR=$(INSTALLTO)/bin
ALERTD=$(INSTALLTO)/alert.d
MOND=$(INSTALLTO)/mon.d
ETCD=$(INSTALLTO)/etc
STATED=$(INSTALLTO)/state.d

MAN1=$(shell find doc -name "*.1")
MAN8=$(shell find doc -name "*.8")
ALERTS=$(shell find alert.d -type f )
MONITORS=$(shell find mon.d -type f )
ETC=$(shell find etc -type f )
BIN=$(shell find clients mon utils -type f )
STATE=$(shell find state.d -type f )

ALLFILES= $(MAN1) $(MAN8) $(ALERTS) $(MONITORS) $(ETC) $(BIN) $(STATE)
ALLDIRS= $(MANDIR)/man8 $(MANDIR)/man1 $(MANDIR) $(BINDIR) $(MOND) $(ALERTD) $(ETCD) 
$(STATED) $(INSTALLTO)

all:

dirs: 
        mkdir -p $(ALLDIRS)
        touch dirs

install: install-docs install-alerts install-monitors install-etc install-bin 
install-state
        @if ! egrep -q "^mon .* 2583" /etc/services ; then \
            echo "mon    2583/tcp       # MON" >> /etc/services; \
            echo "mon    2583/udp       # MON traps" >> /etc/services; \
        fi
        @echo done!


uninstall: uninstall-docs uninstall-alerts uninstall-monitors uninstall-etc 
uninstall-bin uninstall-state clean
        cp /etc/services /etc/services.sv
        egrep -v "^mon .* 2583" /etc/services >/etc/services.tmp
        mv -f /etc/services.tmp /etc/services

clean:
        -rm -f dirs
        -rmdir $(ALLDIRS)
        -rm -f  install-docs install-alerts install-monitors install-etc install-bin 
install-state

install-docs: $(MAN1) $(MAN8) dirs
        set -e;for i in $(MAN1); do install $$i $(MANDIR)/man1/`basename $$i` ; done
        set -e;for i in $(MAN8); do install $$i $(MANDIR)/man8/`basename $$i` ; done
        touch install-docs
        
uninstall-docs: 
        set -e;for i in $(MAN1); do rm -f  $(MANDIR)/man1/`basename $$i` ; done
        set -e;for i in $(MAN8); do rm -f  $(MANDIR)/man8/`basename $$i` ; done
        rm -f install-docs
        
install-etc: $(ETC) dirs
        set -e;for i in $(ETC); do install $$i $(ETCD)/`basename $$i` ; done
        ln -s $(INSTALLTO)/etc /etc/mon
        touch install-etc

uninstall-etc: 
        set -e;for i in $(ETC); do rm -f $(ETCD)/`basename $$i` ; done
        rm -f /etc/mon
        rm -f install-etc

install-monitors: $(MONITORS) dirs
        set -e;for i in $(MONITORS); do install $$i $(MOND)/`basename $$i` ; done
        touch install-monitors

uninstall-monitors:
        set -e;for i in $(MONITORS); do rm -f $(MOND)/`basename $$i` ; done
        rm -f  install-monitors

install-alerts: $(ALERTS) dirs
        set -e;for i in $(ALERTS); do install $$i $(ALERTD)/`basename $$i` ; done
        touch install-alerts

uninstall-alerts: 
        set -e;for i in $(ALERTS); do rm -f $(ALERTD)/`basename $$i` ; done
        rm -f  install-alerts

install-bin: $(BIN) dirs
        set -e;for i in $(BIN); do install $$i $(BINDIR)/`basename $$i` ; done
        touch install-bin

uninstall-bin: 
        set -e;for i in $(BIN); do rm -f $(BINDIR)/`basename $$i` ; done
        rm -f  install-bin

install-state: $(STATE) dirs
        set -e;for i in $(STATE); do install $$i $(STATED)/`basename $$i` ; done
        touch install-state

uninstall-state: 
        set -e;for i in $(STATE); do rm -f $(STATED)/`basename $$i` ; done
        rm -f  install-state

.PHONY : clean

Reply via email to