summaryrefslogtreecommitdiffstats
path: root/admin/Sources/Clients/ogagent/linux/Makefile
blob: 889f07de482741195f8e33671fda0125c9df82a6 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/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
XDGAUTOSTARTDIR := $(DESTDIR)/etc/xdg/autostart
KDEAUTOSTARTDIR := $(DESTDIR)/usr/share/autostart

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 -p $(XDGAUTOSTARTDIR)
	mkdir -p $(KDEAUTOSTARTDIR)
	mkdir -p $(LIBDIR)/img

	# Cleans up .pyc and cache folders
	rm -f $(PYC) $(CACHES)

	cp -r $(SOURCEDIR)/opengnsys $(LIBDIR)/opengnsys
	cp -r $(SOURCEDIR)/cfg $(LIBDIR)/cfg
	cp $(SOURCEDIR)/img/oga.png $(LIBDIR)/img

	cp $(SOURCEDIR)/OGAgentUser.py $(LIBDIR)
	# QT Dialogs & resources
	cp $(SOURCEDIR)/*_ui.py $(LIBDIR)
	cp $(SOURCEDIR)/OGAgent_rc.py $(LIBDIR)
	# Version file
	cp $(SOURCEDIR)/VERSION $(LIBDIR)

	# Autostart elements for gnome/kde
	cp desktop/OGAgentTool.desktop $(XDGAUTOSTARTDIR)
	cp desktop/OGAgentTool.desktop $(KDEAUTOSTARTDIR)

	# 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 755 $(LIBDIR)/OGAgentUser.py
	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

uninstall:
	rm -rf $(LIBDIR)
	# rm -f $(BINDIR)/ogagent
	rm -rf $(CFGDIR)