refactor: Create child containers during build as root, not at ai user login

- Renamed init-containers.sh to user-continer.sh
- Moved container creation from ai user first login to build.zsh
- Removed initialization check from ai user .zshrc
- Child containers (workspace, restore-img) now pre-created by root
- ai user simply uses pre-existing containers
This commit is contained in:
Claude
2025-11-07 15:21:14 +00:00
parent e2b0d7a51d
commit 642ccb28a6
4 changed files with 41 additions and 63 deletions

View File

@@ -46,21 +46,9 @@ cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc
# Copy .zshrc for user 'ai'
cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc
# Copy container initialization script
cp -rf ./cfg/init-containers.sh $ROOTFS/usr/local/bin/init-containers.sh
arch-chroot $ROOTFS /bin/sh -c 'chmod +x /usr/local/bin/init-containers.sh'
# Add initialization, MCP auto-setup and claude auto-start for ai user (login shell only)
# Add MCP auto-setup and claude auto-start for ai user (login shell only)
cat >> $ROOTFS/home/ai/.zshrc <<'EOF'
# Initialize workspace containers on first login
if [ ! -f ~/.aios-initialized ]; then
echo "First login detected. Initializing workspace containers..."
if command -v sudo &>/dev/null && [ -x /usr/local/bin/init-containers.sh ]; then
/usr/local/bin/init-containers.sh && touch ~/.aios-initialized
fi
fi
# 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