summaryrefslogtreecommitdiffstats
path: root/admin/Sources/Clients/ogagent/oglive/Makefile
blob: 832e2dc7cd60de616774d125a3d384b941d22ec5 (plain)
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
#!/usr/bin/make -f
# -*- makefile -*-

# Directories
SOURCEDIR := ../src
LIBDIR := $(DESTDIR)/usr/share/OGAgent
BINDIR := $(DESTDIR)/usr/bin
SBINDIR = $(DESTDIR)/usr/sbin
APPSDIR := $(DESTDIR)/usr/share/applications
CFGDIR := $(DESTDIR)/etc/ogagent
INITDIR := $(DESTDIR)/etc/init.d

PYC := $(shell find $(SOURCEDIR) -name '*.py[co]')
CACHES := $(shell find $(SOURCEDIR) -name '__pycache__')

clean:
	rm -rf $(PYC) $(CACHES) $(DESTDIR)
install-ogagent:
	rm -rf $(DESTDIR)
	mkdir -p $(LIBDIR)
	mkdir -p $(BINDIR)
	mkdir -p $(SBINDIR)
	mkdir -p $(APPSDIR)
	mkdir -p $(CFGDIR)
	
	mkdir $(LIBDIR)/img
	
	# Cleans up .pyc and cache folders
	rm -f $(PYC) $(CACHES)
	
	cp -r $(SOURCEDIR)/opengnsys $(LIBDIR)/opengnsys
	cp -r $(SOURCEDIR)/cfg $(LIBDIR)/cfg

	# scripts
	cp scripts/ogagent $(BINDIR)
	cp scripts/OGAgentTool-startup $(BINDIR)
	cp scripts/OGAgentTool $(BINDIR)
	
	# Fix permissions
	chmod 755 $(BINDIR)/ogagent
	chmod 755 $(BINDIR)/OGAgentTool-startup
	chmod 600 $(LIBDIR)/cfg/ogagent.cfg
	
	# If for red hat based, copy init.d
ifeq ($(DISTRO),rh)
	mkdir -p $(INITDIR)
	cp debian/ogagent.init $(INITDIR)/ogagent
	chmod +x $(INITDIR)/ogagent
	ln -fs /usr/share/OGAgent/cfg/ogagent.cfg $(CFGDIR)
	ln -fs /usr/share/OGAgent/cfg/ogclient.cfg $(CFGDIR)
endif
	
	# chmod 0755 $(BINDIR)/ogagent
uninstall:
	rm -rf $(LIBDIR)
	# rm -f $(BINDIR)/ogagent
	rm -rf $(CFGDIR)