@@ -19,6 +19,19 @@ if [ "$y" = "samesame" ]; then
1919 samesame=true
2020fi
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
3851mqttpass=$( < /dev/urandom tr -dc ' 0123456789ABZDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' | head -c12)
3952serverip=$( hostname -I)
4053serverip=" ${serverip// [[:space:]]/ } "
41- echo " enter your linux username for building directorys"
42- echo " or live it emty but mide not work"
43- read myvariable
4454if [ -z " $myvariable " ]
4555then
4656 myvariable=$( who am i | awk ' {print $1}' )
4959# setup mosquitto broker
5060mosquitto_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
5468echo ' !!!the following inputs are for the openssl certificates!!!'
55-
5669openssl req -new -x509 -days 365 -extensions v3_ca -keyout ca.key -out ca.crt
5770openssl genrsa -out server.key 2048
5871openssl req -out server.csr -key server.key -new
@@ -61,10 +74,7 @@ openssl genrsa -out client.key 2048
6174openssl req -out client.csr -key client.key -new
6275openssl 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+
6878mv ca.key ./home_user/ssl/secrets
6979cp ca.crt ./home_user/ssl/client
7080mv ca.crt ./home_user/ssl/server
@@ -129,15 +139,6 @@ echo ' kill -SIGHUP $PID' >>./tmp/reload3.sh
129139echo ' 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
141142djangokey=$( < /dev/urandom tr -dc ' 0123456789!@#$%^&*()_=+abcdefghijklmnopqrstuvwxyz' | head -c50)
142143echo ' {' >> ./tmp/config.json
143144echo ' "' SENDING_MAIL' "' :' "' $sendingmail ' "' , >> ./tmp/config.json
@@ -170,7 +171,9 @@ echo '}' >>./tmp/config.json
170171
171172# building gateway zip file
172173mkdir ./IoTree_Gateway/.ssl
174+ if [ " $nossl " = false ]; then
173175cp ./home_user/ssl/client/* ./IoTree_Gateway/.ssl
176+ fi
174177echo ' {' >> ./IoTree_Gateway/.config.json
175178echo ' "' SERVER_IP' "' :' "' ${serverip} ' "' , >> ./IoTree_Gateway/.config.json
176179if [ " $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
195198mkdir /etc/iotree
196199mkdir /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 /
202205cp /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