machineconfig 5.16__py3-none-any.whl → 5.18__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/__init__.py +0 -28
- machineconfig/cluster/sessions_managers/wt_local.py +6 -1
- machineconfig/cluster/sessions_managers/wt_local_manager.py +4 -2
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +4 -2
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +4 -2
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +1 -1
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +3 -1
- machineconfig/profile/create.py +108 -140
- machineconfig/profile/create_frontend.py +58 -0
- machineconfig/profile/shell.py +45 -9
- machineconfig/scripts/python/ai/solutions/_shared.py +9 -1
- machineconfig/scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md +1 -1
- machineconfig/scripts/python/ai/solutions/generic.py +12 -2
- machineconfig/scripts/python/count_lines_frontend.py +1 -1
- machineconfig/scripts/python/devops.py +78 -49
- machineconfig/scripts/python/dotfile.py +14 -8
- machineconfig/scripts/python/interactive.py +5 -23
- machineconfig/scripts/python/share_terminal.py +1 -1
- machineconfig/setup_linux/__init__.py +11 -0
- machineconfig/setup_linux/{openssh_all.sh → ssh/openssh_all.sh} +1 -0
- machineconfig/setup_linux/web_shortcuts/interactive.sh +1 -1
- machineconfig/setup_windows/__init__.py +12 -0
- machineconfig/setup_windows/apps.ps1 +1 -0
- machineconfig/setup_windows/{openssh_all.ps1 → ssh/openssh_all.ps1} +5 -5
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +1 -1
- machineconfig/utils/code.py +7 -4
- machineconfig/utils/files/dbms.py +355 -0
- machineconfig/utils/files/read.py +2 -2
- machineconfig/utils/installer.py +25 -5
- machineconfig/utils/links.py +128 -104
- machineconfig/utils/procs.py +4 -4
- machineconfig/utils/scheduler.py +10 -14
- {machineconfig-5.16.dist-info → machineconfig-5.18.dist-info}/METADATA +1 -1
- {machineconfig-5.16.dist-info → machineconfig-5.18.dist-info}/RECORD +42 -52
- machineconfig/scripts/windows/dotfile.ps1 +0 -1
- machineconfig/setup_linux/others/openssh-server_add_pub_key.sh +0 -57
- machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -11
- machineconfig/setup_linux/web_shortcuts/ssh.sh +0 -52
- machineconfig/setup_windows/symlinks.ps1 +0 -5
- machineconfig/setup_windows/symlinks2linux.ps1 +0 -1
- machineconfig/setup_windows/web_shortcuts/all.ps1 +0 -18
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +0 -36
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +0 -16
- machineconfig/setup_windows/web_shortcuts/ssh.ps1 +0 -11
- machineconfig/setup_windows/wsl_refresh.ps1 +0 -8
- machineconfig/setup_windows/wt_and_pwsh.ps1 +0 -9
- /machineconfig/setup_linux/{openssh_wsl.sh → ssh/openssh_wsl.sh} +0 -0
- /machineconfig/setup_windows/{quirks.ps1 → others/power_options.ps1} +0 -0
- /machineconfig/setup_windows/{openssh-server.ps1 → ssh/openssh-server.ps1} +0 -0
- /machineconfig/setup_windows/{openssh-server_add-sshkey.ps1 → ssh/openssh-server_add-sshkey.ps1} +0 -0
- /machineconfig/setup_windows/{openssh-server_add_identity.ps1 → ssh/openssh-server_add_identity.ps1} +0 -0
- {machineconfig-5.16.dist-info → machineconfig-5.18.dist-info}/WHEEL +0 -0
- {machineconfig-5.16.dist-info → machineconfig-5.18.dist-info}/entry_points.txt +0 -0
- {machineconfig-5.16.dist-info → machineconfig-5.18.dist-info}/top_level.txt +0 -0
|
@@ -2,4 +2,12 @@ from pathlib import Path
|
|
|
2
2
|
from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
3
3
|
|
|
4
4
|
def get_generic_instructions_path() -> Path:
|
|
5
|
-
|
|
5
|
+
path = LIBRARY_ROOT.joinpath("scripts/python/ai/solutions/copilot/instructions/python/dev.instructions.md")
|
|
6
|
+
text = path.read_text(encoding="utf-8")
|
|
7
|
+
import platform
|
|
8
|
+
if platform.system().lower() == "windows":
|
|
9
|
+
text = text.replace("bash", "powershell").replace(".sh", ".ps1")
|
|
10
|
+
import tempfile
|
|
11
|
+
temp_path = Path(tempfile.gettempdir()).joinpath("generic_instructions.md")
|
|
12
|
+
temp_path.write_text(data=text, encoding="utf-8")
|
|
13
|
+
return temp_path
|
|
@@ -34,7 +34,7 @@ applyTo: "**/*.py"
|
|
|
34
34
|
* when finished, run a linting static analysis check against files you touched, Any fix any mistakes.
|
|
35
35
|
* Please run `uv run -m pyright $file_touched` and address all issues. if `pyright is not there, first run `uv add pyright --dev`.
|
|
36
36
|
* For all type checkers and linters, like mypy, pyright, pyrefly and pylint, there are config files at different levels of the repo all the way up to home directory level. You don't need to worry about them, just be mindful that they exist. The tools themselves will respect the configs therein.
|
|
37
|
-
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as `./.scripts/
|
|
37
|
+
* If you want to run all linters and pycheckers agains the entire project to make sure everything is clean, I prepared a nice shell script, you can run it from the repo root as `./.scripts/lint_and_type_check.sh`. It will produce markdown files that are you are meant to look at @ ./.linters/*.md
|
|
38
38
|
|
|
39
39
|
# General Programming Ethos:
|
|
40
40
|
* Make sure all the code is rigorous, no lazy stuff.
|
|
@@ -6,9 +6,19 @@ from machineconfig.utils.source_of_truth import LIBRARY_ROOT
|
|
|
6
6
|
def create_dot_scripts(repo_root: Path) -> None:
|
|
7
7
|
scripts_dir = LIBRARY_ROOT.joinpath("scripts/python/ai/scripts")
|
|
8
8
|
target_dir = repo_root.joinpath(".scripts")
|
|
9
|
+
import shutil
|
|
10
|
+
shutil.rmtree(target_dir, ignore_errors=True)
|
|
9
11
|
target_dir.mkdir(parents=True, exist_ok=True)
|
|
10
|
-
for script_path in scripts_dir.iterdir():
|
|
11
|
-
|
|
12
|
+
# for script_path in scripts_dir.iterdir():
|
|
13
|
+
# target_dir.joinpath(script_path.name).write_text(data=script_path.read_text(encoding="utf-8"), encoding="utf-8")
|
|
14
|
+
import platform
|
|
15
|
+
if platform.system() == "Windows":
|
|
16
|
+
script_path = scripts_dir.joinpath("lint_and_type_check.ps1")
|
|
17
|
+
elif platform.system() in ["Linux", "Darwin"]:
|
|
18
|
+
script_path = scripts_dir.joinpath("lint_and_type_check.sh")
|
|
19
|
+
else:
|
|
20
|
+
raise NotImplementedError(f"Platform {platform.system()} is not supported.")
|
|
21
|
+
target_dir.joinpath(script_path.name).write_text(data=script_path.read_text(encoding="utf-8"), encoding="utf-8")
|
|
12
22
|
|
|
13
23
|
|
|
14
24
|
def adjust_gitignore(repo_root: Path) -> None:
|
|
@@ -6,7 +6,7 @@ def analyze_repo_development(repo_path: str = typer.Argument(..., help="Path to
|
|
|
6
6
|
from machineconfig.scripts.python import count_lines
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
count_lines_path = Path(count_lines.__file__)
|
|
9
|
-
# --project $HOME/code/machineconfig
|
|
9
|
+
# --project $HOME/code/machineconfig --group plot
|
|
10
10
|
cmd = f"""uv run --python 3.13 --with machineconfig[plot] {count_lines_path} analyze-over-time {repo_path}"""
|
|
11
11
|
from machineconfig.utils.code import run_shell_script
|
|
12
12
|
run_shell_script(cmd)
|
|
@@ -4,102 +4,131 @@ import machineconfig.utils.installer_utils.installer as installer_entry_point
|
|
|
4
4
|
import machineconfig.scripts.python.share_terminal as share_terminal
|
|
5
5
|
import machineconfig.scripts.python.repos as repos
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import machineconfig.profile.create_frontend as create_frontend
|
|
8
|
+
# import machineconfig.scripts.python.dotfile as dotfile_module
|
|
8
9
|
import typer
|
|
10
|
+
from typing import Literal, Annotated
|
|
9
11
|
|
|
10
12
|
|
|
11
|
-
app = typer.Typer(help=
|
|
13
|
+
app = typer.Typer(help="🛠️ DevOps operations", no_args_is_help=True)
|
|
12
14
|
app.command(name="install", help="📦 Install essential packages")(installer_entry_point.main)
|
|
13
|
-
app.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
|
|
14
15
|
app.add_typer(repos.app, name="repos", help="📁 Manage git repositories")
|
|
15
16
|
|
|
16
|
-
ssh_app = typer.Typer(help="🔐 SSH operations subcommands", no_args_is_help=True)
|
|
17
|
-
app.add_typer(ssh_app, name="ssh")
|
|
18
17
|
|
|
18
|
+
config_apps = typer.Typer(help="⚙️ Configuration subcommands", no_args_is_help=True)
|
|
19
|
+
app.add_typer(config_apps, name="config")
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
app_data = typer.Typer(help="💾 Data subcommands", no_args_is_help=True)
|
|
24
|
+
app.add_typer(app_data, name="data")
|
|
25
|
+
|
|
26
|
+
nw_apps = typer.Typer(help="🔐 Network subcommands", no_args_is_help=True)
|
|
27
|
+
nw_apps.command(name="share-terminal", help="📡 Share terminal via web browser")(share_terminal.main)
|
|
28
|
+
app.add_typer(nw_apps, name="network")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
self_app = typer.Typer(help="🔄 SELF operations subcommands", no_args_is_help=True)
|
|
32
|
+
app.add_typer(self_app, name="self")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@self_app.command()
|
|
21
36
|
def update():
|
|
22
37
|
"""🔄 UPDATE essential repos"""
|
|
23
38
|
import machineconfig.scripts.python.devops_update_repos as helper
|
|
24
39
|
helper.main()
|
|
40
|
+
@self_app.command()
|
|
41
|
+
def interactive():
|
|
42
|
+
"""🤖 INTERACTIVE configuration of machine."""
|
|
43
|
+
from machineconfig.scripts.python.interactive import main
|
|
44
|
+
main()
|
|
45
|
+
@self_app.command()
|
|
46
|
+
def status():
|
|
47
|
+
"""📊 STATUS of machine, shell profile, apps, symlinks, dotfiles, etc."""
|
|
48
|
+
pass
|
|
25
49
|
|
|
26
50
|
|
|
27
|
-
@
|
|
28
|
-
def
|
|
29
|
-
"""🔗
|
|
30
|
-
|
|
31
|
-
helper.main_symlinks()
|
|
51
|
+
@config_apps.command(no_args_is_help=True)
|
|
52
|
+
def private():
|
|
53
|
+
"""🔗 Manage private configuration files."""
|
|
54
|
+
create_frontend.main_private_from_parser()
|
|
32
55
|
|
|
56
|
+
@config_apps.command(no_args_is_help=True)
|
|
57
|
+
def public():
|
|
58
|
+
"""🔗 Manage public configuration files."""
|
|
59
|
+
create_frontend.main_public_from_parser()
|
|
33
60
|
|
|
34
|
-
@
|
|
35
|
-
def
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
helper.main_profile()
|
|
61
|
+
# @config_apps.command(no_args_is_help=True)
|
|
62
|
+
# def dotfile():
|
|
63
|
+
# """🔗 Manage dotfiles."""
|
|
64
|
+
# dotfile_module.main()
|
|
39
65
|
|
|
40
66
|
|
|
41
|
-
@
|
|
42
|
-
def
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
@config_apps.command(no_args_is_help=True)
|
|
68
|
+
def shell(method: Annotated[Literal["copy", "reference"], typer.Argument(help="Choose the method to configure the shell profile: 'copy' copies the init script directly, 'reference' references machineconfig for dynamic updates.")]):
|
|
69
|
+
"""🔗 Configure your shell profile."""
|
|
70
|
+
from machineconfig.profile.shell import create_default_shell_profile
|
|
71
|
+
create_default_shell_profile(method=method)
|
|
46
72
|
|
|
47
73
|
|
|
48
|
-
@
|
|
74
|
+
@nw_apps.command()
|
|
49
75
|
def add_key():
|
|
50
76
|
"""🔑 SSH add pub key to this machine"""
|
|
51
77
|
import machineconfig.scripts.python.devops_add_ssh_key as helper
|
|
52
78
|
helper.main()
|
|
53
|
-
@
|
|
79
|
+
@nw_apps.command()
|
|
54
80
|
def add_identity():
|
|
55
81
|
"""🗝️ SSH add identity (private key) to this machine"""
|
|
56
82
|
import machineconfig.scripts.python.devops_add_identity as helper
|
|
57
83
|
helper.main()
|
|
58
|
-
@
|
|
84
|
+
@nw_apps.command()
|
|
59
85
|
def connect():
|
|
60
86
|
"""🔐 SSH use key pair to connect two machines"""
|
|
61
87
|
raise NotImplementedError
|
|
62
|
-
|
|
88
|
+
|
|
89
|
+
@nw_apps.command()
|
|
63
90
|
def setup():
|
|
64
91
|
"""📡 SSH setup"""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
import platform
|
|
93
|
+
if platform.system() == "Windows":
|
|
94
|
+
from machineconfig.setup_windows import SSH_SERVER
|
|
95
|
+
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
96
|
+
elif platform.system() == "Linux" or platform.system() == "Darwin":
|
|
97
|
+
from machineconfig.setup_linux import SSH_SERVER
|
|
98
|
+
program = SSH_SERVER.read_text(encoding="utf-8")
|
|
99
|
+
else:
|
|
100
|
+
raise NotImplementedError(f"Platform {platform.system()} is not supported.")
|
|
101
|
+
from machineconfig.utils.code import run_shell_script
|
|
102
|
+
run_shell_script(program=program)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@app_data.command()
|
|
78
106
|
def backup():
|
|
79
107
|
"""💾 BACKUP"""
|
|
80
108
|
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
81
109
|
main_backup_retrieve(direction="BACKUP")
|
|
82
110
|
|
|
83
111
|
|
|
84
|
-
@
|
|
112
|
+
@app_data.command()
|
|
85
113
|
def retrieve():
|
|
86
114
|
"""📥 RETRIEVE"""
|
|
87
115
|
from machineconfig.scripts.python.devops_backup_retrieve import main_backup_retrieve
|
|
88
116
|
main_backup_retrieve(direction="RETRIEVE")
|
|
89
117
|
|
|
90
118
|
|
|
91
|
-
@app.command()
|
|
92
|
-
def scheduler():
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
119
|
+
# @app.command()
|
|
120
|
+
# def scheduler():
|
|
121
|
+
# """⏰ SCHEDULER"""
|
|
122
|
+
# # from machineconfig.scripts.python.scheduler import main as helper
|
|
123
|
+
# # helper()
|
|
124
|
+
|
|
96
125
|
|
|
97
|
-
@app.command()
|
|
98
|
-
def interactive():
|
|
99
|
-
"""🤖 INTERACTIVE configuration of machine."""
|
|
100
|
-
from machineconfig.scripts.python.interactive import main
|
|
101
|
-
main()
|
|
102
126
|
|
|
127
|
+
# @app.command()
|
|
128
|
+
# def scheduler():
|
|
129
|
+
# """⏰ SCHEDULER"""
|
|
130
|
+
# # from machineconfig.scripts.python.scheduler import main as helper
|
|
131
|
+
# # helper()
|
|
103
132
|
|
|
104
133
|
|
|
105
134
|
if __name__ == "__main__":
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
from typing import Annotated
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from rich.console import Console
|
|
7
|
-
from rich.panel import Panel
|
|
8
6
|
|
|
9
|
-
from machineconfig.utils.links import symlink_func
|
|
10
|
-
from machineconfig.utils.path_extended import PathExtended
|
|
11
|
-
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
# @app.command()
|
|
9
|
+
# def symlinks_new():
|
|
10
|
+
# """🆕 SYMLINKS new. consider moving to the new config command, then may be merge it with the dotfile subcommand"""
|
|
11
|
+
# import machineconfig.jobs.python.python_ve_symlink as helper
|
|
12
|
+
# helper.main()
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
def main(
|
|
@@ -19,6 +17,14 @@ def main(
|
|
|
19
17
|
overwrite: Annotated[bool, typer.Option("--overwrite", "-o", help="Overwrite.")] = False,
|
|
20
18
|
dest: Annotated[str, typer.Option("--dest", "-d", help="destination folder")] = "",
|
|
21
19
|
) -> None:
|
|
20
|
+
|
|
21
|
+
from rich.console import Console
|
|
22
|
+
from rich.panel import Panel
|
|
23
|
+
|
|
24
|
+
from machineconfig.utils.links import symlink_map
|
|
25
|
+
from machineconfig.utils.path_extended import PathExtended
|
|
26
|
+
from machineconfig.utils.source_of_truth import LIBRARY_ROOT, REPO_ROOT
|
|
27
|
+
console = Console()
|
|
22
28
|
orig_path = PathExtended(file).expanduser().absolute()
|
|
23
29
|
if dest == "":
|
|
24
30
|
if "Local" in str(orig_path):
|
|
@@ -35,7 +41,7 @@ def main(
|
|
|
35
41
|
dest_path.mkdir(parents=True, exist_ok=True)
|
|
36
42
|
new_path = dest_path.joinpath(orig_path.name)
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
symlink_map(config_file_default_path=orig_path, self_managed_config_file_path=new_path, on_conflict="throwError")
|
|
39
45
|
|
|
40
46
|
console.print(
|
|
41
47
|
Panel(
|
|
@@ -34,7 +34,8 @@ console = Console()
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def display_header() -> None:
|
|
37
|
-
|
|
37
|
+
from machineconfig.utils.installer import get_machineconfig_version
|
|
38
|
+
header_text = Text(f"MACHINE CONFIGURATION {get_machineconfig_version()}", style="bold magenta")
|
|
38
39
|
subtitle_text = Text("Interactive Installation Script", style="italic cyan")
|
|
39
40
|
console.print(Panel(f"📦 {header_text}\n{subtitle_text}", border_style="blue", padding=(1, 2)))
|
|
40
41
|
def display_completion_message() -> None:
|
|
@@ -75,7 +76,6 @@ def get_installation_choices() -> list[str]:
|
|
|
75
76
|
Choice(value="install_repos", title="🐍 Install Repos - Set up Python environment and repositories permanently.", checked=False),
|
|
76
77
|
Choice(value="install_ssh_server", title="🔒 Install SSH Server - Set up remote access", checked=False),
|
|
77
78
|
Choice(value="install_shell_profile", title="🐚 Configure Shell Profile - Source machineconfig shell initialization", checked=False),
|
|
78
|
-
Choice(value="create_symlinks", title="🔗 Create Symlinks - Set up configuration symlinks (finish dotfiles transfer first)", checked=False),
|
|
79
79
|
Choice(value="retrieve_repositories", title="📚 Retrieve Repositories - Clone repositories to ~/code", checked=False),
|
|
80
80
|
Choice(value="retrieve_data", title="💾 Retrieve Data - Backup restoration", checked=False),
|
|
81
81
|
]
|
|
@@ -141,30 +141,12 @@ Set-Service -Name sshd -StartupType 'Automatic'"""
|
|
|
141
141
|
console.print(Panel("🐚 [bold green]SHELL PROFILE[/bold green]\n[italic]Shell configuration setup[/italic]", border_style="green"))
|
|
142
142
|
console.print("🔧 Configuring shell profile", style="bold cyan")
|
|
143
143
|
try:
|
|
144
|
-
from machineconfig.profile.
|
|
145
|
-
|
|
146
|
-
main_profile()
|
|
144
|
+
from machineconfig.profile.shell import create_default_shell_profile
|
|
145
|
+
create_default_shell_profile()
|
|
147
146
|
console.print("✅ Shell profile configured successfully", style="bold green")
|
|
148
147
|
except Exception as e:
|
|
149
148
|
console.print(f"❌ Error configuring shell profile: {e}", style="bold red")
|
|
150
149
|
|
|
151
|
-
if "create_symlinks" in selected_options:
|
|
152
|
-
display_dotfiles_instructions()
|
|
153
|
-
dotfiles_ready = questionary.confirm("📂 Have you finished copying dotfiles?", default=True).ask()
|
|
154
|
-
if dotfiles_ready:
|
|
155
|
-
console.print(Panel("🔗 [bold cyan]SYMLINK CREATION[/bold cyan]\n[italic]Configuration setup[/italic]", border_style="cyan"))
|
|
156
|
-
console.print("🔧 Creating symlinks", style="bold cyan")
|
|
157
|
-
try:
|
|
158
|
-
from machineconfig.profile.create import main_symlinks
|
|
159
|
-
main_symlinks()
|
|
160
|
-
console.print("✅ Symlinks created successfully", style="bold green")
|
|
161
|
-
except Exception as e:
|
|
162
|
-
console.print(f"❌ Error creating symlinks: {e}", style="bold red")
|
|
163
|
-
run_shell_script("sudo chmod 600 $HOME/.ssh/*")
|
|
164
|
-
run_shell_script("sudo chmod 700 $HOME/.ssh")
|
|
165
|
-
else:
|
|
166
|
-
console.print("⏭️ Skipping symlink creation - finish dotfiles transfer first", style="yellow")
|
|
167
|
-
|
|
168
150
|
if "retrieve_repositories" in selected_options:
|
|
169
151
|
console.print(Panel("📚 [bold bright_magenta]REPOSITORIES[/bold bright_magenta]\n[italic]Project code retrieval[/italic]", border_style="bright_magenta"))
|
|
170
152
|
from machineconfig.scripts.python import repos
|
|
@@ -188,7 +170,6 @@ Set-Service -Name sshd -StartupType 'Automatic'"""
|
|
|
188
170
|
|
|
189
171
|
|
|
190
172
|
def main() -> None:
|
|
191
|
-
"""Main function to run the interactive installation."""
|
|
192
173
|
display_header()
|
|
193
174
|
selected_options = get_installation_choices()
|
|
194
175
|
if not selected_options:
|
|
@@ -200,6 +181,7 @@ def main() -> None:
|
|
|
200
181
|
console.print("❌ Installation cancelled.", style="bold red")
|
|
201
182
|
sys.exit(0)
|
|
202
183
|
execute_installations(selected_options)
|
|
184
|
+
display_dotfiles_instructions()
|
|
203
185
|
display_completion_message()
|
|
204
186
|
|
|
205
187
|
|
|
@@ -133,7 +133,7 @@ def main(
|
|
|
133
133
|
ttyd --writable -t enableSixel=true {ssl_args} --port {port} --credential "{username}:{password}" -t 'theme={{"background": "black"}}' {start_command}
|
|
134
134
|
"""
|
|
135
135
|
from machineconfig.utils.code import run_shell_script
|
|
136
|
-
run_shell_script(code)
|
|
136
|
+
run_shell_script(code, display_script=False)
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
def main_with_parser():
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
APPS = Path(__file__).parent.joinpath("apps.sh")
|
|
5
|
+
REPOS = Path(__file__).parent.joinpath("repos.sh")
|
|
6
|
+
VE = Path(__file__).parent.joinpath("ve.sh")
|
|
7
|
+
|
|
8
|
+
APPS_DESKTOP = Path(__file__).parent.joinpath("apps_desktop.sh")
|
|
9
|
+
APPS_GUI = Path(__file__).parent.joinpath("apps_gui.sh")
|
|
10
|
+
|
|
11
|
+
SSH_SERVER = Path(__file__).parent.joinpath("ssh/openssh_server.sh")
|
|
@@ -13,6 +13,7 @@ sudo chmod 700 ~/.ssh
|
|
|
13
13
|
echo "✅ FINISHED modifying .ssh folder attributes."
|
|
14
14
|
|
|
15
15
|
# 🔄 Clean install OpenSSH server
|
|
16
|
+
sudo nala install openssh-server -y || true # try to install first
|
|
16
17
|
sudo nala purge openssh-server -y
|
|
17
18
|
sudo nala install openssh-server -y
|
|
18
19
|
echo "✅ FINISHED installing openssh-server."
|
|
@@ -6,4 +6,4 @@ echo """
|
|
|
6
6
|
======================================================================="""
|
|
7
7
|
|
|
8
8
|
curl https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_linux/ve.sh | bash
|
|
9
|
-
$HOME/.local/bin/uv run --python 3.13 --with machineconfig devops interactive
|
|
9
|
+
$HOME/.local/bin/uv run --python 3.13 --with machineconfig devops self interactive
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
APPS = Path(__file__).parent.joinpath("apps.ps1")
|
|
5
|
+
REPOS = Path(__file__).parent.joinpath("repos.ps1")
|
|
6
|
+
VE = Path(__file__).parent.joinpath("ve.ps1")
|
|
7
|
+
|
|
8
|
+
DOCKER = Path(__file__).parent.joinpath("others/docker.ps1")
|
|
9
|
+
OBS = Path(__file__).parent.joinpath("others/obs.ps1")
|
|
10
|
+
POWER_OPTIONS = Path(__file__).parent.joinpath("others/power_options.ps1")
|
|
11
|
+
|
|
12
|
+
SSH_SERVER = Path(__file__).parent.joinpath("ssh/openssh_server.ps1")
|
|
@@ -12,6 +12,7 @@ winget install --no-upgrade --name "Starship" --Id "Starship
|
|
|
12
12
|
winget install --no-upgrade --name "Git" --Id "Git.Git" --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
13
13
|
winget install --no-upgrade --name "Neovim" --Id "Neovim.Neovim" --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
14
14
|
winget install --no-upgrade --name "GNU Nano" --Id "GNU.Nano" --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
15
|
+
winget install --no-upgrade --Id CoreyButler.NVMforWindows --source winget --scope user --accept-package-agreements --accept-source-agreements
|
|
15
16
|
Install-Module -Name Terminal-Icons -Repository PSGallery -Force -AcceptLicense -PassThru -Confirm # -RequiredVersion 2.5.10
|
|
16
17
|
Install-Module -Name PSFzf -SkipPublisherCheck # -AcceptLicense -PassThru -Confirm # -RequiredVersion 2.5.10
|
|
17
18
|
|
|
@@ -9,12 +9,12 @@ if (!$pubkey_string) {
|
|
|
9
9
|
Write-Output "pubkey_string is already defined."
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
cd ~
|
|
13
|
-
echo $null >> .ssh/authorized_keys # powershell way of touching a file if it doesn't exist
|
|
14
|
-
echo $pubkey_string >> .ssh/authorized_keys
|
|
15
|
-
echo $pubkey_string > .ssh/pubkey.pub
|
|
16
|
-
Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh-server_add-sshkey.ps1 | Invoke-Expression
|
|
17
12
|
|
|
13
|
+
echo $null >> $HOME/.ssh/authorized_keys # powershell way of touching a file if it doesn't exist
|
|
14
|
+
echo $pubkey_string >> $HOME/.ssh/authorized_keys
|
|
15
|
+
echo $pubkey_string > $HOME/.ssh/pubkey.pub
|
|
16
|
+
|
|
17
|
+
Invoke-WebRequest https://raw.githubusercontent.com/thisismygitrepo/machineconfig/main/src/machineconfig/setup_windows/openssh-server_add-sshkey.ps1 | Invoke-Expression
|
|
18
18
|
ipconfig.exe
|
|
19
19
|
|
|
20
20
|
echo "Done"
|
|
@@ -9,5 +9,5 @@ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thisismygitrepo/machin
|
|
|
9
9
|
.\ve.ps1
|
|
10
10
|
rm ve.ps1
|
|
11
11
|
|
|
12
|
-
uv run --python 3.13 --with machineconfig devops interactive
|
|
12
|
+
uv run --python 3.13 --with machineconfig devops self interactive
|
|
13
13
|
# uv run --python 3.13 --with machineconfig https://raw.githubusercontent.com/thisismygitrepo/machineconfig/ee4f69e838e1acbb275bfb5a3d3faee23345f2a8/src/machineconfig/scripts/python/devops.py
|
machineconfig/utils/code.py
CHANGED
|
@@ -98,7 +98,7 @@ def print_code(code: str, lexer: str, desc: str, subtitle: str = ""):
|
|
|
98
98
|
console.print(Panel(Syntax(code=code, lexer=lexer), title=f"📄 {desc}", subtitle=subtitle), style="bold red")
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
def run_shell_script(program: str):
|
|
101
|
+
def run_shell_script(program: str, display_script: bool = True):
|
|
102
102
|
import tempfile
|
|
103
103
|
if platform.system() == "Windows":
|
|
104
104
|
suffix = ".ps1"
|
|
@@ -110,16 +110,19 @@ def run_shell_script(program: str):
|
|
|
110
110
|
temp_file.write(program)
|
|
111
111
|
temp_script_path = PathExtended(temp_file.name)
|
|
112
112
|
console = Console()
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
if display_script:
|
|
114
|
+
from rich.syntax import Syntax
|
|
115
|
+
console.print(Panel(Syntax(code=program, lexer=lexer), title=f"📄 shell script @ {temp_script_path}", subtitle="shell script being executed"), style="bold red")
|
|
116
|
+
|
|
116
117
|
if platform.system() == "Windows":
|
|
117
118
|
import subprocess
|
|
118
119
|
subprocess.run(f'powershell -ExecutionPolicy Bypass -File "{temp_script_path}"', check=True, shell=True)
|
|
119
120
|
elif platform.system() == "Linux" or platform.system() == "Darwin":
|
|
120
121
|
import subprocess
|
|
121
122
|
subprocess.run(f"bash {str(temp_script_path)}", check=True, shell=True)
|
|
123
|
+
|
|
122
124
|
temp_script_path.unlink(missing_ok=True)
|
|
125
|
+
|
|
123
126
|
# def run_command(command: str, description: str) -> bool:
|
|
124
127
|
# """Execute a shell command and return success status."""
|
|
125
128
|
# console.print(f"\n🔧 {description}", style="bold cyan")
|