Skip to content

Commit a1423bd

Browse files
andre2308cniweb
authored andcommitted
HTTPS Ports (#137)
* Andre2308 tmpfs (#2) * Update TMPFS Now it runs without Admin Password * Not longer Needed * Not longer needed * Update README.ME to new TMPF Version * Update README.md * Made some modifications for TMPFS * Updated the TMPFS and Z-Wave Installation * Made it choiceable on Installation. #131 * Fix Sed Failure and Cleaned TMPFS script * Add Config HTTPS Port on Install * Add Portcheck for HTTPS * Fix some Wizard Text
1 parent 14a4ef4 commit a1423bd

File tree

5 files changed

+83
-7
lines changed

5 files changed

+83
-7
lines changed

WIZARD_UIFILES/install_uifile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"step_title": "Adminport",
2323
"items": [{
2424
"type": "textfield",
25-
"desc": "Choose your HTTP port for openhab:",
25+
"desc": "Choose your ports for openhab:",
2626
"subitems": [{
2727
"key": "pkgwizard_txt_port",
2828
"desc": "HTTP Port",
@@ -37,6 +37,20 @@
3737
"errorText": "Error: HTTP Port must consist of 4 to 5 numbers."
3838
}
3939
}
40+
},{
41+
"key": "pkgwizard_txt_ports",
42+
"desc": "HTTPS Port",
43+
"defaultValue": "8443",
44+
"emptyText": "8443",
45+
"validator": {
46+
"allowBlank": false,
47+
"minLength": 4,
48+
"maxLength": 5,
49+
"regex": {
50+
"expr": "/[0-9]{4,5}/i",
51+
"errorText": "Error: HTTPS Port must consist of 4 to 5 numbers."
52+
}
53+
}
4054
}]
4155
}]
4256
},{

WIZARD_UIFILES/install_uifile_ger

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"step_title": "Adminport",
2222
"items": [{
2323
"type": "textfield",
24-
"desc": "Wähle den HTTP Port für Openhab aus:",
24+
"desc": "Wähle die Ports für Openhab aus:",
2525
"subitems": [{
2626
"key": "pkgwizard_txt_port",
2727
"desc": "HTTP Port",
@@ -36,6 +36,20 @@
3636
"errorText": "Error: HTTP Port muss aus 4 bis 5 Zahlen bestehen."
3737
}
3838
}
39+
},{
40+
"key": "pkgwizard_txt_ports",
41+
"desc": "HTTPS Port",
42+
"defaultValue": "8443",
43+
"emptyText": "8443",
44+
"validator": {
45+
"allowBlank": false,
46+
"minLength": 4,
47+
"maxLength": 5,
48+
"regex": {
49+
"expr": "/[0-9]{4,5}/i",
50+
"errorText": "Error: HTTPS Port muss aus 4 bis 5 Zahlen bestehen."
51+
}
52+
}
3953
}]
4054
}]
4155
},{

WIZARD_UIFILES/upgrade_uifile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"desc": "Choose your destination directory for configuration files:",
66
"subitems": [{
77
"key": "pkgwizard_public_std",
8+
89
"desc": "/public/openHAB/ <br>(must exist before installing and has to include the folders /conf and /addons and /userdata)",
910
"defaultValue": true
1011
}, {
@@ -21,7 +22,7 @@
2122
"step_title": "Adminport",
2223
"items": [{
2324
"type": "textfield",
24-
"desc": "Choose your HTTP port for openhab:",
25+
"desc": "Choose your ports for openhab:",
2526
"subitems": [{
2627
"key": "pkgwizard_txt_port",
2728
"desc": "HTTP Port",
@@ -36,6 +37,20 @@
3637
"errorText": "Error: HTTP Port must consist of 4 to 5 numbers."
3738
}
3839
}
40+
},{
41+
"key": "pkgwizard_txt_ports",
42+
"desc": "HTTPS Port",
43+
"defaultValue": "8443",
44+
"emptyText": "8443",
45+
"validator": {
46+
"allowBlank": false,
47+
"minLength": 4,
48+
"maxLength": 5,
49+
"regex": {
50+
"expr": "/[0-9]{4,5}/i",
51+
"errorText": "Error: HTTPS Port must consist of 4 to 5 numbers."
52+
}
53+
}
3954
}]
4055
}]
4156
},{

WIZARD_UIFILES/upgrade_uifile_ger

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"step_title": "Adminport",
2222
"items": [{
2323
"type": "textfield",
24-
"desc": "W&auml;hle einen HTTP Port f&uuml; openhab:",
24+
"desc": "W&auml;hle die Ports f&uuml;r Openhab aus:",
2525
"subitems": [{
2626
"key": "pkgwizard_txt_port",
2727
"desc": "HTTP Port",
@@ -33,7 +33,21 @@
3333
"maxLength": 5,
3434
"regex": {
3535
"expr": "/[0-9]{4,5}/i",
36-
"errorText": "Error: Der HTTP Port muss zwischen 4 und 5 Zahlen lang sein."
36+
"errorText": "Error: HTTP Port muss aus 4 bis 5 Zahlen bestehen."
37+
}
38+
}
39+
},{
40+
"key": "pkgwizard_txt_ports",
41+
"desc": "HTTPS Port",
42+
"defaultValue": "8443",
43+
"emptyText": "8443",
44+
"validator": {
45+
"allowBlank": false,
46+
"minLength": 4,
47+
"maxLength": 5,
48+
"regex": {
49+
"expr": "/[0-9]{4,5}/i",
50+
"errorText": "Error: HTTPS Port muss aus 4 bis 5 Zahlen bestehen."
3751
}
3852
}
3953
}]

scripts/installer.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ if [ ! -z "${pkgwizard_txt_port}" ]; then
5757
fi
5858
fi
5959

60+
if [ ! -z "${pkgwizard_txt_ports}" ]; then
61+
echo " port: ${pkgwizard_txt_ports}" >>$LOG
62+
if netstat -tlpn | grep ${pkgwizard_txt_ports}; then
63+
echo " Your selected port ${pkgwizard_txt_ports} is already in use." >>$LOG
64+
echo " Please choose another one and try again." >>$LOG
65+
echo " Port ${pkgwizard_txt_ports} already in use. Please try again." >> $SYNOPKG_TEMP_LOGFILE
66+
exit 1
67+
fi
68+
fi
69+
6070
OH_FOLDERS_EXISTS=no
6171
OH_CONF="${OH_FOLDER}/conf"
6272
OH_ADDONS="${OH_FOLDER}/addons"
@@ -207,15 +217,24 @@ postinst ()
207217
exit 1;
208218
fi
209219

210-
# configurate new port for openhab
220+
# configurate new http port for openhab
211221
sed -i "s/^.*HTTP_PORT=.*$/HTTP_PORT=${pkgwizard_txt_port}/g" ${SYNOPKG_PKGDEST}/runtime/bin/setenv
212222
if [ $? -ne 0 ]; then
213223
echo " FAILED (sed)" >>$LOG;
214-
echo " Could not change ${SYNOPKG_PKGDEST}/runtime/bin/setenv file with new port." >>$LOG;
224+
echo " Could not change ${SYNOPKG_PKGDEST}/runtime/bin/setenv file with new http port." >>$LOG;
215225
echo " Installation failed. See log file $LOG for more details." >> $SYNOPKG_TEMP_LOGFILE
216226
exit 1;
217227
fi
218228

229+
# configurate new https port for openhab
230+
sed -i "s/^.*HTTPS_PORT=.*$/HTTPS_PORT=${pkgwizard_txt_ports}/g" ${SYNOPKG_PKGDEST}/runtime/bin/setenv
231+
if [ $? -ne 0 ]; then
232+
echo " FAILED (sed)" >>$LOG;
233+
echo " Could not change ${SYNOPKG_PKGDEST}/runtime/bin/setenv file with new https port." >>$LOG;
234+
echo " Installation failed. See log file $LOG for more details." >> $SYNOPKG_TEMP_LOGFILE
235+
exit 1;
236+
fi
237+
219238
# configurate TMPFS
220239
if [ "${pkgwizard_tmpfs}" == "true" ]; then
221240
sed -i "s|^OPENHAB2_ROOT=.*$|OPENHAB2_ROOT=""${OH_FOLDER}""|g" "${SYNOPKG_PKGDEST}/openHAB-tmpfs.sh"

0 commit comments

Comments
 (0)