machineconfig 2.1__py3-none-any.whl → 2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +2 -1
- machineconfig/cluster/templates/utils.py +0 -35
- machineconfig/jobs/python/check_installations.py +1 -1
- machineconfig/jobs/python_custom_installers/dev/code.py +0 -13
- machineconfig/jobs/python_generic_installers/config.json +1 -1
- machineconfig/profile/create.py +10 -5
- machineconfig/profile/create_hardlinks.py +3 -1
- machineconfig/profile/shell.py +8 -7
- machineconfig/scripts/__init__.py +0 -2
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/linux/devops +6 -4
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/generate_files.py +14 -15
- machineconfig/scripts/python/ai/mcinit.py +8 -5
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +7 -7
- machineconfig/scripts/python/choose_wezterm_theme.py +35 -32
- machineconfig/scripts/python/cloud_copy.py +22 -13
- machineconfig/scripts/python/cloud_mount.py +35 -23
- machineconfig/scripts/python/cloud_repo_sync.py +38 -25
- machineconfig/scripts/python/cloud_sync.py +4 -4
- machineconfig/scripts/python/croshell.py +37 -28
- machineconfig/scripts/python/devops.py +45 -27
- machineconfig/scripts/python/devops_add_identity.py +15 -25
- machineconfig/scripts/python/devops_add_ssh_key.py +7 -7
- machineconfig/scripts/python/devops_backup_retrieve.py +17 -15
- machineconfig/scripts/python/devops_devapps_install.py +25 -20
- machineconfig/scripts/python/devops_update_repos.py +142 -57
- machineconfig/scripts/python/dotfile.py +16 -14
- machineconfig/scripts/python/fire_agents.py +24 -17
- machineconfig/scripts/python/fire_jobs.py +91 -55
- machineconfig/scripts/python/ftpx.py +24 -14
- machineconfig/scripts/python/get_zellij_cmd.py +8 -7
- machineconfig/scripts/python/helpers/cloud_helpers.py +33 -28
- machineconfig/scripts/python/helpers/helpers2.py +25 -14
- machineconfig/scripts/python/helpers/helpers4.py +44 -30
- machineconfig/scripts/python/helpers/helpers5.py +1 -1
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +31 -9
- machineconfig/scripts/python/mount_nfs.py +8 -15
- machineconfig/scripts/python/mount_nw_drive.py +10 -5
- machineconfig/scripts/python/mount_ssh.py +8 -6
- machineconfig/scripts/python/repos.py +215 -57
- machineconfig/scripts/python/snapshot.py +0 -1
- machineconfig/scripts/python/start_slidev.py +10 -5
- machineconfig/scripts/python/start_terminals.py +22 -16
- machineconfig/scripts/python/viewer_template.py +0 -1
- machineconfig/scripts/python/wifi_conn.py +49 -75
- machineconfig/scripts/python/wsl_windows_transfer.py +8 -6
- machineconfig/settings/lf/linux/lfrc +1 -0
- machineconfig/setup_linux/web_shortcuts/croshell.sh +5 -0
- machineconfig/setup_linux/web_shortcuts/interactive.sh +1 -1
- machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -4
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +3 -12
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +1 -1
- machineconfig/utils/code.py +3 -3
- machineconfig/utils/installer.py +2 -2
- machineconfig/utils/installer_utils/installer_abc.py +3 -4
- machineconfig/utils/installer_utils/installer_class.py +6 -4
- machineconfig/utils/links.py +103 -33
- machineconfig/utils/notifications.py +52 -38
- machineconfig/utils/options.py +16 -23
- machineconfig/utils/path_reduced.py +239 -205
- machineconfig/utils/procs.py +1 -1
- machineconfig/utils/source_of_truth.py +27 -0
- machineconfig/utils/ssh.py +9 -29
- machineconfig/utils/terminal.py +4 -2
- machineconfig/utils/upgrade_packages.py +91 -0
- machineconfig/utils/utils2.py +1 -2
- machineconfig/utils/utils5.py +23 -11
- machineconfig/utils/ve.py +4 -1
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/METADATA +13 -13
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/RECORD +78 -86
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/setup_linux/web_shortcuts/all.sh +0 -48
- machineconfig/setup_linux/web_shortcuts/update_system.sh +0 -48
- machineconfig/utils/utils.py +0 -97
- /machineconfig/setup_linux/web_shortcuts/{tmp.sh → android.sh} +0 -0
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/WHEEL +0 -0
- {machineconfig-2.1.dist-info → machineconfig-2.2.dist-info}/top_level.txt +0 -0
|
@@ -43,59 +43,45 @@ from rich.table import Table
|
|
|
43
43
|
|
|
44
44
|
console = Console()
|
|
45
45
|
|
|
46
|
+
|
|
46
47
|
def get_available_networks() -> List[Dict[str, str]]:
|
|
47
48
|
"""Get list of available WiFi networks"""
|
|
48
49
|
networks = []
|
|
49
50
|
|
|
50
51
|
try:
|
|
51
52
|
if platform.system() == "Windows":
|
|
52
|
-
result = subprocess.run(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
for line in result.stdout.split('\n'):
|
|
58
|
-
if 'All User Profile' in line:
|
|
59
|
-
ssid = line.split(':')[1].strip()
|
|
53
|
+
result = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output=True, text=True, check=True)
|
|
54
|
+
|
|
55
|
+
for line in result.stdout.split("\n"):
|
|
56
|
+
if "All User Profile" in line:
|
|
57
|
+
ssid = line.split(":")[1].strip()
|
|
60
58
|
networks.append({"ssid": ssid, "signal": "Unknown"})
|
|
61
59
|
|
|
62
60
|
# Also get available networks
|
|
63
|
-
result = subprocess.run(
|
|
64
|
-
["netsh", "wlan", "show", "networks"],
|
|
65
|
-
capture_output=True, text=True, check=True
|
|
66
|
-
)
|
|
61
|
+
result = subprocess.run(["netsh", "wlan", "show", "networks"], capture_output=True, text=True, check=True)
|
|
67
62
|
|
|
68
63
|
current_ssid = None
|
|
69
|
-
for line in result.stdout.split(
|
|
70
|
-
if
|
|
71
|
-
current_ssid = line.split(
|
|
72
|
-
elif
|
|
73
|
-
signal = line.split(
|
|
64
|
+
for line in result.stdout.split("\n"):
|
|
65
|
+
if "SSID" in line and "BSSID" not in line:
|
|
66
|
+
current_ssid = line.split(":")[1].strip()
|
|
67
|
+
elif "Signal" in line and current_ssid:
|
|
68
|
+
signal = line.split(":")[1].strip()
|
|
74
69
|
# Avoid duplicates
|
|
75
|
-
if not any(net[
|
|
70
|
+
if not any(net["ssid"] == current_ssid for net in networks):
|
|
76
71
|
networks.append({"ssid": current_ssid, "signal": signal})
|
|
77
72
|
current_ssid = None
|
|
78
73
|
|
|
79
74
|
elif platform.system() in ["Linux", "Darwin"]:
|
|
80
75
|
if platform.system() == "Linux":
|
|
81
|
-
result = subprocess.run(
|
|
82
|
-
["nmcli", "-t", "-f", "SSID,SIGNAL", "device", "wifi", "list"],
|
|
83
|
-
capture_output=True, text=True, check=True
|
|
84
|
-
)
|
|
76
|
+
result = subprocess.run(["nmcli", "-t", "-f", "SSID,SIGNAL", "device", "wifi", "list"], capture_output=True, text=True, check=True)
|
|
85
77
|
else: # Darwin/macOS - using airport command
|
|
86
|
-
result = subprocess.run(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
for line in result.stdout.strip().split('\n'):
|
|
92
|
-
if line and ':' in line:
|
|
93
|
-
parts = line.split(':')
|
|
78
|
+
result = subprocess.run(["/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", "-s"], capture_output=True, text=True, check=True)
|
|
79
|
+
|
|
80
|
+
for line in result.stdout.strip().split("\n"):
|
|
81
|
+
if line and ":" in line:
|
|
82
|
+
parts = line.split(":")
|
|
94
83
|
if len(parts) >= 2 and parts[0].strip():
|
|
95
|
-
networks.append({
|
|
96
|
-
"ssid": parts[0].strip(),
|
|
97
|
-
"signal": f"{parts[1].strip()}%"
|
|
98
|
-
})
|
|
84
|
+
networks.append({"ssid": parts[0].strip(), "signal": f"{parts[1].strip()}%"})
|
|
99
85
|
|
|
100
86
|
except subprocess.CalledProcessError as e:
|
|
101
87
|
console.print(f"[red]❌ Error scanning networks: {e}[/red]")
|
|
@@ -106,13 +92,14 @@ def get_available_networks() -> List[Dict[str, str]]:
|
|
|
106
92
|
seen = set()
|
|
107
93
|
unique_networks = []
|
|
108
94
|
for net in networks:
|
|
109
|
-
ssid = net[
|
|
95
|
+
ssid = net["ssid"]
|
|
110
96
|
if ssid and ssid not in seen:
|
|
111
97
|
seen.add(ssid)
|
|
112
98
|
unique_networks.append(net)
|
|
113
99
|
|
|
114
100
|
return unique_networks
|
|
115
101
|
|
|
102
|
+
|
|
116
103
|
def display_and_select_network() -> Optional[Dict[str, str]]:
|
|
117
104
|
"""Display available networks and let user select one"""
|
|
118
105
|
console.print("\n[blue]📡 Scanning for available WiFi networks...[/blue]")
|
|
@@ -130,18 +117,15 @@ def display_and_select_network() -> Optional[Dict[str, str]]:
|
|
|
130
117
|
table.add_column("Signal Strength", style="yellow")
|
|
131
118
|
|
|
132
119
|
for i, network in enumerate(networks, 1):
|
|
133
|
-
table.add_row(str(i), network[
|
|
120
|
+
table.add_row(str(i), network["ssid"], network["signal"])
|
|
134
121
|
|
|
135
122
|
console.print(table)
|
|
136
123
|
|
|
137
124
|
# Let user select
|
|
138
125
|
try:
|
|
139
|
-
choice = Prompt.ask(
|
|
140
|
-
"\n[blue]Select network number (or 'q' to quit)[/blue]",
|
|
141
|
-
default="q"
|
|
142
|
-
)
|
|
126
|
+
choice = Prompt.ask("\n[blue]Select network number (or 'q' to quit)[/blue]", default="q")
|
|
143
127
|
|
|
144
|
-
if choice.lower() ==
|
|
128
|
+
if choice.lower() == "q":
|
|
145
129
|
return None
|
|
146
130
|
|
|
147
131
|
index = int(choice) - 1
|
|
@@ -154,16 +138,15 @@ def display_and_select_network() -> Optional[Dict[str, str]]:
|
|
|
154
138
|
except ValueError:
|
|
155
139
|
console.print("[red]❌ Invalid input. Please enter a number.[/red]")
|
|
156
140
|
return None
|
|
141
|
+
|
|
142
|
+
|
|
157
143
|
def connect(name: str, ssid: str):
|
|
158
144
|
"""Connect to a WiFi network"""
|
|
159
145
|
console.print(f"\n[blue]🌐 Connecting to network: {name} (SSID: {ssid})[/blue]")
|
|
160
146
|
|
|
161
147
|
try:
|
|
162
148
|
if platform.system() == "Windows":
|
|
163
|
-
subprocess.run(
|
|
164
|
-
["netsh", "wlan", "connect", f"name={name}", f"ssid={ssid}", "interface=Wi-Fi"],
|
|
165
|
-
capture_output=True, text=True, check=True
|
|
166
|
-
)
|
|
149
|
+
subprocess.run(["netsh", "wlan", "connect", f"name={name}", f"ssid={ssid}", "interface=Wi-Fi"], capture_output=True, text=True, check=True)
|
|
167
150
|
elif platform.system() == "Linux":
|
|
168
151
|
subprocess.run(f"nmcli connection up '{name}'", shell=True, check=True)
|
|
169
152
|
|
|
@@ -176,6 +159,7 @@ def connect(name: str, ssid: str):
|
|
|
176
159
|
console.print(f"[red]❌ Unexpected error: {e}[/red]")
|
|
177
160
|
raise
|
|
178
161
|
|
|
162
|
+
|
|
179
163
|
def connect_to_new_network(ssid: str, password: str):
|
|
180
164
|
"""Connect to a new network with SSID and password"""
|
|
181
165
|
try:
|
|
@@ -199,6 +183,7 @@ def connect_to_new_network(ssid: str, password: str):
|
|
|
199
183
|
console.print(f"[red]❌ Failed to connect to {ssid}: {e}[/red]")
|
|
200
184
|
raise
|
|
201
185
|
|
|
186
|
+
|
|
202
187
|
def display_available_networks():
|
|
203
188
|
"""Display available networks (legacy function for compatibility)"""
|
|
204
189
|
console.print("\n[blue]📡 Scanning for available networks...[/blue]")
|
|
@@ -216,14 +201,11 @@ def display_available_networks():
|
|
|
216
201
|
except Exception as e:
|
|
217
202
|
console.print(f"[red]❌ Unexpected error: {e}[/red]")
|
|
218
203
|
|
|
204
|
+
|
|
219
205
|
def try_config_connection(config_ssid: str) -> bool:
|
|
220
206
|
"""Try to connect using configuration file"""
|
|
221
207
|
try:
|
|
222
|
-
config_paths = [
|
|
223
|
-
Path.home() / 'dotfiles/machineconfig/setup/wifi.ini',
|
|
224
|
-
Path.home() / '.config/wifi.ini',
|
|
225
|
-
Path.cwd() / 'wifi.ini'
|
|
226
|
-
]
|
|
208
|
+
config_paths = [Path.home() / "dotfiles/machineconfig/setup/wifi.ini", Path.home() / ".config/wifi.ini", Path.cwd() / "wifi.ini"]
|
|
227
209
|
|
|
228
210
|
creds = configparser.ConfigParser()
|
|
229
211
|
config_found = False
|
|
@@ -245,8 +227,8 @@ def try_config_connection(config_ssid: str) -> bool:
|
|
|
245
227
|
console.print(f"[blue]Available configured networks: {', '.join(available_ssids)}[/blue]")
|
|
246
228
|
return False
|
|
247
229
|
|
|
248
|
-
ssid = creds[config_ssid][
|
|
249
|
-
password = creds[config_ssid][
|
|
230
|
+
ssid = creds[config_ssid]["SSID"]
|
|
231
|
+
password = creds[config_ssid]["pwd"]
|
|
250
232
|
|
|
251
233
|
console.print(f"[green]✅ Found configuration for {config_ssid}[/green]")
|
|
252
234
|
connect_to_new_network(ssid, password)
|
|
@@ -256,6 +238,7 @@ def try_config_connection(config_ssid: str) -> bool:
|
|
|
256
238
|
console.print(f"[red]❌ Error reading configuration: {e}[/red]")
|
|
257
239
|
return False
|
|
258
240
|
|
|
241
|
+
|
|
259
242
|
def manual_network_selection() -> bool:
|
|
260
243
|
"""Manual network selection and connection"""
|
|
261
244
|
network = display_and_select_network()
|
|
@@ -263,7 +246,7 @@ def manual_network_selection() -> bool:
|
|
|
263
246
|
if not network:
|
|
264
247
|
return False
|
|
265
248
|
|
|
266
|
-
ssid = network[
|
|
249
|
+
ssid = network["ssid"]
|
|
267
250
|
console.print(f"\n[blue]Selected network: {ssid}[/blue]")
|
|
268
251
|
|
|
269
252
|
# Get password from user
|
|
@@ -279,18 +262,15 @@ def manual_network_selection() -> bool:
|
|
|
279
262
|
except Exception:
|
|
280
263
|
return False
|
|
281
264
|
|
|
265
|
+
|
|
282
266
|
def main():
|
|
283
267
|
"""Main function with fallback network selection"""
|
|
284
|
-
console.print(Panel(
|
|
285
|
-
"📶 Welcome to the WiFi Connector Tool",
|
|
286
|
-
title="[bold blue]WiFi Connection[/bold blue]",
|
|
287
|
-
border_style="blue"
|
|
288
|
-
))
|
|
268
|
+
console.print(Panel("📶 Welcome to the WiFi Connector Tool", title="[bold blue]WiFi Connection[/bold blue]", border_style="blue"))
|
|
289
269
|
|
|
290
|
-
parser = argparse.ArgumentParser(description=
|
|
291
|
-
parser.add_argument(
|
|
292
|
-
parser.add_argument(
|
|
293
|
-
parser.add_argument(
|
|
270
|
+
parser = argparse.ArgumentParser(description="WiFi Connector")
|
|
271
|
+
parser.add_argument("-n", "--ssid", help="🔗 SSID of WiFi (from config)", default="MyPhoneHotSpot")
|
|
272
|
+
parser.add_argument("-m", "--manual", action="store_true", help="🔍 Manual network selection mode")
|
|
273
|
+
parser.add_argument("-l", "--list", action="store_true", help="📡 List available networks only")
|
|
294
274
|
|
|
295
275
|
args = parser.parse_args()
|
|
296
276
|
|
|
@@ -326,16 +306,14 @@ def main():
|
|
|
326
306
|
else:
|
|
327
307
|
console.print("[blue]👋 Goodbye![/blue]")
|
|
328
308
|
|
|
309
|
+
|
|
329
310
|
def get_current_wifi_name() -> str:
|
|
330
311
|
"""Get the name of the currently connected WiFi network"""
|
|
331
312
|
console.print("\n[blue]🔍 Checking current WiFi connection...[/blue]")
|
|
332
313
|
|
|
333
314
|
try:
|
|
334
315
|
if platform.system() == "Windows":
|
|
335
|
-
result = subprocess.run(
|
|
336
|
-
["netsh", "wlan", "show", "interface"],
|
|
337
|
-
capture_output=True, text=True, check=True
|
|
338
|
-
)
|
|
316
|
+
result = subprocess.run(["netsh", "wlan", "show", "interface"], capture_output=True, text=True, check=True)
|
|
339
317
|
|
|
340
318
|
for line in result.stdout.split("\n"):
|
|
341
319
|
if "SSID" in line and "BSSID" not in line:
|
|
@@ -348,10 +326,7 @@ def get_current_wifi_name() -> str:
|
|
|
348
326
|
return "Not connected to WiFi"
|
|
349
327
|
|
|
350
328
|
elif platform.system() == "Linux":
|
|
351
|
-
result = subprocess.run(
|
|
352
|
-
["iwgetid", "-r"],
|
|
353
|
-
capture_output=True, text=True, check=True
|
|
354
|
-
)
|
|
329
|
+
result = subprocess.run(["iwgetid", "-r"], capture_output=True, text=True, check=True)
|
|
355
330
|
|
|
356
331
|
wifi_name = result.stdout.strip()
|
|
357
332
|
if wifi_name:
|
|
@@ -371,6 +346,7 @@ def get_current_wifi_name() -> str:
|
|
|
371
346
|
console.print("[yellow]⚠️ System not supported[/yellow]\n")
|
|
372
347
|
return "System not supported"
|
|
373
348
|
|
|
349
|
+
|
|
374
350
|
def create_new_connection(name: str, ssid: str, password: str):
|
|
375
351
|
"""Create a new WiFi connection profile"""
|
|
376
352
|
console.print(f"\n[blue]🔧 Creating new connection: {name} (SSID: {ssid})[/blue]")
|
|
@@ -407,10 +383,7 @@ def create_new_connection(name: str, ssid: str, password: str):
|
|
|
407
383
|
profile_path = f"{name}.xml"
|
|
408
384
|
Path(profile_path).write_text(xml_config, encoding="utf-8")
|
|
409
385
|
|
|
410
|
-
subprocess.run(
|
|
411
|
-
["netsh", "wlan", "add", "profile", f"filename={profile_path}", "interface=Wi-Fi"],
|
|
412
|
-
capture_output=True, text=True, check=True
|
|
413
|
-
)
|
|
386
|
+
subprocess.run(["netsh", "wlan", "add", "profile", f"filename={profile_path}", "interface=Wi-Fi"], capture_output=True, text=True, check=True)
|
|
414
387
|
|
|
415
388
|
# Clean up the XML file
|
|
416
389
|
try:
|
|
@@ -439,5 +412,6 @@ def create_new_connection(name: str, ssid: str, password: str):
|
|
|
439
412
|
console.print(f"[red]❌ Unexpected error: {e}[/red]")
|
|
440
413
|
raise
|
|
441
414
|
|
|
442
|
-
|
|
415
|
+
|
|
416
|
+
if __name__ == "__main__":
|
|
443
417
|
main()
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""TWSL
|
|
2
|
-
"""
|
|
1
|
+
"""TWSL"""
|
|
3
2
|
|
|
4
3
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
4
|
import argparse
|
|
@@ -9,7 +8,7 @@ from pathlib import Path
|
|
|
9
8
|
|
|
10
9
|
system = platform.system() # e.g. "Windows", "Linux", "Darwin" (macOS)
|
|
11
10
|
# HostName = platform.node() # e.g. "MY-SURFACE", os.env["COMPUTERNAME") only works for windows.
|
|
12
|
-
UserName
|
|
11
|
+
UserName = getpass.getuser() # e.g: username, os.env["USERNAME") only works for windows.
|
|
13
12
|
# UserDomain = os.environ["USERDOMAIN"] # e.g. HAD OR MY-SURFACE
|
|
14
13
|
# UserDomainRoaming = PathExtended(os.environ["USERDOMAIN_ROAMINGPROFILE"]) # e.g. SURFACE
|
|
15
14
|
# LogonServer = os.environ["LOGONSERVER"] # e.g. "\\MY-SURFACE"
|
|
@@ -26,9 +25,11 @@ def main():
|
|
|
26
25
|
print("🔄 Welcome to the WSL-Windows File Transfer Tool")
|
|
27
26
|
print("=" * 50 + "\n")
|
|
28
27
|
|
|
29
|
-
parser = argparse.ArgumentParser(
|
|
28
|
+
parser = argparse.ArgumentParser(
|
|
29
|
+
description="""📂 Move and copy files across WSL & Windows.
|
|
30
30
|
The direction is automatically determined by sensing the execution environment.
|
|
31
|
-
Otherwise, a flag must be raised to indicate the direction."""
|
|
31
|
+
Otherwise, a flag must be raised to indicate the direction."""
|
|
32
|
+
)
|
|
32
33
|
|
|
33
34
|
# positional argument
|
|
34
35
|
parser.add_argument("path", help="📁 Path of file/folder to transfer over.")
|
|
@@ -57,6 +58,7 @@ Otherwise, a flag must be raised to indicate the direction.""")
|
|
|
57
58
|
else:
|
|
58
59
|
from machineconfig.utils.ssh import SSH
|
|
59
60
|
import platform
|
|
61
|
+
|
|
60
62
|
port = int(args.port) if args.port else (2222 if system == "Windows" else 22)
|
|
61
63
|
username = UserName
|
|
62
64
|
hostname = platform.node()
|
|
@@ -66,5 +68,5 @@ Otherwise, a flag must be raised to indicate the direction.""")
|
|
|
66
68
|
print("✅ SSH transfer completed successfully!\n")
|
|
67
69
|
|
|
68
70
|
|
|
69
|
-
if __name__ ==
|
|
71
|
+
if __name__ == "__main__":
|
|
70
72
|
main()
|
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
curl bit.ly/cfgvelinux -L | bash
|
|
4
4
|
curl bit.ly/cfgreposlinux -L | bash
|
|
5
|
+
|
|
6
|
+
cd $HOME/code/machineconfig
|
|
7
|
+
$HOME/.local/bin/uv sync --no-dev
|
|
8
|
+
$HOME/.local/bin/uv pip install -e ../crocodile
|
|
9
|
+
|
|
5
10
|
source $HOME/code/machineconfig/src/machineconfig/setup_linux/symlinks.sh
|
|
6
11
|
. ~/.bashrc
|
|
@@ -137,10 +137,10 @@ choice=${choice:-y}
|
|
|
137
137
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
138
138
|
echo """ 🔧 Installing development tools...
|
|
139
139
|
"""
|
|
140
|
-
. $HOME/code/machineconfig/.venv/bin/activate
|
|
141
140
|
(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) || true
|
|
142
141
|
sudo nala install libssl-dev -y
|
|
143
142
|
sudo nala install ffmpeg -y
|
|
143
|
+
. $HOME/code/machineconfig/.venv/bin/activate
|
|
144
144
|
python -m fire machineconfig.scripts.python.devops_devapps_install main --which=wezterm,brave,code
|
|
145
145
|
else
|
|
146
146
|
echo """ ⏭️ Skipping development tools installation
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/bash
|
|
2
|
-
#=======================================================================
|
|
3
|
-
# 🔒 SSH SERVER SETUP SCRIPT
|
|
4
|
-
#=======================================================================
|
|
5
|
-
# This script sets up SSH server with public key authentication
|
|
6
2
|
|
|
7
3
|
echo """#=======================================================================
|
|
8
4
|
🔑 SSH KEY SETUP | Configuring SSH public key authentication
|
|
@@ -5,7 +5,7 @@ https://glitchbone.github.io/vscode-base16-term/#/3024
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
8
|
-
from machineconfig.utils.
|
|
8
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
9
9
|
from machineconfig.utils.installer_utils.installer_class import Installer
|
|
10
10
|
import subprocess
|
|
11
11
|
from typing import Iterable
|
|
@@ -23,10 +23,7 @@ nerd_fonts = {
|
|
|
23
23
|
|
|
24
24
|
# Patterns to match any installed variant (NF, Nerd Font, Mono, Propo, style weights) of Cascadia/Caskaydia
|
|
25
25
|
# We'll compile them at runtime for flexibility. Keep them simple to avoid false positives.
|
|
26
|
-
REQUIRED_FONT_PATTERNS: tuple[str, ...] = (
|
|
27
|
-
r"caskaydiacove.*(nf|nerd ?font)",
|
|
28
|
-
r"cascadiacode.*(nf|nerd ?font)",
|
|
29
|
-
)
|
|
26
|
+
REQUIRED_FONT_PATTERNS: tuple[str, ...] = (r"caskaydiacove.*(nf|nerd ?font)", r"cascadiacode.*(nf|nerd ?font)")
|
|
30
27
|
|
|
31
28
|
|
|
32
29
|
def _list_installed_fonts() -> list[str]:
|
|
@@ -37,13 +34,7 @@ def _list_installed_fonts() -> list[str]:
|
|
|
37
34
|
"""
|
|
38
35
|
try:
|
|
39
36
|
# Query only base names to make substring matching simpler; remove underscores like the PS script does.
|
|
40
|
-
cmd = [
|
|
41
|
-
"powershell.exe",
|
|
42
|
-
"-NoLogo",
|
|
43
|
-
"-NonInteractive",
|
|
44
|
-
"-Command",
|
|
45
|
-
"Get-ChildItem -Path C:/Windows/Fonts -File | Select-Object -ExpandProperty BaseName"
|
|
46
|
-
]
|
|
37
|
+
cmd = ["powershell.exe", "-NoLogo", "-NonInteractive", "-Command", "Get-ChildItem -Path C:/Windows/Fonts -File | Select-Object -ExpandProperty BaseName"]
|
|
47
38
|
res = subprocess.run(cmd, capture_output=True, text=True, check=True) # noqa: S603 S607 (trusted command)
|
|
48
39
|
fonts = [x.strip().replace("_", "") for x in res.stdout.splitlines() if x.strip() != ""]
|
|
49
40
|
return fonts
|
|
@@ -4,7 +4,7 @@ from machineconfig.utils.utils2 import randstr, read_json
|
|
|
4
4
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
5
5
|
from machineconfig.utils.io_save import save_json
|
|
6
6
|
import platform
|
|
7
|
-
from machineconfig.utils.
|
|
7
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
8
8
|
from uuid import uuid4
|
|
9
9
|
import os
|
|
10
10
|
from typing import Any
|
machineconfig/utils/code.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
|
|
1
2
|
import platform
|
|
2
3
|
from typing import Optional
|
|
3
4
|
import subprocess
|
|
4
5
|
from rich.console import Console
|
|
5
6
|
from rich.panel import Panel
|
|
6
7
|
from rich.syntax import Syntax
|
|
8
|
+
|
|
7
9
|
from machineconfig.utils.utils2 import randstr
|
|
8
10
|
from machineconfig.utils.ve import get_ve_activate_line
|
|
9
11
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
PROGRAM_PATH = PathExtended.home().joinpath("tmp_results", "shells", "python_return_command") + (".ps1" if platform.system() == "Windows" else ".sh")
|
|
12
|
+
from machineconfig.utils.source_of_truth import PROGRAM_PATH
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def get_shell_script_executing_python_file(python_file: str, func: Optional[str], ve_path: str, strict_execution: bool = True):
|
machineconfig/utils/installer.py
CHANGED
|
@@ -6,7 +6,7 @@ from rich.console import Console
|
|
|
6
6
|
from rich.panel import Panel # Added import
|
|
7
7
|
|
|
8
8
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
9
|
-
from machineconfig.utils.
|
|
9
|
+
from machineconfig.utils.source_of_truth import INSTALL_VERSION_ROOT
|
|
10
10
|
from machineconfig.utils.utils2 import read_json
|
|
11
11
|
|
|
12
12
|
# from dataclasses import dataclass
|
|
@@ -171,7 +171,7 @@ def install_all(installers: list[Installer], safe: bool = False, jobs: int = 10,
|
|
|
171
171
|
print(f"\n{'=' * 80}\n🚀 BULK INSTALLATION PROCESS 🚀\n{'=' * 80}")
|
|
172
172
|
if fresh:
|
|
173
173
|
print("🧹 Fresh install requested - clearing version cache...")
|
|
174
|
-
INSTALL_VERSION_ROOT.delete(sure=True)
|
|
174
|
+
PathExtended(INSTALL_VERSION_ROOT).delete(sure=True)
|
|
175
175
|
print("✅ Version cache cleared")
|
|
176
176
|
|
|
177
177
|
if safe:
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
|
|
1
2
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
3
|
+
from machineconfig.utils.source_of_truth import WINDOWS_INSTALL_PATH, LINUX_INSTALL_PATH
|
|
2
4
|
from typing import Optional, TypeAlias, Literal
|
|
3
5
|
import subprocess
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
# LINUX_INSTALL_PATH = '~/.local/bin'
|
|
7
|
-
LINUX_INSTALL_PATH = PathExtended.home().joinpath(".local/bin").__str__()
|
|
8
|
-
WINDOWS_INSTALL_PATH = PathExtended.home().joinpath("AppData/Local/Microsoft/WindowsApps").__str__()
|
|
7
|
+
|
|
9
8
|
CATEGORY: TypeAlias = Literal["OS_SPECIFIC", "OS_GENERIC", "CUSTOM", "OS_SPECIFIC_DEV", "OS_GENERIC_DEV", "CUSTOM_DEV"]
|
|
10
9
|
|
|
11
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from machineconfig.utils.path_reduced import PathExtended as PathExtended
|
|
2
2
|
from machineconfig.utils.installer_utils.installer_abc import find_move_delete_linux, find_move_delete_windows
|
|
3
|
-
from machineconfig.utils.
|
|
3
|
+
from machineconfig.utils.source_of_truth import INSTALL_TMP_DIR, INSTALL_VERSION_ROOT, LIBRARY_ROOT
|
|
4
|
+
from machineconfig.utils.options import check_tool_exists
|
|
4
5
|
from machineconfig.utils.utils2 import pprint, read_json
|
|
5
6
|
|
|
6
7
|
import platform
|
|
@@ -61,7 +62,7 @@ class Installer:
|
|
|
61
62
|
@staticmethod
|
|
62
63
|
def choose_app_and_install():
|
|
63
64
|
print(f"\n{'=' * 80}\n🔍 SELECT APPLICATION TO INSTALL 🔍\n{'=' * 80}")
|
|
64
|
-
from machineconfig.utils.
|
|
65
|
+
from machineconfig.utils.options import choose_one_option
|
|
65
66
|
|
|
66
67
|
print("📂 Searching for configuration files...")
|
|
67
68
|
jobs_dir = Path(LIBRARY_ROOT.joinpath("jobs"))
|
|
@@ -125,7 +126,8 @@ class Installer:
|
|
|
125
126
|
script = "#!/bin/bash" + "\n" + program
|
|
126
127
|
else:
|
|
127
128
|
script = program
|
|
128
|
-
script_file = PathExtended.tmpfile(name="tmp_shell_script", suffix=".ps1" if platform.system() == "Windows" else ".sh", folder="tmp_scripts")
|
|
129
|
+
script_file = PathExtended.tmpfile(name="tmp_shell_script", suffix=".ps1" if platform.system() == "Windows" else ".sh", folder="tmp_scripts")
|
|
130
|
+
script_file.write_text(script, newline=None if platform.system() == "Windows" else "\n")
|
|
129
131
|
if platform.system() == "Windows":
|
|
130
132
|
start_cmd = "powershell"
|
|
131
133
|
full_command = f"{start_cmd} {script_file}"
|
|
@@ -364,7 +366,7 @@ class Installer:
|
|
|
364
366
|
if existing_version == version_to_be_installed:
|
|
365
367
|
print(f"✅ {exe_name} is up to date (version {version_to_be_installed})")
|
|
366
368
|
print(f"📂 Version information stored at: {INSTALL_VERSION_ROOT}")
|
|
367
|
-
return ("✅
|
|
369
|
+
return ("✅ Up to date", version.strip(), version_to_be_installed.strip())
|
|
368
370
|
else:
|
|
369
371
|
print(f"🔄 {exe_name} needs update: {existing_version.rstrip()} → {version_to_be_installed}")
|
|
370
372
|
tmp_path.write_text(version_to_be_installed, encoding="utf-8")
|