feat: Add workspace container with claude auto-start
- Create cfg/claude.service for systemd auto-start of Claude Code - Enable claude.service on container boot - Update install.sh to automatically create workspace container - Update aios.zsh to start workspace and connect when shell:true - Add machinectl to sudoers NOPASSWD for ai user - Workspace container starts on login, claude.service auto-runs inside
This commit is contained in:
18
cfg/aios.zsh
18
cfg/aios.zsh
@@ -18,11 +18,21 @@ SHELL_MODE=$(cat "$CONFIG_FILE" | jq -r '.shell // false')
|
||||
|
||||
if [ "$SHELL_MODE" = "true" ]; then
|
||||
echo "aios - AI-managed OS"
|
||||
echo " Shell mode enabled"
|
||||
echo " Starting workspace container..."
|
||||
echo ""
|
||||
|
||||
# claudeを起動
|
||||
if command -v claude &>/dev/null; then
|
||||
exec claude
|
||||
# Check if workspace exists
|
||||
if ! sudo machinectl list-images | grep -q "^workspace"; then
|
||||
echo "Error: workspace container not found"
|
||||
echo "Please run install.sh first to create workspace container"
|
||||
return
|
||||
fi
|
||||
|
||||
# Start workspace container
|
||||
sudo machinectl start workspace 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
# Login to workspace (claude.service will auto-start inside)
|
||||
echo "Connecting to workspace container..."
|
||||
exec sudo machinectl login workspace
|
||||
fi
|
||||
|
||||
15
cfg/claude.service
Normal file
15
cfg/claude.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Claude Code AI Assistant
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ai
|
||||
WorkingDirectory=/home/ai
|
||||
Environment=HOME=/home/ai
|
||||
ExecStart=/usr/bin/claude
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -58,6 +58,10 @@ systemctl enable --now systemd-machined
|
||||
echo "5. Creating initial backup image..."
|
||||
machinectl clone $NAME $BACKUP
|
||||
|
||||
# Create workspace container for AI operations
|
||||
echo "6. Creating workspace container..."
|
||||
machinectl clone $NAME workspace
|
||||
|
||||
echo ""
|
||||
echo "=== Installation complete ==="
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user