-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(web-ui): move starting/stopping of the required hotspot syst…
…em services to the `ubo-hotspot` service (the more general version of the `ubo-redirect-server` service which runs the redirect server as its main process.)
- Loading branch information
Showing
25 changed files
with
117 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Set up the hotspot configuration files.""" | ||
|
||
import pathlib | ||
import sys | ||
|
||
from ubo_app.constants import WEB_UI_HOTSPOT_PASSWORD | ||
from ubo_app.utils.pod_id import get_pod_id | ||
from ubo_app.utils.template_files import copy_templates, restore_backups | ||
|
||
|
||
def main() -> None: | ||
"""Set up the hotspot configuration files.""" | ||
templates_path = pathlib.Path(__file__).parent / 'hotspot_templates' | ||
if sys.argv[1] == 'configure': | ||
copy_templates( | ||
templates_path, | ||
variables={ | ||
'SSID': get_pod_id(with_default=True), | ||
'PASSWORD': WEB_UI_HOTSPOT_PASSWORD, | ||
}, | ||
) | ||
elif sys.argv[1] == 'restore': | ||
restore_backups(templates_path) | ||
else: | ||
msg = 'Invalid argument' | ||
raise ValueError(msg) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[Unit] | ||
Description=Ubo Hotspot Service | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
ExecStartPre=/bin/sh -c 'echo "Disabling power save mode on wlan0"' | ||
ExecStartPre=/usr/bin/env iw wlan0 set power_save off | ||
ExecStartPre=/bin/sh -c 'echo "Unblocking wifi"' | ||
ExecStartPre=/usr/bin/env rfkill unblock wifi | ||
ExecStartPre=/bin/sh -c 'echo "Writing configuration files"' | ||
ExecStartPre=/opt/ubo/env/bin/ubo-hotspot-config configure | ||
ExecStartPre=/bin/sh -c 'echo "Restarting dhcpcd service"' | ||
ExecStartPre=/bin/systemctl restart dhcpcd.service | ||
ExecStartPre=/bin/sh -c 'echo "Restarting dnsmasq service"' | ||
ExecStartPre=/bin/systemctl restart dnsmasq.service | ||
ExecStartPre=/bin/sh -c 'echo "Unmasking hostapd service"' | ||
ExecStartPre=/bin/systemctl unmask hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Enabling hostapd service"' | ||
ExecStartPre=/bin/systemctl enable hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Starting Ubo Hotspot Service"' | ||
ExecStartPre=/bin/systemctl start hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Starting Redirect Server"' | ||
ExecStart=/opt/ubo/env/bin/ubo-redirect-server | ||
ExecStopPost={{INSTALLATION_PATH}}/env/bin/ubo-hotspot-config restore | ||
ExecStopPost=/bin/sh -c 'echo "# Default dhcpcd configuration\n# Leave this blank for automatic configuration" > /etc/dhcpcd.conf' | ||
ExecStartPre=/bin/sh -c 'echo "Stopping Ubo Hotspot Service"' | ||
ExecStopPost=/bin/systemctl stop hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Disabling hostapd service"' | ||
ExecStopPost=/bin/systemctl disable hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Masking hostapd service"' | ||
ExecStopPost=/bin/systemctl mask hostapd.service | ||
ExecStartPre=/bin/sh -c 'echo "Stopping dnsmasq service"' | ||
ExecStopPost=/bin/systemctl stop dnsmasq.service | ||
ExecStartPre=/bin/sh -c 'echo "Restarting dhcpcd service"' | ||
ExecStopPost=/bin/systemctl restart dhcpcd.service | ||
WorkingDirectory=/opt/ubo | ||
KillMode=control-group | ||
Restart=always |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.