-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
121 lines (109 loc) · 4.65 KB
/
Copy pathinstall.sh
File metadata and controls
121 lines (109 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# install.sh — High-Fidelity Setup for crossforge v1.1.0 [HELLHOUND-class]
# Zero-dependency Python HUD for immediate animation start
python3 - << 'EOF'
import sys
import time
import math
import threading
import subprocess
import shutil
import os
# ------ CONFIGURATION & ASSETS ------
_BRAILLE_WAVE = ["⠁", "⠃", "⠇", "⡇", "⣇", "⣧", "⣷", "⣿", "⣾", "⣶", "⣦", "⣄", "⡄", "⠄", "⠀", "⠀"]
def get_terminal_width():
try:
return shutil.get_terminal_size().columns
except:
return 80
def case_wave_ansi(text, frame):
"""Simple ANSI-based case-wave effect."""
result = ""
for i, ch in enumerate(text):
if ch == " ":
result += " "
continue
val = math.sin(i * 0.45 + frame * 4.5)
if val > 0.7:
result += f"\033[1;31m{ch.upper()}\033[0m"
elif val > 0.3:
result += f"\033[31m{ch.upper()}\033[0m"
elif val > -0.1:
result += f"\033[31m{ch}\033[0m"
else:
result += f"\033[2;31m{ch.lower()}\033[0m"
return result
def draw_ui(text, stop_event):
"""Animates a single-line HUD using pure ANSI (Zero Dependencies)."""
n = len(_BRAILLE_WAVE)
sys.stdout.write("\033[?25l")
sys.stdout.flush()
try:
while not stop_event.is_set():
t = time.time()
tw = get_terminal_width()
txt = case_wave_ansi(text, t)
wave_width = (tw - len(text) - 10) // 2
if wave_width < 2:
sys.stdout.write(f"\r{txt}")
else:
left_chars = "".join(_BRAILLE_WAVE[int((i * 1.5 - t * 18)) % n] for i in range(wave_width))
right_chars = "".join(_BRAILLE_WAVE[int(((wave_width - i) * 1.5 + t * 18)) % n] for i in range(wave_width))
sys.stdout.write(f"\r\033[1;31m{left_chars}\033[0m {txt} \033[1;31m{right_chars}\033[0m")
sys.stdout.flush()
time.sleep(0.04)
finally:
sys.stdout.write("\r\033[K\033[?25h")
sys.stdout.flush()
def run_task(text, cmd, capture=True):
"""Runs a task with the immediate animation."""
stop_event = threading.Event()
t = threading.Thread(target=draw_ui, args=(text, stop_event), daemon=True)
t.start()
try:
if capture:
subprocess.run(cmd, shell=True, capture_output=True)
else:
subprocess.run(cmd, shell=True)
finally:
stop_event.set()
t.join()
def main():
if os.getuid() != 0:
print("[*] Authenticating sudo privileges (credentials will be cached)...")
try:
subprocess.run("sudo -v", shell=True, check=True)
except subprocess.CalledProcessError:
print("[-] Sudo validation failed. Exiting.")
sys.exit(1)
if not os.path.exists(".venv"):
run_task("INITIALIZING VIRTUAL ENVIRONMENT", "python3 -m venv .venv")
run_task("OPTIMIZING DEPENDENCIES", "./.venv/bin/pip install --upgrade pip rich PyYAML httpx[http2]")
# Optional features (headless browser crawl capabilities)
run_task("PROVISIONING RENDERING ENGINE", "./.venv/bin/pip install playwright")
run_task("INSTALLING BROWSER CORES", "./.venv/bin/python3 -m playwright install chromium")
run_task("PATCHING SYSTEM LIBS", "sudo ./.venv/bin/python3 -m playwright install-deps chromium")
run_task("FINALIZING SYSTEM SETUP", "./.venv/bin/pip install -e .")
# Deploy global CLI wrapper — write a real script to /usr/local/bin/crossforge
project_root = os.path.abspath(os.getcwd())
venv_python = os.path.join(project_root, ".venv", "bin", "python3")
entry_script = os.path.join(project_root, "crossforge_run.py")
wrapper = f'#!/bin/bash\nexec "{venv_python}" "{entry_script}" "$@"\n'
try:
# 1) Remove old symlink/file — critical to avoid writing into directory
subprocess.run(["sudo", "rm", "-f", "/usr/local/bin/crossforge"],
capture_output=True, check=True)
# 2) Write fresh wrapper script
subprocess.run(["sudo", "tee", "/usr/local/bin/crossforge"],
input=wrapper.encode(), capture_output=True, check=True)
# 3) Make executable
subprocess.run(["sudo", "chmod", "+x", "/usr/local/bin/crossforge"],
capture_output=True, check=True)
print("\r\033[K\033[1;32m[+]\033[0m Global command deployed: /usr/local/bin/crossforge")
except Exception as e:
print(f"\r\033[K\033[31m[-]\033[0m Failed to deploy global link: {e}")
print("\n\033[1;32m[+] CROSSFORGE DEPLOYED SUCCESSFULLY\033[0m")
print("\033[2mVERSION: 1.1.0-STABLE\033[0m\n")
if __name__ == "__main__":
main()
EOF