Skip to content

Commit a5f4b13

Browse files
authored
Update setup.sh
1 parent d1844f5 commit a5f4b13

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

IoTree_dir/setup.sh

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ if [ "$y" = "samesame" ]; then
1919
samesame=true
2020
fi
2121

22+
# entrys
23+
echo "<<<--- Hallo to IoTree42 --->>>"
24+
echo "ENTER YOUR LINUX USERNAME FOR BUIDING PATHS"
25+
read myvariable
26+
echo "<-- SETUP DJANGO -->"
27+
echo "ENTER AN EMAIL, for sending the password reset url"
28+
read sendingmail
29+
echo "ENTER PASSWORD FOR THIS EMAIL, for sending the password reset url"
30+
echo "--!! hidden input !!--"
31+
read -s sendingpass
32+
echo "ENTER ADMINMAIL, for resiving notivications form server"
33+
read adminmail
34+
2235
# istalling all nessery programms
2336
# sudo apt-get update
2437
# sudo apt-get -y upgrade
@@ -38,9 +51,6 @@ python3 -m pip install --user virtualenv
3851
mqttpass=$(</dev/urandom tr -dc '0123456789ABZDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' | head -c12)
3952
serverip=$(hostname -I)
4053
serverip="${serverip//[[:space:]]/}"
41-
echo "enter your linux username for building directorys"
42-
echo "or live it emty but mide not work"
43-
read myvariable
4454
if [ -z "$myvariable" ]
4555
then
4656
myvariable=$(who am i | awk '{print $1}')
@@ -49,10 +59,13 @@ fi
4959
# setup mosquitto broker
5060
mosquitto_passwd -b ./home_user/passwd mqttodb $mqttpass
5161

52-
if [ "$nossl" = false ]; then
5362
# making and storing the ssl certificates
63+
mkdir ./home_user/ssl
64+
mkdir ./home_user/ssl/server
65+
mkdir ./home_user/ssl/client
66+
mkdir ./home_user/ssl/secrets
67+
if [ "$nossl" = false ]; then
5468
echo '!!!the following inputs are for the openssl certificates!!!'
55-
5669
openssl req -new -x509 -days 365 -extensions v3_ca -keyout ca.key -out ca.crt
5770
openssl genrsa -out server.key 2048
5871
openssl req -out server.csr -key server.key -new
@@ -61,10 +74,7 @@ openssl genrsa -out client.key 2048
6174
openssl req -out client.csr -key client.key -new
6275
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 364
6376

64-
mkdir ./home_user/ssl
65-
mkdir ./home_user/ssl/server
66-
mkdir ./home_user/ssl/client
67-
mkdir ./home_user/ssl/secrets
77+
6878
mv ca.key ./home_user/ssl/secrets
6979
cp ca.crt ./home_user/ssl/client
7080
mv ca.crt ./home_user/ssl/server
@@ -129,15 +139,6 @@ echo ' kill -SIGHUP $PID' >>./tmp/reload3.sh
129139
echo 'done' >>./tmp/reload3.sh
130140

131141
#build config.json file for django
132-
echo "<-- setup your django configs -->"
133-
echo "-- enter a mail, for sending the password reset url. tested with Google mail --"
134-
echo "-- if you have no sudiple mail accunt live empty the restet funktion is not avalable then --"
135-
read sendingmail
136-
echo "-- enter the password mail acaunt, for sending the password reset url --"
137-
echo "--!! hidden input !!--"
138-
read -s sendingpass
139-
echo "-- enter your mail for resiving notivications form server --"
140-
read adminmail
141142
djangokey=$(</dev/urandom tr -dc '0123456789!@#$%^&*()_=+abcdefghijklmnopqrstuvwxyz' | head -c50)
142143
echo '{' >>./tmp/config.json
143144
echo '"'SENDING_MAIL'"':'"'$sendingmail'"', >>./tmp/config.json
@@ -170,7 +171,9 @@ echo '}' >>./tmp/config.json
170171

171172
# building gateway zip file
172173
mkdir ./IoTree_Gateway/.ssl
174+
if [ "$nossl" = false ]; then
173175
cp ./home_user/ssl/client/* ./IoTree_Gateway/.ssl
176+
fi
174177
echo '{' >>./IoTree_Gateway/.config.json
175178
echo '"'SERVER_IP'"':'"'${serverip}'"', >>./IoTree_Gateway/.config.json
176179
if [ "$nossl" = false ]; then
@@ -194,16 +197,16 @@ mv ./IoTree_Gateway_V_1.1.zip ./home_user/dj_iot/media/downloadfiles
194197
# move all files and folders to destination
195198
mkdir /etc/iotree
196199
mkdir /home/$myvariable/.ssl
197-
cp -v ./home_user/ssl/* /home/$myvariable/.ssl
198-
cp ./home_user/acl /home/$myvariable/.acl
199-
cp ./home_user/passwd /home/$myvariable/.passwd
200-
cp ./home_user/hashing /home/$myvariable/.hashing
201-
cp -v ./home_user/* /home/$myvariable/
200+
cp -r ./home_user/ssl/* /home/$myvariable/.ssl
201+
cp -r ./home_user/acl /home/$myvariable/.acl
202+
cp -r ./home_user/passwd /home/$myvariable/.passwd
203+
cp -r ./home_user/hashing /home/$myvariable/.hashing
204+
cp -r ./home_user/* /home/$myvariable/
202205
cp /etc/mosquitto/mosquitto.conf /etc/mosquitto/mosquitto.conf.iotree_save
203-
cp ./tmp/mosquitto.conf /etc/mosquitto.conf
204-
cp ./tmp/config.json /etc/iotree
205-
cp ./tmp/hash3.sh /etc/iotree
206-
cp ./tmp/reload3.sh /etc/iotree
206+
cp -r ./tmp/mosquitto.conf /etc/mosquitto.conf
207+
cp -r ./tmp/config.json /etc/iotree
208+
cp -r ./tmp/hash3.sh /etc/iotree
209+
cp -r ./tmp/reload3.sh /etc/iotree
207210

208211

209212
# secure files

0 commit comments

Comments
 (0)