-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
111 lines (96 loc) · 3.31 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# $Id: makefile,v 1.26 2024/12/10 06:33:55 malakai Exp $
#
# makefile - LociTerm
# Created: Sun May 1 10:42:59 PM EDT 2022 malakai
# $Id: makefile,v 1.26 2024/12/10 06:33:55 malakai Exp $
# Copyright © 2022 Jeff Jahr <malakai@jeffrika.com>
#
# This file is part of LociTerm - Last Outpost Client Implementation Terminal
#
# LociTerm is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# LociTerm is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with LociTerm. If not, see <https://www.gnu.org/licenses/>.
#
# This one location controls the version string that appears in the client,
# server, and archive files!
LOCITERM_VERSION = 2.1.1
#
# #### Variable definitions ####
BUILD = ./dist
INSTALL = /usr/local
SERVERDIR = ./server
CLIENTDIR = ./client
NPM = ./client/node_modules
CERTNAME = loci
DATEKEY = `date +%y%m%d%H%M`
TARFILE = ../lociterm_$(LOCITERM_VERSION).tgz
# #### Recipies Start Here ####
$(info ---------- START OF BUILD -----------)
all : $(BUILD) $(NPM) server client distlauncher
$(info ---------- END OF BUILD --- SUCCESS! -----------)
@echo ---- Run \`./lociterm\` to test out the build, then
@echo ---- run \`make install\` as root to install into $(INSTALL)
.PHONY : server
server : $(BUILD)
cd $(SERVERDIR)/src; make "LOCITERM_VERSION = $(LOCITERM_VERSION)"
cp $(SERVERDIR)/src/build/locid $(BUILD)/bin
cp $(SERVERDIR)/locid.conf $(BUILD)/etc
.PHONY : client
client : $(NPM) $(BUILD)
cd $(CLIENTDIR); npm version --allow-same-version $(LOCITERM_VERSION)
cd $(CLIENTDIR); npm run build
cp -r $(CLIENTDIR)/dist/* $(BUILD)/var/www/lociterm
.PHONY : distlauncher
distlauncher : $(BUILD) server/lociterm.sh
cp server/lociterm.sh lociterm
chmod +x lociterm
# Create run directory...
$(BUILD) :
mkdir -p $(BUILD)
mkdir -p $(BUILD)/bin
mkdir -p $(BUILD)/etc
mkdir -p $(BUILD)/etc/ssl/certs
mkdir -p $(BUILD)/etc/ssl/private
mkdir -p $(BUILD)/var/www/lociterm
mkdir -p $(BUILD)/var/lib/lociterm
$(NPM) :
cd $(CLIENTDIR); npm install
.PHONY: cert
cert : $(BUILD)
$(info --- Creating self-signed cert and key ----)
openssl req -nodes -new -x509 \
-keyout $(BUILD)/etc/ssl/private/$(CERTNAME)_key.pem \
-out $(BUILD)/etc/ssl/certs/$(CERTNAME)_cert.pem
# Cleaning up...
.PHONY : clean
clean :
cd $(SERVERDIR)/src; make clean
cd $(CLIENTDIR); npm run clean
rm lociterm
.PHONY : install
install :
$(info --- install ----)
mv -f $(INSTALL)/bin/locid $(INSTALL)/bin/locid.prev 2>/dev/null || true
cp -av $(BUILD)/* $(INSTALL)
@echo
@echo ---- Ensure you have manually backed up any DB files, THEN... ----
@echo ---- Run \`systemctl restart lociterm.service\` as root to go live ----
.PHONY: systemd
systemd:
cp server/lociterm.service /etc/systemd/system
systemctl enable lociterm.service
.PHONY : tar
tar :
$(info --- Tar file create ----)
tar -C .. -cvz --exclude-vcs --exclude-from=.exclude -f $(TARFILE) lociterm
@echo
@echo ---- Tar File is $(TARFILE) ----