Skip to content

Commit 7bc1632

Browse files
committed
MiOSv0.2.0 - Dynamic Exhaustive Root Overlay
1 parent 996f6de commit 7bc1632

1 file changed

Lines changed: 53 additions & 24 deletions

File tree

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,76 @@
11
#!/bin/bash
22
set -e
33

4-
REPO_ROOT="/mios"
5-
SYSTEM_ROOT="/"
4+
# MiOS Day-0 Root Overlay: Aggressive FHS Symlink Merge
5+
# SSOT: The repository IS the system root.
66

7-
echo "🔄 Initializing MiOS COMPLETE System Root Overlay..."
7+
# 1. Detect Repository Root
8+
if [ -d "/mios/.git" ]; then
9+
REPO_ROOT="/mios"
10+
elif [ -d "/workspaces/MiOS/.git" ]; then
11+
REPO_ROOT="/workspaces/MiOS"
12+
else
13+
# Fallback to current dir if it looks like the repo
14+
if [ -d ".git" ] && [ -f "Justfile" ]; then
15+
REPO_ROOT=$(pwd)
16+
else
17+
echo "Error: MiOS Repository not found in /mios, /workspaces/MiOS, or current dir."
18+
exit 1
19+
fi
20+
fi
21+
22+
echo "🔄 Initializing MiOS COMPLETE System Root Overlay from $REPO_ROOT..."
823

9-
# 1. Mandatory Git Identity (The System Root IS the Git Repository)
10-
echo " [ROOT] Mapping /.git -> ${REPO_ROOT}/.git"
11-
ln -sf "${REPO_ROOT}/.git" "${SYSTEM_ROOT}.git"
24+
# 2. Establish Git Identity of / (/.git -> REPO/.git)
25+
ln -sf "${REPO_ROOT}/.git" "/.git"
1226

13-
# 2. Aggressive Global Merge
14-
# We include ALL files and directories from the repo root
27+
# 3. Exhaustive Global Merge
28+
# We use cp -as to recursively symlink the repository tree into /
29+
# shopt -s dotglob ensures hidden files are included
1530
shopt -s dotglob
1631
for item in "${REPO_ROOT}"/*; do
1732
[ -e "$item" ] || continue
1833
name=$(basename "$item")
1934

20-
# Avoid self-recursion and sensitive container mounts
35+
# Avoid recursion/system breakage
2136
case "$name" in
22-
.devcontainer|vscode|workspaces|proc|sys|dev|run|tmp|boot|mnt|root)
37+
.devcontainer|proc|sys|dev|run|tmp|boot|mnt|root|vscode|workspaces)
2338
continue
2439
;;
2540
esac
2641

27-
target="${SYSTEM_ROOT}${name}"
42+
target="/$name"
2843

2944
if [ -d "$item" ]; then
30-
# For FHS-standard directories, we merge the contents
31-
if [[ "$name" =~ ^(usr|etc|var|srv|home|v1|bin|lib|lib64|sbin)$ ]]; then
32-
echo " [MERGE] /$name"
33-
mkdir -p "$target"
34-
cp -as "${item}/"* "$target/" 2>/dev/null || true
35-
else
36-
# For project-specific directories (automation, tools, etc.), link them directly
37-
echo " [LINK] /$name"
38-
ln -sfn "$item" "$target"
39-
fi
45+
echo " [MERGE] /$name"
46+
mkdir -p "$target"
47+
# Recursively symlink contents
48+
cp -as "${item}/"* "$target/" 2>/dev/null || true
4049
else
41-
# For all root-level files (Justfile, Containerfile, VERSION, etc.)
4250
echo " [FILE] /$name"
43-
ln -sf "$item" "$target"
51+
ln -sf "$item" "$target" 2>/dev/null || true
4452
fi
4553
done
4654

47-
echo "✅ MiOS System Root Overlay: FULLY MERGED"
55+
# 4. Enforce Day-0 AI Surface
56+
mkdir -p /v1/chat
57+
cat <<EON > /v1/chat/completions
58+
# MiOS Unified Inference Schema
59+
{
60+
"spec": "POST /v1/chat/completions",
61+
"implementation": "Native system proxy",
62+
"status": "ready"
63+
}
64+
EON
65+
66+
mkdir -p /usr/share/mios/ai/v1
67+
cat <<EON > /usr/share/mios/ai/v1/models.json
68+
{
69+
"object": "list",
70+
"data": [],
71+
"documentation": "Native model discovery schema."
72+
}
73+
EON
74+
ln -sf /usr/share/mios/ai/v1/models.json /v1/models 2>/dev/null || true
75+
76+
echo "✅ MiOS System Root Overlay: FULLY SYNCHRONIZED"

0 commit comments

Comments
 (0)