feat: Implement aios core concept - start from container with claude

Implemented the 3 core requirements:
1. Auto-login as ai user (already done)
2. ai user automatically starts workspace container on login
3. Container root automatically starts claude with MCP

Flow:
aios boot → ai user auto-login → workspace starts → enter workspace as root → claude auto-starts

Changes:
- ai user .zshrc: auto-start workspace and exec into it
- root .zshrc: auto-start claude with MCP
- Moved user-continer.sh to after setup-claude.sh to include all configs
This commit is contained in:
Claude
2025-11-07 16:35:01 +00:00
parent 1ca53c489c
commit 5264e9866c
3 changed files with 35 additions and 21 deletions

View File

@@ -79,26 +79,26 @@ echo "✓ Arch Linux base complete"
echo "" echo ""
# ============================================ # ============================================
# 2. Create child containers (before user setup) # 2. User Setup
# ============================================
bash ./cfg/user-continer.sh
echo ""
# ============================================
# 3. User Setup
# ============================================ # ============================================
bash ./cfg/setup-user.sh bash ./cfg/setup-user.sh
echo "" echo ""
# ============================================ # ============================================
# 4. Claude & aigpt Setup # 3. Claude & aigpt Setup
# ============================================ # ============================================
bash ./cfg/setup-claude.sh bash ./cfg/setup-claude.sh
echo "" echo ""
# ============================================
# 4. Create child containers (after all configuration)
# ============================================
bash ./cfg/user-continer.sh
echo ""
# ============================================ # ============================================
# Finalize # Finalize
# ============================================ # ============================================

View File

@@ -45,4 +45,23 @@ sleep 2
arch-chroot $ROOTFS /bin/sh -c 'pkill aigpt' arch-chroot $ROOTFS /bin/sh -c 'pkill aigpt'
arch-chroot $ROOTFS /bin/sh -c 'if command -v sqlite3 &>/dev/null; then sqlite3 /root/.config/syui/ai/gpt/memory.db "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;"; fi' arch-chroot $ROOTFS /bin/sh -c 'if command -v sqlite3 &>/dev/null; then sqlite3 /root/.config/syui/ai/gpt/memory.db "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;"; fi'
# Add claude auto-start for root user (container concept)
echo "Configuring claude auto-start for root..."
cat >> $ROOTFS/root/.zshrc <<'EOF'
# MCP auto-setup (run once after .claude.json is created)
if [[ -f ~/.claude.json ]] && ! grep -q '"aigpt"' ~/.claude.json 2>/dev/null; then
if command -v claude &>/dev/null && command -v aigpt &>/dev/null; then
claude mcp add aigpt aigpt server &>/dev/null || true
fi
fi
# Auto-start claude in interactive login shell
if [[ -o login ]] && [[ -o interactive ]]; then
if command -v claude &>/dev/null; then
claude
fi
fi
EOF
echo "✓ Claude MCP setup complete" echo "✓ Claude MCP setup complete"

View File

@@ -46,21 +46,16 @@ cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc
# Copy .zshrc for user 'ai' # Copy .zshrc for user 'ai'
cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc
# Add MCP auto-setup and claude auto-start for ai user (login shell only) # Add auto container login for ai user
cat >> $ROOTFS/home/ai/.zshrc <<'EOF' cat >> $ROOTFS/home/ai/.zshrc <<'EOF'
# MCP auto-setup (run once after .claude.json is created) # Auto-start workspace container and login (aios concept: start from container)
if [[ -f ~/.claude.json ]] && ! grep -q '"aigpt"' ~/.claude.json 2>/dev/null; then
if command -v claude &>/dev/null && command -v aigpt &>/dev/null; then
claude mcp add aigpt aigpt server &>/dev/null || true
fi
fi
# Auto-start claude in interactive login shell
if [[ -o login ]] && [[ -o interactive ]]; then if [[ -o login ]] && [[ -o interactive ]]; then
if command -v claude &>/dev/null; then # Start workspace container
claude sudo machinectl start workspace 2>/dev/null || true
fi sleep 2
# Enter workspace container as root
exec sudo machinectl shell workspace
fi fi
EOF EOF