forked from oar-team/oargrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (85 loc) · 4.3 KB
/
Makefile
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
#!/usr/bin/make
# $Id: Makefile,v 1.5 2006/01/31 10:09:40 capitn Exp $
SHELL=/bin/bash
DESTDIR=
OARGRIDCONFDIR=etc
OARGRIDUSER=oargrid
OARGRIDGROUP=oargrid
PREFIX=usr/local
OARGRIDDIR=$(PREFIX)/lib/oargrid
MANDIR=$(PREFIX)/man
BINDIR=$(PREFIX)/bin
SBINDIR=$(PREFIX)/sbin
BINLINKPATH=../oargrid
SBINLINKPATH=../oargrid
CMDSLINKPATH=../
CONFIG_CMDS=$(OARGRIDDIR)/cmds
CGIDIR=usr/lib/cgi-bin
all: usage
usage:
@echo "Usage: make [ OPTIONS=<...> ] MODULES"
@echo "Where MODULES := { install | deb }"
@echo " OPTIONS := { DESTDIR | OARGRIDCONFDIR | OARGRIDUSER | OARGRIDGROUP | PREFIX | MANDIR | OARGRIDDIR | BINDIR | SBINDIR | CGIDIR }"
sanity-check:
@[ `whoami` == 'root' ] || echo "Warning: You may need to be root in order to install some files!"
@id $(OARGRIDUSER) > /dev/null || ( echo "Error: User $(OARGRIDUSER) does not exist!" ; exit -1 )
configuration:
mkdir -p $(DESTDIR)/$(OARGRIDCONFDIR)
@if [ -e $(DESTDIR)/$(OARGRIDCONFDIR)/oargrid.conf ]; then echo "Warning: $(DESTDIR)/$(OARGRIDCONFDIR)/oargrid.conf already exists, not overwritting it." ; else install -m 600 oargrid.conf $(DESTDIR)/$(OARGRIDCONFDIR) ; fi
-chown $(OARGRIDUSER).$(OARGRIDGROUP) $(DESTDIR)/$(OARGRIDCONFDIR)/oargrid.conf
common:
mkdir -p $(DESTDIR)/$(OARGRIDDIR)
mkdir -p $(DESTDIR)/$(CONFIG_CMDS)
mkdir -p $(DESTDIR)/$(BINDIR)
install -m 0755 configurator_wrapper.sh $(DESTDIR)/$(OARGRIDDIR)
perl -i -pe "s#^OARGRIDDIR=.*#OARGRIDDIR=/$(OARGRIDDIR)#;;s#^OARGRIDUSER=.*#OARGRIDUSER=$(OARGRIDUSER)#" $(DESTDIR)/$(OARGRIDDIR)/configurator_wrapper.sh
install -m 755 oargrid_sudowrapper.sh $(DESTDIR)/$(OARGRIDDIR)
perl -i -pe "s#^OARGRIDDIR=.*#OARGRIDDIR=/$(OARGRIDDIR)#;;s#^OARGRIDUSER=.*#OARGRIDUSER=$(OARGRIDUSER)#" $(DESTDIR)/$(OARGRIDDIR)/oargrid_sudowrapper.sh
install -m 755 oargrid_conflib.pm $(DESTDIR)/$(OARGRIDDIR)
install -m 755 oargrid_lib.pm $(DESTDIR)/$(OARGRIDDIR)
install -m 755 oargrid_mailer.pm $(DESTDIR)/$(OARGRIDDIR)
install -m 755 oargriddel $(DESTDIR)/$(OARGRIDDIR)
ln -sf /$(OARGRIDDIR)/configurator_wrapper.sh $(DESTDIR)/$(CONFIG_CMDS)/oargriddel
ln -sf /$(OARGRIDDIR)/oargrid_sudowrapper.sh $(DESTDIR)/$(BINDIR)/oargriddel
install -m 755 oargridsub $(DESTDIR)/$(OARGRIDDIR)
ln -sf /$(OARGRIDDIR)/configurator_wrapper.sh $(DESTDIR)/$(CONFIG_CMDS)/oargridsub
ln -sf /$(OARGRIDDIR)/oargrid_sudowrapper.sh $(DESTDIR)/$(BINDIR)/oargridsub
install -m 755 oargridstat $(DESTDIR)/$(OARGRIDDIR)
ln -sf /$(OARGRIDDIR)/configurator_wrapper.sh $(DESTDIR)/$(CONFIG_CMDS)/oargridstat
ln -sf /$(OARGRIDDIR)/oargrid_sudowrapper.sh $(DESTDIR)/$(BINDIR)/oargridstat
mkdir -p $(DESTDIR)/$(CGIDIR)
install -m 755 oargridmonitor.cgi $(DESTDIR)/$(CGIDIR)
manual:
mkdir -p $(DESTDIR)/$(MANDIR)/man1
install -m 644 man/oargriddel.1 $(DESTDIR)/$(MANDIR)/man1
install -m 644 man/oargridsub.1 $(DESTDIR)/$(MANDIR)/man1
install -m 644 man/oargridstat.1 $(DESTDIR)/$(MANDIR)/man1
disco:
mkdir -p $(DESTDIR)/$(BINDIR)
install -m 755 misc/disco $(DESTDIR)/$(BINDIR)
install: sanity-check configuration common manual disco
uninstall:
-rm -f $(DESTDIR)/$(CONFIG_CMDS)/oargriddel \
$(DESTDIR)/$(CONFIG_CMDS)/oargridsub \
$(DESTDIR)/$(CONFIG_CMDS)/oargridstat \
$(DESTDIR)/$(CGIDIR)/oargridmonitor.cgi \
$(DESTDIR)/$(OARGRIDDIR)/configurator_wrapper.sh \
$(DESTDIR)/$(OARGRIDDIR)/oargrid_sudowrapper.sh \
$(DESTDIR)/$(OARGRIDDIR)/oargrid_conflib.pm \
$(DESTDIR)/$(OARGRIDDIR)/oargrid_mailer.pm \
$(DESTDIR)/$(OARGRIDDIR)/oargrid_lib.pm \
$(DESTDIR)/$(OARGRIDDIR)/oargriddel \
$(DESTDIR)/$(OARGRIDDIR)/oargridsub \
$(DESTDIR)/$(OARGRIDDIR)/oargridstat \
$(DESTDIR)/$(BINDIR)/oargridsub \
$(DESTDIR)/$(BINDIR)/oargridstat \
$(DESTDIR)/$(BINDIR)/oargriddel
-rmdir $(DESTDIR)/$(CONFIG_CMDS)
-rmdir $(DESTDIR)/$(OARGRIDDIR)
deb:
@DEB_VERSION=`head -1 debian/changelog|awk -F"(" '{print $$2}' |awk -F")" '{print $$1}'`;VERSION=`grep "Version = " oargrid_lib.pm|awk -F"\"" '{print $$2}'`;[ "$$VERSION" = "$$DEB_VERSION" ] || ( echo "***** ERROR: Version number ($$VERSION) in oargrid_lib mismatch debian/changelog ($$DEB_VERSION)! ******" ; exit 1 )
debuild -rfakeroot -us -uc
clean:
-rm -f build-arch-stamp build-indep-stamp configure-stamp debian/files debian/oargrid-client.debhelper.log debian/oargrid-client.substvars debian/oargrid-disco.debhelper.log debian/oargrid-disco.substvars
rm -rf debian/oargrid-client
rm -rf debian/oargrid-disco