From 642ccb28a6a4a88442f00cb6e13a94c5f79e7921 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 15:21:14 +0000 Subject: [PATCH 1/8] 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 --- build.zsh | 7 +++---- cfg/init-containers.sh | 46 ------------------------------------------ cfg/setup-user.sh | 14 +------------ cfg/user-continer.sh | 37 +++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 63 deletions(-) delete mode 100644 cfg/init-containers.sh create mode 100644 cfg/user-continer.sh diff --git a/build.zsh b/build.zsh index f98598c..365a4bc 100755 --- a/build.zsh +++ b/build.zsh @@ -101,15 +101,14 @@ echo "=== Finalizing ===" # Copy aios-ctl.zsh for host machine control cp -rf ./cfg/aios-ctl.zsh root.x86_64/var/lib/machines/aios/opt/aios-ctl.zsh -# Prepare directory for child containers (ai user will create them as needed) -echo "Preparing directory for child containers..." -mkdir -p root.x86_64/var/lib/machines/aios/var/lib/machines +# Create child containers (workspace, restore-img) +bash ./cfg/user-continer.sh # Copy install script cp -rf ./cfg/install.sh ./install.sh chmod +x ./install.sh -# Create tarball with aios (ready for child containers) +# Create tarball with aios (includes child containers) echo "Creating tarball..." tar -zcvf aios-bootstrap.tar.gz root.x86_64/ install.sh diff --git a/cfg/init-containers.sh b/cfg/init-containers.sh deleted file mode 100644 index 8a8dac8..0000000 --- a/cfg/init-containers.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Initialize child containers for ai user -# This script runs once on first login - -echo "=== Initializing workspace containers ===" -echo "This may take a few minutes..." - -# Create workspace directory -mkdir -p /tmp/workspace-init - -# Create base workspace -echo "Creating workspace container..." -sudo pacstrap -c /tmp/workspace-init base - -# Configure workspace -sudo arch-chroot /tmp/workspace-init /bin/sh -c 'pacman -Syu --noconfirm vim git zsh openssh nodejs npm sqlite' - -# Add securetty for pts login -sudo bash -c 'cat >> /tmp/workspace-init/etc/securetty <> $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 diff --git a/cfg/user-continer.sh b/cfg/user-continer.sh new file mode 100644 index 0000000..4ed44bb --- /dev/null +++ b/cfg/user-continer.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Create child containers inside aios for ai user +# This script runs during build.zsh as root + +ROOTFS="root.x86_64/var/lib/machines/aios" + +echo "=== Creating child containers ===" + +# Create workspace container +echo "Creating workspace container..." +mkdir -p /tmp/workspace-build +pacstrap -c /tmp/workspace-build base + +# Configure workspace +arch-chroot /tmp/workspace-build /bin/sh -c 'pacman -Syu --noconfirm vim git zsh openssh nodejs npm sqlite' + +# Add securetty for pts login +cat >> /tmp/workspace-build/etc/securetty <<'EOF' +pts/0 +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +EOF + +# Move to aios +mkdir -p $ROOTFS/var/lib/machines +mv /tmp/workspace-build $ROOTFS/var/lib/machines/workspace + +# Create restore-img as clean backup +echo "Creating restore-img (backup)..." +cp -a $ROOTFS/var/lib/machines/workspace $ROOTFS/var/lib/machines/restore-img + +echo "✓ Child containers created" +echo " - workspace" +echo " - restore-img" From fd25a50395db27ab5ae389e7129089ed48858a56 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 15:25:01 +0000 Subject: [PATCH 2/8] refactor: Simplify child container creation by copying aios itself Changed from building new containers to simply copying the aios base: - Backup current aios to /tmp - Copy backup as workspace - Copy backup as restore-img - Much faster and simpler than pacstrap - Child containers have same config as parent aios --- cfg/user-continer.sh | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/cfg/user-continer.sh b/cfg/user-continer.sh index 4ed44bb..163eb1f 100644 --- a/cfg/user-continer.sh +++ b/cfg/user-continer.sh @@ -1,37 +1,29 @@ #!/bin/bash # Create child containers inside aios for ai user -# This script runs during build.zsh as root +# Simply copy the aios itself as child containers ROOTFS="root.x86_64/var/lib/machines/aios" echo "=== Creating child containers ===" -# Create workspace container -echo "Creating workspace container..." -mkdir -p /tmp/workspace-build -pacstrap -c /tmp/workspace-build base +# Backup current aios to temp location +echo "Backing up aios..." +cp -a $ROOTFS /tmp/aios-backup-$$ -# Configure workspace -arch-chroot /tmp/workspace-build /bin/sh -c 'pacman -Syu --noconfirm vim git zsh openssh nodejs npm sqlite' - -# Add securetty for pts login -cat >> /tmp/workspace-build/etc/securetty <<'EOF' -pts/0 -pts/1 -pts/2 -pts/3 -pts/4 -pts/5 -EOF - -# Move to aios +# Create directory for child containers mkdir -p $ROOTFS/var/lib/machines -mv /tmp/workspace-build $ROOTFS/var/lib/machines/workspace -# Create restore-img as clean backup -echo "Creating restore-img (backup)..." -cp -a $ROOTFS/var/lib/machines/workspace $ROOTFS/var/lib/machines/restore-img +# Copy backup as workspace +echo "Creating workspace container (copy of aios)..." +cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/workspace + +# Copy backup as restore-img (clean backup) +echo "Creating restore-img container (copy of aios)..." +cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/restore-img + +# Cleanup temp backup +rm -rf /tmp/aios-backup-$$ echo "✓ Child containers created" -echo " - workspace" -echo " - restore-img" +echo " - workspace (copy of aios)" +echo " - restore-img (copy of aios)" From d1c3ab94cb269baa719da52f42beb60bbc6ae3e8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 15:30:17 +0000 Subject: [PATCH 3/8] refactor: Remove unnecessary backup step in container creation Simplified user-continer.sh by removing temp backup. Directly copy aios to workspace and restore-img. --- cfg/user-continer.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/cfg/user-continer.sh b/cfg/user-continer.sh index 163eb1f..6353958 100644 --- a/cfg/user-continer.sh +++ b/cfg/user-continer.sh @@ -6,24 +6,15 @@ ROOTFS="root.x86_64/var/lib/machines/aios" echo "=== Creating child containers ===" -# Backup current aios to temp location -echo "Backing up aios..." -cp -a $ROOTFS /tmp/aios-backup-$$ - # Create directory for child containers mkdir -p $ROOTFS/var/lib/machines -# Copy backup as workspace -echo "Creating workspace container (copy of aios)..." -cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/workspace +# Copy aios as workspace +echo "Creating workspace container..." +cp -a $ROOTFS $ROOTFS/var/lib/machines/workspace -# Copy backup as restore-img (clean backup) -echo "Creating restore-img container (copy of aios)..." -cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/restore-img - -# Cleanup temp backup -rm -rf /tmp/aios-backup-$$ +# Copy aios as restore-img +echo "Creating restore-img container..." +cp -a $ROOTFS $ROOTFS/var/lib/machines/restore-img echo "✓ Child containers created" -echo " - workspace (copy of aios)" -echo " - restore-img (copy of aios)" From 1ca53c489c9e50f549f0ed40db0ddbc44b13a42a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 15:32:45 +0000 Subject: [PATCH 4/8] fix: Create child containers before user setup Moved user-continer.sh execution before setup-user.sh. Child containers are created by root for root to use, not for ai user. --- build.zsh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build.zsh b/build.zsh index 365a4bc..d555cd1 100755 --- a/build.zsh +++ b/build.zsh @@ -79,14 +79,21 @@ echo "✓ Arch Linux base complete" echo "" # ============================================ -# 2. User Setup +# 2. Create child containers (before user setup) +# ============================================ + +bash ./cfg/user-continer.sh +echo "" + +# ============================================ +# 3. User Setup # ============================================ bash ./cfg/setup-user.sh echo "" # ============================================ -# 3. Claude & aigpt Setup +# 4. Claude & aigpt Setup # ============================================ bash ./cfg/setup-claude.sh @@ -101,9 +108,6 @@ echo "=== Finalizing ===" # Copy aios-ctl.zsh for host machine control cp -rf ./cfg/aios-ctl.zsh root.x86_64/var/lib/machines/aios/opt/aios-ctl.zsh -# Create child containers (workspace, restore-img) -bash ./cfg/user-continer.sh - # Copy install script cp -rf ./cfg/install.sh ./install.sh chmod +x ./install.sh From 5264e9866cd8d214f96e1e4cd4972ac9c6456add Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 16:35:01 +0000 Subject: [PATCH 5/8] feat: Implement aios core concept - start from container with claude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- build.zsh | 18 +++++++++--------- cfg/setup-claude.sh | 19 +++++++++++++++++++ cfg/setup-user.sh | 19 +++++++------------ 3 files changed, 35 insertions(+), 21 deletions(-) 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 From 100471646eb57fb7c2ef6ceb06438ac643e64c5c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 16:40:54 +0000 Subject: [PATCH 6/8] fix: Share claude config/memory between ai user and container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ai user now uses workspace container's claude via wrapper function. This ensures ai user and container root share the same: - claude configuration - MCP settings - conversation history/memory Flow: 1. ai user login → workspace starts 2. ai user runs 'claude' → calls workspace container's claude 3. Container root runs 'claude' → same claude instance 4. Configuration and memory are shared --- cfg/setup-user.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cfg/setup-user.sh b/cfg/setup-user.sh index 35c9397..6834b69 100755 --- a/cfg/setup-user.sh +++ b/cfg/setup-user.sh @@ -46,16 +46,24 @@ cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc # Copy .zshrc for user 'ai' cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc -# Add auto container login for ai user +# Add workspace container setup and claude wrapper for ai user cat >> $ROOTFS/home/ai/.zshrc <<'EOF' -# Auto-start workspace container and login (aios concept: start from container) -if [[ -o login ]] && [[ -o interactive ]]; then - # Start workspace container +# Start workspace container on login +if [[ -o login ]]; then sudo machinectl start workspace 2>/dev/null || true - sleep 2 - # Enter workspace container as root - exec sudo machinectl shell workspace +fi + +# Claude wrapper - always use container's claude (shared config/memory) +claude() { + sudo machinectl shell workspace /bin/sh -c "claude $*" +} + +# Auto-start claude in interactive login shell +if [[ -o login ]] && [[ -o interactive ]]; then + if command -v claude &>/dev/null; then + claude + fi fi EOF From b41052b9a81d830230b3f5923542e490ee5df0c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 16:45:12 +0000 Subject: [PATCH 7/8] feat: Implement user-dir sharing between ai user and workspace root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perfect solution for aios concept: - workspace.nspawn: Bind=/home/ai:/root - ai user and workspace root share the SAME home directory - Same .zshrc, .claude.json, .config, all data/settings/history - INSIDE_WORKSPACE env var prevents infinite loop - Flow: ai login → enter workspace → claude starts - All configuration and memory perfectly shared --- cfg/setup-claude.sh | 19 +------------------ cfg/setup-user.sh | 46 +++++++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/cfg/setup-claude.sh b/cfg/setup-claude.sh index 20c4367..2323b77 100755 --- a/cfg/setup-claude.sh +++ b/cfg/setup-claude.sh @@ -45,23 +45,6 @@ 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 +# Note: claude auto-start is configured in ai user's .zshrc (shared with workspace root via bind mount) echo "✓ Claude MCP setup complete" diff --git a/cfg/setup-user.sh b/cfg/setup-user.sh index 6834b69..d4dcd38 100755 --- a/cfg/setup-user.sh +++ b/cfg/setup-user.sh @@ -30,6 +30,22 @@ EOF echo "Enabling systemd-machined..." arch-chroot $ROOTFS /bin/sh -c 'systemctl enable systemd-machined' +# Create workspace container configuration (bind ai user dir to container root) +echo "Creating workspace container configuration..." +mkdir -p $ROOTFS/etc/systemd/nspawn +cat > $ROOTFS/etc/systemd/nspawn/workspace.nspawn <<'EOF' +[Exec] +Boot=yes +PrivateUsers=pick +ResolvConf=copy-host + +[Files] +Bind=/home/ai:/root + +[Network] +VirtualEthernet=no +EOF + # Setup auto-login for user 'ai' echo "Setting up auto-login..." arch-chroot $ROOTFS /bin/sh -c 'mkdir -p /etc/systemd/system/getty@tty1.service.d' @@ -46,23 +62,29 @@ cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc # Copy .zshrc for user 'ai' cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc -# Add workspace container setup and claude wrapper for ai user +# Add workspace container auto-start and entry (shared .zshrc for ai user and workspace root) cat >> $ROOTFS/home/ai/.zshrc <<'EOF' -# Start workspace container on login -if [[ -o login ]]; then - sudo machinectl start workspace 2>/dev/null || true +# 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 -# Claude wrapper - always use container's claude (shared config/memory) -claude() { - sudo machinectl shell workspace /bin/sh -c "claude $*" -} - -# Auto-start claude in interactive login shell +# aios concept: container from start (ai user and workspace root share this .zshrc) if [[ -o login ]] && [[ -o interactive ]]; then - if command -v claude &>/dev/null; then - claude + if [[ -z "$INSIDE_WORKSPACE" ]]; then + # Running as ai user on aios OS - enter workspace container + export INSIDE_WORKSPACE=1 + sudo machinectl start workspace 2>/dev/null || true + sleep 1 + exec sudo machinectl shell workspace + else + # Running as root inside workspace container - start claude + if command -v claude &>/dev/null; then + claude + fi fi fi EOF From 4352a7d0e3b8a32760225a217ccd3830e6d494af Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 16:55:36 +0000 Subject: [PATCH 8/8] fix: Correct OS structure - root.x86_64 is OS root, not machines/aios Fixed the fundamental issue: - root.x86_64/ = aios OS (entire filesystem) - root.x86_64/var/lib/machines/ = child containers directory Changes: - build.zsh: Use root.x86_64 directly as OS root - setup-user.sh: ROOTFS=root.x86_64 - setup-claude.sh: ROOTFS=root.x86_64 - user-continer.sh: ROOTFS=root.x86_64 - install.sh: mv root.x86_64 /var/lib/machines/aios Now matches github-actions structure correctly. --- ! | 1 + build.zsh | 32 ++++++++++++++++---------------- cfg/install.sh | 2 +- cfg/setup-claude.sh | 2 +- cfg/setup-user.sh | 2 +- cfg/user-continer.sh | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 ! diff --git a/! b/! new file mode 100644 index 0000000..8855f64 --- /dev/null +++ b/! @@ -0,0 +1 @@ +#!/bin/zsh /build.zsh diff --git a/build.zsh b/build.zsh index 2442524..5df4fc0 100755 --- a/build.zsh +++ b/build.zsh @@ -35,45 +35,45 @@ cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso # Extract and prepare tar xf aios-bootstrap*.tar.gz -mkdir -p root.x86_64/var/lib/machines/aios -pacstrap -c root.x86_64/var/lib/machines/aios base +mkdir -p root.x86_64 +pacstrap -c root.x86_64 base # Configure pacman echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch -Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/var/lib/machines/aios/etc/pacman.d/mirrorlist -sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/var/lib/machines/aios/etc/pacman.conf +Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist +sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf # Initialize pacman keys -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'pacman-key --init' -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'pacman-key --populate archlinux' +arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' +arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' # Install base packages (including systemd-container for machinectl) -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs npm docker podman bc sqlite systemd arch-install-scripts' +arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs npm docker podman bc sqlite systemd arch-install-scripts' # Configure containers -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d' -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'curl -sL -o /etc/containers/registries.conf.d/ai.conf https://git.syui.ai/ai/os/raw/branch/main/cfg/ai.conf' +arch-chroot root.x86_64 /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d' +arch-chroot root.x86_64 /bin/sh -c 'curl -sL -o /etc/containers/registries.conf.d/ai.conf https://git.syui.ai/ai/os/raw/branch/main/cfg/ai.conf' # Set default shell -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'chsh -s /bin/zsh' +arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh' # Install Claude Code -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'npm i -g @anthropic-ai/claude-code' +arch-chroot root.x86_64 /bin/sh -c 'npm i -g @anthropic-ai/claude-code' # Copy os-release -cp -rf ./cfg/os-release root.x86_64/var/lib/machines/aios/etc/os-release +cp -rf ./cfg/os-release root.x86_64/etc/os-release # Configure sudoers for wheel group echo "Configuring sudoers..." -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman, /usr/bin/pacstrap, /usr/bin/arch-chroot, /usr/bin/rm, /usr/bin/mkdir, /usr/bin/mv, /usr/bin/cp, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl, /bin/bash" >> /etc/sudoers' +arch-chroot root.x86_64 /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman, /usr/bin/pacstrap, /usr/bin/arch-chroot, /usr/bin/rm, /usr/bin/mkdir, /usr/bin/mv, /usr/bin/cp, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl, /bin/bash" >> /etc/sudoers' # Install aigpt (aios core package) echo "Installing aigpt..." -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/' +arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/' # Install aibot (aios core package) echo "Installing aibot..." -arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/aibot /bin/ && aibot ai' +arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/aibot /bin/ && aibot ai' echo "✓ Arch Linux base complete" echo "" @@ -106,7 +106,7 @@ echo "" echo "=== Finalizing ===" # Copy aios-ctl.zsh for host machine control -cp -rf ./cfg/aios-ctl.zsh root.x86_64/var/lib/machines/aios/opt/aios-ctl.zsh +cp -rf ./cfg/aios-ctl.zsh root.x86_64/opt/aios-ctl.zsh # Copy install script cp -rf ./cfg/install.sh ./install.sh diff --git a/cfg/install.sh b/cfg/install.sh index b14230b..a0c980b 100644 --- a/cfg/install.sh +++ b/cfg/install.sh @@ -9,7 +9,7 @@ echo "=== aios installation ===" # Extract and install tar xf "$TARBALL" mkdir -p /var/lib/machines -mv root.x86_64/var/lib/machines/aios /var/lib/machines/$NAME +mv root.x86_64 /var/lib/machines/$NAME echo "=== Installation complete ===" echo "" diff --git a/cfg/setup-claude.sh b/cfg/setup-claude.sh index 2323b77..e6ae470 100755 --- a/cfg/setup-claude.sh +++ b/cfg/setup-claude.sh @@ -2,7 +2,7 @@ # Claude Code MCP setup for aios # Configures MCP, sets up shared memory -ROOTFS="root.x86_64/var/lib/machines/aios" +ROOTFS="root.x86_64" echo "=== Claude MCP Setup ===" diff --git a/cfg/setup-user.sh b/cfg/setup-user.sh index d4dcd38..5b5d014 100755 --- a/cfg/setup-user.sh +++ b/cfg/setup-user.sh @@ -2,7 +2,7 @@ # User setup for aios # Creates ai user, configures auto-login, sudo, zshrc -ROOTFS="root.x86_64/var/lib/machines/aios" +ROOTFS="root.x86_64" echo "=== User Setup ===" diff --git a/cfg/user-continer.sh b/cfg/user-continer.sh index 6353958..e28245f 100644 --- a/cfg/user-continer.sh +++ b/cfg/user-continer.sh @@ -2,7 +2,7 @@ # Create child containers inside aios for ai user # Simply copy the aios itself as child containers -ROOTFS="root.x86_64/var/lib/machines/aios" +ROOTFS="root.x86_64" echo "=== Creating child containers ==="