-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_gui_simple_arm.bash
More file actions
executable file
·105 lines (88 loc) · 3.05 KB
/
run_gui_simple_arm.bash
File metadata and controls
executable file
·105 lines (88 loc) · 3.05 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
#!/bin/bash
# REDLINE Simple GUI Runner for ARM64 macOS
# This script tries to get the GUI working with proper X11 setup
echo "========================================"
echo "REDLINE ARM64 GUI - Simple Approach"
echo "========================================"
# Copy Stooq files from Downloads to data directory
echo "Checking for Stooq files in Downloads..."
DOWNLOADS_DIR="$HOME/Downloads"
DATA_DIR="$(pwd)/data"
STOOQ_DIR="$DATA_DIR/stooq_import"
# Create stooq_import directory if it doesn't exist
mkdir -p "$STOOQ_DIR"
# Check for and copy TXT files
if ls "$DOWNLOADS_DIR"/*.txt 1> /dev/null 2>&1; then
echo "Found TXT files. Copying..."
cp "$DOWNLOADS_DIR"/*.txt "$STOOQ_DIR/"
TXT_COUNT=$(ls "$STOOQ_DIR"/*.txt 2>/dev/null | wc -l)
echo "✓ Copied $TXT_COUNT TXT files to $STOOQ_DIR"
fi
# Check for and extract ZIP files
if ls "$DOWNLOADS_DIR"/*.zip 1> /dev/null 2>&1; then
echo "Found ZIP files. Extracting..."
for zipfile in "$DOWNLOADS_DIR"/*.zip; do
echo "Extracting: $(basename "$zipfile")"
unzip -o "$zipfile" -d "$STOOQ_DIR/"
done
echo "✓ ZIP files extracted to $STOOQ_DIR"
fi
# Count total Stooq files ready for processing
TOTAL_FILES=$(find "$STOOQ_DIR" -type f -name "*.txt" 2>/dev/null | wc -l)
if [ "$TOTAL_FILES" -gt 0 ]; then
echo "✓ Total Stooq TXT files ready: $TOTAL_FILES"
else
echo "ℹ No Stooq files found in Downloads"
fi
echo "========================================"
# Set up X11 forwarding
echo "Setting up X11 forwarding..."
export DISPLAY=:1
echo "DISPLAY set to: $DISPLAY"
# Allow X11 connections
echo "Allowing X11 connections..."
xhost +local: 2>/dev/null || echo "Warning: xhost +local: failed"
xhost +localhost 2>/dev/null || echo "Warning: xhost +localhost failed"
# Test X11 connection first
echo "Testing X11 connection..."
docker run --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v $HOME/.Xauthority:/root/.Xauthority:ro \
redline_arm python3 -c "
import tkinter as tk
try:
root = tk.Tk()
root.title('X11 Test')
root.geometry('300x200')
label = tk.Label(root, text='X11 is working!')
label.pack(pady=50)
root.after(2000, root.quit)
root.mainloop()
print('X11 test successful!')
except Exception as e:
print(f'X11 test failed: {e}')
"
if [ $? -eq 0 ]; then
echo "✅ X11 test successful! Starting REDLINE GUI..."
# Run REDLINE with GUI
docker run --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v $HOME/.Xauthority:/root/.Xauthority:ro \
-v $(pwd):/app \
-v $(pwd)/data:/app/data \
redline_arm python3 /app/data_module.py
else
echo "❌ X11 test failed. Trying alternative approach..."
# Try with host.docker.internal
export DISPLAY=host.docker.internal:0
echo "Trying DISPLAY=host.docker.internal:0"
docker run --rm \
-e DISPLAY=$DISPLAY \
-v $(pwd):/app \
-v $(pwd)/data:/app/data \
redline_arm python3 /app/data_module.py
fi
echo "========================================"
echo "REDLINE session completed"