This repository has been archived by the owner on Jan 14, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
70 lines (57 loc) · 2.22 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
#! /usr/bin/env make
DATA_DIR = data
BUILD_DIR = build
SCRIPTS_DIR = src/scripts
CERTIFICATE = $(DATA_DIR)/freedombuddy.crt
CFG_TEMPLATE = $(DATA_DIR)/template.cfg
CFG_PRODUCTION = $(DATA_DIR)/production.cfg
CFG_TEST = $(DATA_DIR)/test.cfg
TEST_CRYPT_FILE = test_crypt_file
freedombuddy: $(BUILD_DIR) ssl-certificate $(BUILD_DIR)/plinth $(SCRIPTS_DIR)/tinc_rollout $(BUILD_DIR)/python-gnupg $(CFG_PRODUCTION) $(CFG_TEST) predepend
@echo "Configuring FreedomBuddy for first run."
./start.sh 0
sleep 10
PYTHONPATH=.:$$PYTHONPATH python src/connectors/cli/controller.py --stop
@echo ""
@echo "Configuration complete."
@echo "You can now start FreedomBuddy by running:"
@echo " bash start.sh 5"
# TODO should this run publish at some point?
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
ssl-certificate: $(CERTIFICATE)
$(CERTIFICATE): $(BUILD_DIR) $(BUILD_DIR)/cert-depends
ifeq ($(wildcard $(CERTIFICATE)),)
sudo make-ssl-cert generate-default-snakeoil
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf $(CERTIFICATE)
sudo chgrp 1000 $(CERTIFICATE)
sudo chmod g+r $(CERTIFICATE)
sudo touch $(CERTIFICATE)
else
echo $(CERTIFICATE) already exists
endif
$(BUILD_DIR)/cert-depends: $(BUILD_DIR)
sudo apt-get install ssl-cert
touch $(BUILD_DIR)/cert-depends
$(BUILD_DIR)/python-gnupg: $(BUILD_DIR)
test -d $(BUILD_DIR)/python-gnupg || git clone git://github.com/tomgalloway/python-gnupg.git $(BUILD_DIR)/python-gnupg
cd $(BUILD_DIR)/python-gnupg; git pull
$(BUILD_DIR)/plinth: $(BUILD_DIR)
test -d $(BUILD_DIR)/plinth || git clone git://github.com/NickDaly/Plinth.git $(BUILD_DIR)/plinth
cd $(BUILD_DIR)/plinth; git pull
$(SCRIPTS_DIR)/tinc_rollout: $(BUILD_DIR)
test -d $(SCRIPTS_DIR)/tinc_rollout || git clone git://github.com/jvasile/tinc-rollout.git $(SCRIPTS_DIR)/tinc_rollout
cd $(SCRIPTS_DIR)/tinc_rollout; git pull
predepend:
sudo sh -c "apt-get install python-bjsonrpc python-cheetah python-cherrypy3 python-contract python-dateutil python-httplib2 python-openssl python-routes python-socksipy python-twisted"
touch predepend
$(CFG_PRODUCTION):
cp $(CFG_TEMPLATE) $(CFG_PRODUCTION)
$(CFG_TEST):
cp $(CFG_TEMPLATE) $(CFG_TEST)
clean:
rm -rf $(BUILD_DIR)
rm -f $(CERTIFICATE)
rm -rf $(KEYS_TEST)
rm -f $(TEST_CRYPT_FILE)*
rm -f predepend