Skip to content

Commit

Permalink
Add commands to enable/disable the NI webserver
Browse files Browse the repository at this point in the history
- Fixes #96
  • Loading branch information
virtuald committed Jan 15, 2024
1 parent 6478aa6 commit 42935cc
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions robotpy_installer/cli_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,48 @@ def run(
)


class InstallerNiWebEnable(_BasicInstallerCmd):
"""
Enables the NI web server and starts it
"""

def on_run(self, installer: RobotpyInstaller):
installer.ssh.exec_bash(
"update-rc.d -f systemWebServer defaults",
"/etc/init.d/systemWebServer start",
check=True,
print_output=True,
)


class InstallerNiWebDisable(_BasicInstallerCmd):
"""
Stops the NI web server and disables it from starting
"""

def on_run(self, installer: RobotpyInstaller):
installer.ssh.exec_bash(
"/etc/init.d/systemWebServer stop",
"update-rc.d -f systemWebServer remove",
check=True,
print_output=True,
)


class InstallerNiWeb:
"""
Manipulates the NI web server
The NI web server on the RoboRIO takes up a lot of memory, and isn't
used for very much. Use these commands to enable or disable it.
"""

subcommands = [
("enable", InstallerNiWebEnable),
("disable", InstallerNiWebDisable),
]


class InstallerList(_BasicInstallerCmd):
"""
Lists Python packages present on RoboRIO
Expand Down Expand Up @@ -367,6 +409,7 @@ class Installer:
("install", InstallerInstall),
("install-python", InstallerInstallPython),
("list", InstallerList),
("niweb", InstallerNiWeb),
("uninstall", InstallerUninstall),
("uninstall-python", InstallerUninstallPython),
("uninstall-robotpy", InstallerUninstallRobotPy),
Expand Down

0 comments on commit 42935cc

Please sign in to comment.