Added chroot functionality (Issue #1)
This commit is contained in:
parent
f2eb558814
commit
bbe1ce9bc3
4 changed files with 18 additions and 3 deletions
|
@ -20,6 +20,8 @@ Installation is easy. There are no dependencies on Python modules that are not p
|
||||||
- Execute it (`sudo ./configurator.py`)
|
- Execute it (`sudo ./configurator.py`)
|
||||||
- To terminate the process do the usual `CTRL+C`, maybe once or twice
|
- To terminate the process do the usual `CTRL+C`, maybe once or twice
|
||||||
|
|
||||||
|
It is also possible to place configurator.py somewhere else. For this to work though, you have to modify the source code. Near the top you'll find the variable `BASEPATH`. Set this to something like `"/home/hass/.homeassistant"`, and no matter where you're running the configurator from, it will [chroot](https://linux.die.net/man/1/chroot) into that directory and start serving files from there.
|
||||||
|
|
||||||
By default the webapp listens on IP `0.0.0.0` (which is every IP the machine has) on port `3218`. If you leave it that way and you DON'T USE SSL, you can embed the configurator into HASS using a [panel_iframe](https://home-assistant.io/components/panel_iframe/):
|
By default the webapp listens on IP `0.0.0.0` (which is every IP the machine has) on port `3218`. If you leave it that way and you DON'T USE SSL, you can embed the configurator into HASS using a [panel_iframe](https://home-assistant.io/components/panel_iframe/):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
Version 0.0.5 (2017-01-27)
|
||||||
|
- Ugly workaround to run configurator.py from somewhere else than HASS-dir (Issue #1)
|
||||||
|
|
||||||
Version 0.0.4 (2017-01-26)
|
Version 0.0.4 (2017-01-26)
|
||||||
- Added modal dialogs (displayed when AJAX is done, dismiss with click)
|
- Added modal dialogs (displayed when AJAX is done, dismiss with click)
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,10 @@ from string import Template
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
from urllib.parse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
VERSION = "0.0.4"
|
VERSION = "0.0.5"
|
||||||
BASEDIR = "."
|
BASEDIR = "."
|
||||||
|
# Set BASEPATH to something like "/home/hass/.homeasssitant" if you're not running the configurator from that path
|
||||||
|
BASEPATH = None
|
||||||
LISTENIP = "0.0.0.0"
|
LISTENIP = "0.0.0.0"
|
||||||
LISTENPORT = 3218
|
LISTENPORT = 3218
|
||||||
BOOTSTRAPAPI = "http://127.0.0.1:8123/api/bootstrap"
|
BOOTSTRAPAPI = "http://127.0.0.1:8123/api/bootstrap"
|
||||||
|
@ -385,6 +387,9 @@ def run():
|
||||||
server_address = (LISTENIP, LISTENPORT)
|
server_address = (LISTENIP, LISTENPORT)
|
||||||
httpd = HTTPServer(server_address, RequestHandler)
|
httpd = HTTPServer(server_address, RequestHandler)
|
||||||
print('running server...')
|
print('running server...')
|
||||||
|
if BASEPATH:
|
||||||
|
os.chroot(BASEPATH)
|
||||||
|
os.chdir('/')
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
|
@ -11,8 +11,10 @@ from string import Template
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
from urllib.parse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
VERSION = "0.0.4"
|
VERSION = "0.0.5"
|
||||||
BASEDIR = "."
|
BASEDIR = "."
|
||||||
|
# Set BASEPATH to something like "/home/hass/.homeasssitant" if you're not running the configurator from that path
|
||||||
|
BASEPATH = None
|
||||||
LISTENIP = "0.0.0.0"
|
LISTENIP = "0.0.0.0"
|
||||||
LISTENPORT = 3218
|
LISTENPORT = 3218
|
||||||
BOOTSTRAPAPI = "http://127.0.0.1:8123/api/bootstrap"
|
BOOTSTRAPAPI = "http://127.0.0.1:8123/api/bootstrap"
|
||||||
|
@ -144,6 +146,9 @@ def run():
|
||||||
server_address = (LISTENIP, LISTENPORT)
|
server_address = (LISTENIP, LISTENPORT)
|
||||||
httpd = HTTPServer(server_address, RequestHandler)
|
httpd = HTTPServer(server_address, RequestHandler)
|
||||||
print('running server...')
|
print('running server...')
|
||||||
|
if BASEPATH:
|
||||||
|
os.chroot(BASEPATH)
|
||||||
|
os.chdir('/')
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue