-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
72 lines (51 loc) · 2.06 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
# [formr.org]
FORMR_DIR?=/var/www/formr
INSTALL_DIR=$(CTSR_ROOT)$(FORMR_DIR)
CONFIG_DIR=$(INSTALL_DIR)/config
CRON_TAB=$(INSTALL_DIR)/config/formr_crontab
SYS_CRON_TAB=$(CTSR_ROOT)/etc/cron.d/formr_crontab
SMI_CONFIG=/etc/smysqlin/formr.ini
GIT_REPO?=https://github.com/rubenarslan/formr.org.git
GIT=$(shell echo "git --git-dir=$(INSTALL_DIR)/.git --work-tree=$(INSTALL_DIR)")
GIT_BRANCH?=master
APACHE_USER?=www-data
APACHE_GROUP?=www-data
COMPOSER=composer
all: install
install: init init_install install_files install_dependencies clean
@echo "formr.org has been installed successfully to $(INSTALL_DIR)."
@echo "\nConfigure database and other settings at $(CONFIG_DIR)/settings.php and then activate cron at $(SYS_CRON_TAB)"
install_files:
@echo "Installing files .....";
@install -d -m 0755 $(INSTALL_DIR)
$(GIT) init
$(GIT) remote add origin $(GIT_REPO)
$(GIT) pull origin $(GIT_BRANCH)
install -d -m 0755 $(CONFIG_DIR)
chmod 0755 $(INSTALL_DIR)/bin/cron.php
[ -d $(CONFIG_DIR) ] && cp -R $(INSTALL_DIR)/config_default/* $(CONFIG_DIR)/
[ ! -f $(SYS_CRON_TAB) ] && cp $(CRON_TAB) $(SYS_CRON_TAB)
@echo "File installation.... Done."
install_dependencies:
@echo "Installing dependencies ....."
cd $(INSTALL_DIR) && $(COMPOSER) install
@echo "Done"
uninstall:
@echo "Uninstalling config files, log directory and app files .....";
@rm -rf $(INSTALL_DIR)
@rm -rf $(SYS_CRON_TAB)
@echo "Done."
update: init update_files clean
@echo "Updating.... Done"
update_files:
$(GIT) pull origin $(GIT_BRANCH)
cd $(INSTALL_DIR) && $(COMPOSER) install
@chmod 0755 $(INSTALL_DIR)/bin/cron.php
init:
@type git >/dev/null 2>&1 || { echo >&2 "'git' is required but it's not installed. Aborting..."; exit 1; }
@type composer >/dev/null 2>&1 || { echo >&2 "'composer' is required but it's not installed. Aborting..."; exit 1; }
init_install:
@if [ -d $(INSTALL_DIR) ]; then echo "'formr.org' is already installed. Run 'make update' or 'make uninstall' instead. Aborting..."; exit 1; fi
clean:
chown -R $(APACHE_USER):$(APACHE_GROUP) $(INSTALL_DIR)
@echo "Installation completed..."