Skip to content

Commit a65fe9f

Browse files
committed
Merge branch 'master' into dev/texasaggie97/allow-disable-of-each-config
2 parents dc97d7e + 2f36bee commit a65fe9f

File tree

5 files changed

+35
-30
lines changed

5 files changed

+35
-30
lines changed

nilrt_snac/_configs/_console_config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ def __init__(self):
1414
def configure(self, args: argparse.Namespace) -> None:
1515
print("Deconfiguring console access...")
1616

17-
if args.dry_run:
18-
return
17+
if not args.dry_run:
18+
logger.debug("Disabling console access...")
19+
subprocess.run(
20+
["nirtcfg", "--set", "section=systemsettings,token=consoleout.enabled,value=False"],
21+
check=True,
22+
)
1923

20-
subprocess.run(
21-
["nirtcfg", "--set", "section=systemsettings,token=consoleout.enabled,value=False"],
22-
check=True,
23-
)
2424
opkg.remove("sysconfig-settings-console", force_depends=True)
2525

2626
def verify(self, args: argparse.Namespace) -> bool:

nilrt_snac/_configs/_graphical_config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88

99

1010
class _GraphicalConfig(_BaseConfig):
11-
"""The graphical configuration for SNAC is to deconfigure the X11, embedded UI, and other components that are only useful when using the graphical UI."""
11+
"""The graphical configuration for SNAC is to deconfigure the X11, embedded UI, and other components that are useful only when using the graphical UI."""
1212

1313
def __init__(self):
1414
super().__init__("graphical")
1515

1616
def configure(self, args: Namespace) -> None:
1717
print("Deconfiguring the graphical UI...")
18-
if args.dry_run:
19-
return
18+
if not args.dry_run:
19+
logger.debug("Disabling the embedded UI...")
20+
run(
21+
["nirtcfg", "--set", "section=systemsettings,token=ui.enabled,value=False"],
22+
check=True,
23+
)
2024

21-
run(["nirtcfg", "--set", "section=systemsettings,token=ui.enabled,value=False"], check=True)
2225
opkg.remove("packagegroup-ni-graphical", autoremove=True)
2326
opkg.remove("packagegroup-core-x11", autoremove=True)
2427

nilrt_snac/_configs/_opkg_config.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def configure(self, args: argparse.Namespace) -> None:
1919
print("Configuring opkg...")
2020
snac_config_file = _ConfigFile(OPKG_SNAC_CONF)
2121
snac_config_file.chmod(0o644)
22-
base_feeds_config_file = _ConfigFile("/etc/opkg/base-feeds.conf")
2322
dry_run: bool = args.dry_run
2423

2524
if not snac_config_file.contains_exact("option autoremove 1"):
@@ -37,26 +36,20 @@ def configure(self, args: argparse.Namespace) -> None:
3736
if not dry_run:
3837
subprocess.run(["rm", "-fv", "/etc/opkg/NI-dist.conf"], check=True)
3938

40-
if base_feeds_config_file.contains("src.*/extra/.*"):
41-
base_feeds_config_file.update("^src.*/extra/.*", "")
42-
4339
snac_config_file.save(dry_run)
44-
base_feeds_config_file.save(dry_run)
4540
self._opkg_helper.update()
4641

4742
def verify(self, args: argparse.Namespace) -> bool:
4843
print("Verifying opkg configuration...")
4944
snac_config_file = _ConfigFile(OPKG_SNAC_CONF)
50-
base_feeds_config_file = _ConfigFile("/etc/opkg/base-feeds.conf")
5145
valid = True
5246
if not snac_config_file.exists():
5347
valid = False
5448
logger.error(f"MISSING: {OPKG_SNAC_CONF} not found")
5549
elif not snac_config_file.contains_exact("option autoremove 1"):
5650
valid = False
5751
logger.error(f"MISSING: 'option autoremove 1' not found in {snac_config_file.path}")
58-
if base_feeds_config_file.contains("src.*/extra/.*"):
52+
if pathlib.Path("/etc/opkg/NI-dist.conf").exists():
5953
valid = False
60-
logger.error(f"FOUND: 'src.*/extra/.*' found in {base_feeds_config_file.path}")
61-
54+
logger.error("UNSUPPORTED: /etc/opkg/NI-dist.conf found")
6255
return valid

nilrt_snac/_configs/_syslog_ng_config.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,23 @@ def __init__(self):
1515
def configure(self, args: argparse.Namespace) -> None:
1616
print("Configuring syslog-ng...")
1717
dry_run: bool = args.dry_run
18-
if dry_run:
19-
return
2018

2119
# Check if syslog-ng is already installed
2220
if not self._opkg_helper.is_installed("syslog-ng"):
2321
self._opkg_helper.install("syslog-ng")
2422

25-
# Enable persistent storage
26-
_cmd("nirtcfg", "--set", 'section=SystemSettings,token=PersistentLogs.enabled,value="True"')
27-
28-
# Restart syslog-ng service
29-
_cmd("/etc/init.d/syslog", "restart")
23+
if not dry_run:
24+
# Enable persistent storage
25+
logger.debug("Enabling persistent log storage...")
26+
_cmd(
27+
"nirtcfg",
28+
"--set",
29+
'section=SystemSettings,token=PersistentLogs.enabled,value="True"',
30+
)
31+
32+
# Restart syslog-ng service
33+
logger.debug("Restarting syslog-ng service...")
34+
_cmd("/etc/init.d/syslog", "restart")
3035

3136
def verify(self, args: argparse.Namespace) -> bool:
3237
print("Verifying syslog-ng configuration...")

nilrt_snac/_configs/_wifi_config.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self):
1313
super().__init__("wifi")
1414

1515
def configure(self, args: argparse.Namespace) -> None:
16-
print("Configuring WiFi configuration...")
16+
print("Disabling WiFi support...")
1717
config_file = _ConfigFile("/etc/modprobe.d/snac_blacklist.conf")
1818
dry_run: bool = args.dry_run
1919
if not config_file.contains_exact("install cfg80211 /bin/true"):
@@ -37,13 +37,17 @@ def configure(self, args: argparse.Namespace) -> None:
3737
subprocess.run(["rmmod", "cfg80211", "mac80211"], check=False)
3838

3939
def verify(self, args: argparse.Namespace) -> bool:
40-
print("Verifying WiFi configuration...")
40+
print("Verifying WiFi support disabled...")
4141
config_file = _ConfigFile("/etc/modprobe.d/snac_blacklist.conf")
4242
valid = True
4343
if not config_file.exists():
4444
valid = False
4545
logger.error(f"MISSING: {config_file.path} not found")
46-
elif not config_file.contains_exact("install cfg80211 /bin/true"):
46+
if not config_file.contains_exact("install cfg80211 /bin/true"):
4747
valid = False
48-
logger.error("MISSING: commands to fail install of WiFi modules")
48+
logger.error(
49+
"MISSING: The line 'install cfg80211 /bin/true' was not found in "
50+
f"{config_file.path}. This command is required to prevent WiFi kernel modules from loading. "
51+
"Please ensure the file contains the necessary 'install' directives to fully disable WiFi support."
52+
)
4953
return valid

0 commit comments

Comments
 (0)