-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·64 lines (55 loc) · 1.74 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
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright (C) 2021 Unai Goikoetxeta
.DEFAULT: help
SHELL:= /bin/bash
APT:= apt update && apt install -y --no-install-recommends python3 python3-pip libsasl2-dev python3-dev libldap2-dev libssl-dev
DNF:= dnf install -y python3 python3-pip python3-devel openldap-devel
DESTDIR:= /opt/freeipa_manager
SYMLINK:= /usr/sbin/freeipa_manager
REDHATOS:= $(wildcard /etc/redhat-release*)
DEBIANOS:= $(wildcard /etc/debian_version*)
ifneq ($(DEBIANOS),)
PKG_INSTALLER:= $(APT)
else ifneq ($(REDHATOS),)
PKG_INSTALLER:= $(DNF)
endif
help:
@echo "make help"
@echo " displays this menu"
@echo "make install-system-dependencies"
@echo " installs system dependencies required to run the program"
@echo "make install"
@echo " installs the program"
@echo "make update"
@echo " updates the program"
@echo "make uninstall"
@echo " uninstalls the program"
install-system-dependencies:
$(PKG_INSTALLER)
pip3 install -r requirements.txt
install:
mkdir $(DESTDIR)
mkdir $(DESTDIR)/cache
cp freeipa_manager.py $(DESTDIR)/
cp config.yaml $(DESTDIR)/
cp -Rf templates/ $(DESTDIR)/
cp -Rf utils/ $(DESTDIR)/
chgrp -Rf admins $(DESTDIR)
chmod 775 -Rf $(DESTDIR)
chmod g+s $(DESTDIR)
chmod g+s $(DESTDIR)/cache/
setfacl -d -m group:admins:rwx $(DESTDIR)
setfacl -d -m group:admins:rwx $(DESTDIR)/cache/
chmod +x $(DESTDIR)/freeipa_manager.py
ln -s $(DESTDIR)/freeipa_manager.py $(SYMLINK)
uninstall:
rm -Rf $(DESTDIR)
rm $(SYMLINK)
update:
cp freeipa_manager.py $(DESTDIR)/
cp config.yaml $(DESTDIR)/
cp -Rf templates/* $(DESTDIR)/templates/
cp -Rf utils/* $(DESTDIR)/utils/
chgrp -Rf admins $(DESTDIR)
chmod 775 -Rf $(DESTDIR)
chmod +x $(DESTDIR)/freeipa_manager.py