diff --git a/build.zsh b/build.zsh index d555cd1..2442524 100755 --- a/build.zsh +++ b/build.zsh @@ -79,26 +79,26 @@ echo "✓ Arch Linux base complete" echo "" # ============================================ -# 2. Create child containers (before user setup) -# ============================================ - -bash ./cfg/user-continer.sh -echo "" - -# ============================================ -# 3. User Setup +# 2. User Setup # ============================================ bash ./cfg/setup-user.sh echo "" # ============================================ -# 4. Claude & aigpt Setup +# 3. Claude & aigpt Setup # ============================================ bash ./cfg/setup-claude.sh echo "" +# ============================================ +# 4. Create child containers (after all configuration) +# ============================================ + +bash ./cfg/user-continer.sh +echo "" + # ============================================ # Finalize # ============================================ diff --git a/cfg/setup-claude.sh b/cfg/setup-claude.sh index a0a2981..20c4367 100755 --- a/cfg/setup-claude.sh +++ b/cfg/setup-claude.sh @@ -45,4 +45,23 @@ sleep 2 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' +# 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" diff --git a/cfg/setup-user.sh b/cfg/setup-user.sh index d2c0d7d..35c9397 100755 --- a/cfg/setup-user.sh +++ b/cfg/setup-user.sh @@ -46,21 +46,16 @@ cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc # Copy .zshrc for user 'ai' 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' -# 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 +# Auto-start workspace container and login (aios concept: start from container) if [[ -o login ]] && [[ -o interactive ]]; then - if command -v claude &>/dev/null; then - claude - fi + # Start workspace container + sudo machinectl start workspace 2>/dev/null || true + sleep 2 + # Enter workspace container as root + exec sudo machinectl shell workspace fi EOF