This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
162 lines (147 loc) · 4.71 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
# written by @author ZyzonixDev
# published by ZyzonixDevelopments
# -
# date | 13/04/2021
# type | Makefile
# -
# file | Makefile
# project | rpi-weatherstation
# version | 3.1.7
#
all: help
# WEATHER STATION:
# initializing setup --> fw. to python script
install:
@echo "installing rpi-weatherstation"
@echo ""
@echo "--------"
@echo "UPDATING"
@echo "--------"
sudo apt update
@echo ""
@echo "--------------"
@echo "INSTALLING PIP"
@echo "---------------"
sudo apt install python3-pip
sudo apt install python-pip
@echo ""
@echo "-------------------"
@echo "RUNNIG SETUP SCRIPT"
@echo "-------------------"
sudo python3 setup.py
@echo ""
@echo "-----------------------"
@echo "INSTALLING PIP-PACKAGES"
@echo "-----------------------"
pip3 install pyserial
pip3 install uvicorn
pip3 install fastapi
pip3 install psutil
@echo ""
@echo "-------------------"
@echo "CHANGING DIR OWNERS"
@echo "-------------------"
sudo chown pi ./db/
sudo chown pi ./logs/
@echo "make installation finished"
# removing all entries / files / folders
uninstall:
@echo ""
@echo "uninstalling rpi-weatherstation"
@echo "--> errors are due to the uninstallation process"
@echo ""
make stop-station
make stop-livedata
make disable-station
make disable-livedata
sudo rm /lib/systemd/system/station.service
sudo rm /lib/systemd/system/livedataProvider.service
@echo ""
@echo "-----------------------------------------------------------------------"
@echo "uninstallation of rpi-weatherstation finished - removing last directory"
@echo "-----------------------------------------------------------------------"
@echo ""
sudo rm -rf $(CURDIR)
# starting station service
start-station:
@echo "starting weather station service"
@echo
sudo systemctl start station.service
# stopping station service
stop-station:
@echo "stopping weather station service"
@echo ""
sudo systemctl stop station.service
# installing service
enable-station:
@echo "installing weather station service"
@echo ""
sudo systemctl enable station.service
# uninstalling service
disable-station:
@echo "uninstalling weather station service"
@echo ""
sudo systemctl disable station.service
station-status: check-station
# check status of service
check-station:
@echo "checking weather station status"
@echo ""
@echo "the following error is due to the command - don't worry"
@echo ""
sudo systemctl status station.service
# LIVEDATA SERVICE:
# starting livedata service
start-livedata:
@echo "starting livedataProvider service"
@echo
sudo systemctl start livedataProvider.service
# stopping livedata service
stop-livedata:
@echo "stopping livedataProvider service"
@echo ""
sudo systemctl stop livedataProvider.service
# installing livedata service
enable-livedata:
@echo "installing livedataProvider service"
@echo ""
sudo systemctl enable livedataProvider.service
# uninstalling livedata service
disable-livedata:
@echo "uninstalling livedataProvider service"
@echo ""
sudo systemctl disable livedataProvider.service
status-livedata: check-livedata
# check status of livedata service
check-livedata:
@echo "checking livedataProvider status"
@echo ""
@echo "the following error is due to the command - don't worry"
@echo ""
sudo systemctl status livedataProvider.service
# Helpmenu
# printing all commands of this file
help:
@echo ""
@echo "---------------------------- [rpi-weatherstation - HELP] ----------------------------"
@echo ""
@echo "------------------------------------ [General] --------------------------------------"
@echo "- sudo make install................starts the setup script"
@echo "- sudo make uninstall..............removes the software from this device"
@echo ""
@echo "--------------------------------- [weatherstation] ----------------------------------"
@echo "- sudo make start-station..........starts the system service"
@echo "- sudo make stop-station...........stops the system service"
@echo "- sudo make enable-station.........installs the system service"
@echo "- sudo make disable-station........uninstalls the system service"
@echo "- sudo make check-station..........shows the status of the station system service"
@echo ""
@echo "-------------------------------- [livedataProvider] ---------------------------------"
@echo "- sudo make start-livedata.........starts the livedata service"
@echo "- sudo make stop-livedata..........stops the livedata service"
@echo "- sudo make enable-livedata........installs the livedata service"
@echo "- sudo make disable-livedata.......uninstalls the livedata service"
@echo "- sudo make check-livedata.........shows the status of the livedata system service"
@echo "-------------------------------------------------------------------------------------"
@echo ""