-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·51 lines (42 loc) · 2.31 KB
/
install.sh
File metadata and controls
executable file
·51 lines (42 loc) · 2.31 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
#!/bin/bash
# LinuxMissions installer
set -euo pipefail
cd "$(dirname "$0")"
echo ""
echo " LinuxMissions — Installer"
echo " ─────────────────────────"
echo ""
# ─── Python check ──────────────────────────────────────────────────────────────
if ! command -v python3 &>/dev/null; then
echo "❌ Python 3 is required."
echo " Ubuntu/Debian: sudo apt install python3 python3-venv"
echo " macOS: brew install python3"
exit 1
fi
PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
echo "✅ Python $PY_VERSION found"
# ─── venv ──────────────────────────────────────────────────────────────────────
if [ ! -d "venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv venv
fi
echo "📦 Installing Python dependencies..."
venv/bin/pip install --upgrade pip -q
venv/bin/pip install -r requirements.txt -q
echo "✅ Dependencies installed"
# ─── Generate levels.json ──────────────────────────────────────────────────────
echo "⚙️ Generating levels.json..."
venv/bin/python3 scripts/generate_levels.py
# ─── Initial progress.json ─────────────────────────────────────────────────────
if [ ! -f "progress.json" ]; then
echo '{"player_name":"","total_xp":0,"completed_levels":[],"current_module":"","current_level":"","module_certificates":[],"time_per_level":{},"level_start_time":null}' > progress.json
echo "✅ progress.json initialized"
fi
# ─── Make scripts executable ───────────────────────────────────────────────────
chmod +x play.sh
find modules -name "*.sh" -exec chmod +x {} \;
echo "✅ Scripts made executable"
echo ""
echo " ✅ Installation complete!"
echo " Run: ./play.sh"
echo ""