Compare commits
1 Commits
main
...
ae73a16b66
| Author | SHA1 | Date | |
|---|---|---|---|
|
ae73a16b66
|
@@ -1,6 +0,0 @@
|
|||||||
# https://github.com/containers/shortnames
|
|
||||||
# ~/.config/containers/registries.conf.d/ai.conf
|
|
||||||
unqualified-search-registries=["git.syui.ai", "docker.io", "ghcr.io"]
|
|
||||||
|
|
||||||
[aliases]
|
|
||||||
"aios"="git.syui.ai/ai/os"
|
|
||||||
@@ -2,8 +2,12 @@ name: build and push image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 12 * * *'
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '!README.md'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TAG: latest
|
TAG: latest
|
||||||
@@ -17,14 +21,33 @@ jobs:
|
|||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/syui/aios
|
image: syui/aios
|
||||||
options: --privileged
|
options: --privileged
|
||||||
steps:
|
steps:
|
||||||
- name: Initialize
|
- name: Initialize
|
||||||
run: |
|
run: |
|
||||||
pacman -Syuu --noconfirm base-devel archiso docker git curl
|
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
|
||||||
docker pull ghcr.io/syui/aios
|
git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||||
docker tag syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
|
||||||
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
|
||||||
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
|
||||||
|
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
|
||||||
|
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
|
||||||
|
tar xf aios-bootstrap*.tar.gz
|
||||||
|
mkdir -p root.x86_64/var/lib/machines/arch
|
||||||
|
pacstrap -c root.x86_64/var/lib/machines/arch base
|
||||||
|
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
|
||||||
|
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
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman'
|
||||||
|
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'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
|
||||||
|
tar -zcvf aios-bootstrap.tar.gz root.x86_64/
|
||||||
|
tar -C ./root.x86_64 -c . | docker import - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin
|
echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin
|
||||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
|
|
||||||
|
|||||||
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@@ -24,12 +24,29 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
- name: Initialize
|
||||||
- name: Build aios
|
|
||||||
run: bash ./build.zsh
|
|
||||||
|
|
||||||
- name: Create Docker images
|
|
||||||
run: |
|
run: |
|
||||||
|
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
|
||||||
|
git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||||
|
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
|
||||||
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
|
||||||
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
|
||||||
|
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
|
||||||
|
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
|
||||||
|
tar xf aios-bootstrap*.tar.gz
|
||||||
|
mkdir -p root.x86_64/var/lib/machines/arch
|
||||||
|
pacstrap -c root.x86_64/var/lib/machines/arch base
|
||||||
|
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
|
||||||
|
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
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman'
|
||||||
|
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'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
|
||||||
|
tar -zcvf aios-bootstrap.tar.gz root.x86_64/
|
||||||
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
|
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
|
||||||
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
|
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
|
||||||
docker push ${{ env.IMAGE_NAME }}
|
docker push ${{ env.IMAGE_NAME }}
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,9 +1,2 @@
|
|||||||
.config/ai
|
.config/ai
|
||||||
**.DS_Store
|
**.DS_Store
|
||||||
|
|
||||||
# Build artifacts
|
|
||||||
aios-bootstrap*.tar.gz
|
|
||||||
root.x86_64/
|
|
||||||
archiso/
|
|
||||||
install.sh
|
|
||||||
build.log
|
|
||||||
|
|||||||
217
README.md
217
README.md
@@ -1,188 +1,103 @@
|
|||||||
# <img src="./icon/ai.png" width="30"> ai `os`
|
# <img src="./icon/ai.png" width="30"> ai `os`
|
||||||
|
|
||||||
**aios** = ArchLinux + Claude Code + aigpt in systemd-nspawn
|
`aios` is a simple linux distribution based on `archlinux`.
|
||||||
|
|
||||||
A minimal ArchLinux environment optimized for Claude Code with shared AI memory.
|
|rule|var|
|
||||||
|
|---|---|
|
||||||
```
|
|name|ai os|
|
||||||
systemd-nspawn container
|
|code|aios|
|
||||||
├── Claude Code (AI interface)
|
|id|ai|
|
||||||
├── aigpt (shared memory)
|
|container|[git.syui.ai/ai/os](https://git.syui.ai/ai/-/packages/container/os/latest)|
|
||||||
└── zsh (.zshrc configured)
|
|image|[aios-bootstrap.tar.gz](https://github.com/syui/aios/releases/download/latest/aios-bootstrap.tar.gz)|
|
||||||
|
|
||||||
$ sudo machinectl shell aios
|
|
||||||
$ claude # Start Claude Code
|
|
||||||
```
|
|
||||||
|
|
||||||
## Philosophy
|
|
||||||
|
|
||||||
**Insert AI into existing flows**
|
|
||||||
|
|
||||||
Instead of building a new AI chat interface, use **Claude Code** (which already works).
|
|
||||||
|
|
||||||
aios provides:
|
|
||||||
1. Pre-installed **aigpt** (MCP server for shared memory)
|
|
||||||
2. Pre-installed **Claude Code** (`npm i -g @anthropic-ai/claude-code`)
|
|
||||||
3. Environment isolation with **systemd-nspawn**
|
|
||||||
4. Shared memory across containers
|
|
||||||
|
|
||||||
## What's Included
|
|
||||||
|
|
||||||
### 1. Claude Code
|
|
||||||
|
|
||||||
Pre-installed and ready to use:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ claude
|
$ docker run -it git.syui.ai/ai/os ai
|
||||||
# Claude Code starts, with MCP connection to aigpt
|
|
||||||
> Install rust development environment
|
|
||||||
✓ Installing rust, rust-analyzer, neovim
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. aigpt (Shared Memory)
|
## link
|
||||||
|
|
||||||
MCP server that provides persistent memory to Claude Code:
|
|host|command|url|
|
||||||
|
|---|---|---|
|
||||||
|
|docker|syui/aios|https://hub.docker.com/r/syui/aios|
|
||||||
|
|github|ghcr.io/syui/aios|https://github.com/users/syui/packages/container/package/aios|
|
||||||
|
|syui|git.syui.ai/ai/os|https://git.syui.ai/ai/-/packages/container/os|
|
||||||
|
|
||||||
```
|
## base
|
||||||
~/.config/syui/ai/gpt/memory.db (SQLite, WAL mode)
|
|
||||||
↓ bind mount
|
|
||||||
aios-dev, aios-prod, etc. (all share same DB)
|
|
||||||
```
|
|
||||||
|
|
||||||
AI remembers your preferences across all containers.
|
|
||||||
|
|
||||||
### 3. systemd-nspawn
|
|
||||||
|
|
||||||
Lightweight container environment:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ sudo machinectl shell aios
|
# https://gitlab.archlinux.org/archlinux
|
||||||
# Inside container with aigpt + Claude Code
|
$ git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||||
```
|
```
|
||||||
|
|
||||||
Multiple containers can share the same memory.
|
## docker
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
```
|
|
||||||
Host
|
|
||||||
├── ~/.config/syui/ai/gpt/memory.db (shared)
|
|
||||||
│
|
|
||||||
└── /var/lib/machines/aios/ (container)
|
|
||||||
├── ArchLinux base
|
|
||||||
├── aigpt (MCP server)
|
|
||||||
├── Claude Code
|
|
||||||
├── .zshrc (aliases: ai=claude)
|
|
||||||
└── Bind mount → shared memory
|
|
||||||
```
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# 1. Clone repository
|
# https://git.syui.ai/ai/-/packages/container/os
|
||||||
$ git clone https://github.com/syui/aios
|
$ docker run -it git.syui.ai/ai/os ai
|
||||||
$ cd aios
|
|
||||||
|
|
||||||
# 2. Run installer (creates systemd-nspawn container)
|
# https://hub.docker.com/r/syui/aios
|
||||||
$ sudo ./aios-install.sh
|
$ docekr run -it syui/aios ai
|
||||||
|
|
||||||
# 3. Enter container
|
# https://github.com/users/syui/packages/container/package/aios
|
||||||
$ sudo machinectl shell aios
|
$ docker run -it ghcr.io/syui/aios ai
|
||||||
|
|
||||||
# 4. Start Claude Code
|
|
||||||
$ claude
|
|
||||||
# or
|
|
||||||
$ ai
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Container Distribution
|
## token
|
||||||
|
|
||||||
Pre-built containers are available:
|
|env|body|
|
||||||
|
|---|---|
|
||||||
|
|${{ github.repository }}|syui/aios|
|
||||||
|
|${{ secrets.DOCKER_USERNAME }}|syui|
|
||||||
|
|${{ secrets.DOCKER_TOKEN }}|[token](https://matsuand.github.io/docs.docker.jp.onthefly/docker-hub/access-tokens/)|
|
||||||
|
|${{ secrets.APP_TOKEN }}|[token](https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), pacakge|
|
||||||
|
|
||||||
|
## podman
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Docker
|
$ podman pull aios
|
||||||
$ docker run -it git.syui.ai/ai/os
|
|
||||||
$ docker run -it ghcr.io/syui/aios
|
|
||||||
|
|
||||||
# Podman
|
$ podman machine init
|
||||||
$ podman pull aios # using shortname alias
|
$ podman machine start
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
https://github.com/containers/shortnames
|
||||||
|
|
||||||
### Directory Structure
|
> /etc/containers/registries.conf.d/ai.conf
|
||||||
|
>
|
||||||
```
|
> ~/.config/containers/registries.conf
|
||||||
~/.config/syui/ai/
|
|
||||||
├── gpt/memory.db # Shared memory (SQLite WAL)
|
|
||||||
├── mcp.json # MCP server config
|
|
||||||
└── config.toml # aios config
|
|
||||||
```
|
|
||||||
|
|
||||||
### MCP Configuration
|
|
||||||
|
|
||||||
Claude Code connects to aigpt via MCP:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"aigpt": {
|
|
||||||
"command": "aigpt",
|
|
||||||
"args": ["server", "--enable-layer4"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This enables Claude Code to use aigpt's memory system.
|
|
||||||
|
|
||||||
## Building from Source
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ pacman -S base-devel archiso docker git rust nodejs npm
|
unqualified-search-registries = ['docker.io', 'git.syui.ai', 'ghcr.io']
|
||||||
$ ./build.zsh
|
|
||||||
# Creates: aios-bootstrap.tar.gz
|
[aliases]
|
||||||
|
"aios" = "git.syui.ai/ai/os"
|
||||||
```
|
```
|
||||||
|
|
||||||
## How It Works
|
```sh
|
||||||
|
$ podman pull aios
|
||||||
|
Resolved "aios" as an alias (/etc/containers/registries.conf.d/ai.conf)
|
||||||
|
Trying to pull git.syui.ai/ai/os:latest...
|
||||||
|
Getting image source signatures
|
||||||
|
Copying blob c7e55fecf0be [====================>-----------------] 917.4MiB / 1.7GiB
|
||||||
|
```
|
||||||
|
|
||||||
1. **systemd-nspawn** provides lightweight containers
|
## cron
|
||||||
2. **aigpt** runs as MCP server, stores memories in SQLite
|
|
||||||
3. **Claude Code** connects to aigpt via MCP
|
|
||||||
4. Shared memory (`~/.config/syui/ai/gpt/memory.db`) is bind-mounted
|
|
||||||
|
|
||||||
**Result:** Claude Code can remember your preferences across all containers.
|
stop
|
||||||
|
|
||||||
## Why Not Just Use Claude Code?
|
```sh
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
```
|
||||||
|
|
||||||
You can! aios just provides:
|
## update action
|
||||||
- Pre-configured environment
|
|
||||||
- Shared memory (aigpt) pre-installed
|
|
||||||
- Container isolation
|
|
||||||
- Easy multi-environment setup
|
|
||||||
|
|
||||||
## Links
|
```sh
|
||||||
|
$ vim build.zszh
|
||||||
|
$ ./scpt/gh-actions.zsh
|
||||||
|
```
|
||||||
|
|
||||||
- Repository: https://github.com/syui/aios
|
## link
|
||||||
- Git: https://git.syui.ai/ai/os
|
|
||||||
- aigpt: https://git.syui.ai/ai/gpt
|
|
||||||
- Container: https://git.syui.ai/ai/-/packages/container/os
|
|
||||||
|
|
||||||
## Philosophy
|
- https://git.syui.ai/ai/os
|
||||||
|
- https://github.com/syui/aios
|
||||||
**Insert AI into existing flows**
|
|
||||||
|
|
||||||
Don't build a new AI chat interface. Use Claude Code (which already works).
|
|
||||||
|
|
||||||
Don't create a new container system. Use systemd-nspawn (lightweight, standard).
|
|
||||||
|
|
||||||
Just provide:
|
|
||||||
1. aigpt for shared memory
|
|
||||||
2. Pre-configured environment
|
|
||||||
3. Automation scripts
|
|
||||||
|
|
||||||
Simple. Minimal. Effective.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
© syui
|
|
||||||
|
|||||||
107
build.zsh
107
build.zsh
@@ -1,119 +1,22 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
# aios build script
|
|
||||||
# 1. Build minimal Arch Linux base
|
|
||||||
# 2. Setup user (ai) and shell
|
|
||||||
# 3. Setup Claude Code and aigpt
|
|
||||||
|
|
||||||
echo "=== aios build ==="
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Clean up previous build artifacts
|
|
||||||
echo "Cleaning up previous build..."
|
|
||||||
rm -rf root.x86_64/ archiso/ install.sh
|
|
||||||
rm -f aios-bootstrap*.tar.gz 2>/dev/null || true
|
|
||||||
|
|
||||||
# ============================================
|
|
||||||
# 1. Arch Linux Base Construction
|
|
||||||
# ============================================
|
|
||||||
|
|
||||||
echo "=== Step 1: Arch Linux Base ==="
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
|
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
|
||||||
|
|
||||||
# Clone archiso
|
|
||||||
git clone https://gitlab.archlinux.org/archlinux/archiso
|
git clone https://gitlab.archlinux.org/archlinux/archiso
|
||||||
|
|
||||||
# Copy configuration
|
|
||||||
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
|
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
|
||||||
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
|
||||||
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
|
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
|
||||||
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
|
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
|
||||||
|
|
||||||
# Build bootstrap
|
|
||||||
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
|
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
|
||||||
|
|
||||||
# Extract and prepare
|
|
||||||
tar xf aios-bootstrap*.tar.gz
|
tar xf aios-bootstrap*.tar.gz
|
||||||
mkdir -p root.x86_64
|
mkdir -p root.x86_64/var/lib/machines/arch
|
||||||
pacstrap -c root.x86_64 base
|
pacstrap -c root.x86_64/var/lib/machines/arch base
|
||||||
|
|
||||||
# Configure pacman
|
|
||||||
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
|
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
|
||||||
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist
|
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
|
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
|
||||||
|
|
||||||
# Initialize pacman keys
|
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman'
|
||||||
# Install base packages (including systemd-container for machinectl)
|
|
||||||
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 /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d'
|
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'
|
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 /bin/sh -c 'chsh -s /bin/zsh'
|
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
|
||||||
|
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
|
||||||
# Install Claude Code
|
tar -zcvf aios-bootstrap.tar.gz root.x86_64/
|
||||||
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/etc/os-release
|
|
||||||
|
|
||||||
# Configure sudoers for wheel group (full access for container operation)
|
|
||||||
echo "Configuring sudoers..."
|
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/poweroff, /usr/bin/reboot" >> /etc/sudoers'
|
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
|
||||||
|
|
||||||
# Install aigpt (aios core package)
|
|
||||||
echo "Installing aigpt..."
|
|
||||||
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/ && cd .. && rm -rf gpt'
|
|
||||||
|
|
||||||
# Install aibot (aios core package)
|
|
||||||
echo "Installing aibot..."
|
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build --release && cp -rf ./target/release/aibot /bin/ && aibot ai && cd .. && rm -rf bot'
|
|
||||||
|
|
||||||
echo "Installing aishell..."
|
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/shell && cd shell && cargo build --release && cp -rf ./target/release/aishell /bin/ && cd .. && rm -rf shell'
|
|
||||||
|
|
||||||
echo "✓ Arch Linux base complete"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# ============================================
|
|
||||||
# 2. User Setup
|
|
||||||
# ============================================
|
|
||||||
|
|
||||||
bash ./cfg/setup-user.sh
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# ============================================
|
|
||||||
# 3. Create workspace container (after all configuration)
|
|
||||||
# ============================================
|
|
||||||
|
|
||||||
bash ./cfg/user-continer.sh
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# ============================================
|
|
||||||
# Finalize
|
|
||||||
# ============================================
|
|
||||||
|
|
||||||
echo "=== Finalizing ==="
|
|
||||||
|
|
||||||
# Copy aios-ctl.zsh for host machine control
|
|
||||||
cp -rf ./cfg/aios-ctl.zsh root.x86_64/opt/aios-ctl.zsh
|
|
||||||
|
|
||||||
# Copy install script
|
|
||||||
cp -rf ./cfg/install.sh ./install.sh
|
|
||||||
chmod +x ./install.sh
|
|
||||||
|
|
||||||
# Create tarball with aios (includes child containers)
|
|
||||||
echo "Creating tarball..."
|
|
||||||
tar -zcvf aios-bootstrap.tar.gz root.x86_64/ install.sh
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "=== Build Complete ==="
|
|
||||||
echo "Output: aios-bootstrap.tar.gz"
|
|
||||||
echo ""
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# https://github.com/containers/shortnames
|
unqualified-search-registries = ['docker.io', 'git.syui.ai', 'ghcr.io']
|
||||||
# ~/.config/containers/registries.conf.d/ai.conf
|
|
||||||
unqualified-search-registries = ['git.syui.ai', 'docker.io', 'ghcr.io']
|
|
||||||
|
|
||||||
[aliases]
|
[aliases]
|
||||||
"aios" = "git.syui.ai/ai/os"
|
"aios" = "git.syui.ai/ai/os"
|
||||||
|
|||||||
132
cfg/aios-ctl.zsh
132
cfg/aios-ctl.zsh
@@ -1,132 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
# aios machine control commands
|
|
||||||
|
|
||||||
NAME="aios"
|
|
||||||
BACKUP="${NAME}back"
|
|
||||||
|
|
||||||
# Start aios container
|
|
||||||
function aios-start() {
|
|
||||||
sudo machinectl start $NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Stop aios container
|
|
||||||
function aios-stop() {
|
|
||||||
sudo machinectl poweroff $NAME > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl terminate $NAME > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Shell into aios container
|
|
||||||
function aios-shell() {
|
|
||||||
sudo machinectl shell $NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Login to aios container as ai user
|
|
||||||
function aios-login() {
|
|
||||||
sudo machinectl shell $NAME /bin/su - ai
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create backup of current aios
|
|
||||||
function aios-backup() {
|
|
||||||
echo "Creating backup: $BACKUP"
|
|
||||||
sudo machinectl poweroff $BACKUP > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl terminate $BACKUP > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl remove $BACKUP > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl clone $NAME $BACKUP
|
|
||||||
echo "Backup created: $BACKUP"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reset aios from backup
|
|
||||||
function aios-reset() {
|
|
||||||
if ! sudo machinectl list-images | grep -q $BACKUP; then
|
|
||||||
echo "Error: No backup found. Run 'aios-backup' first."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Resetting $NAME from $BACKUP..."
|
|
||||||
sudo machinectl poweroff $NAME > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl terminate $NAME > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl remove $NAME
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl clone $BACKUP $NAME
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl start $NAME
|
|
||||||
echo "Reset complete"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update packages in backup
|
|
||||||
function aios-update() {
|
|
||||||
if ! sudo machinectl list-images | grep -q $BACKUP; then
|
|
||||||
echo "Error: No backup found. Run 'aios-backup' first."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Updating $BACKUP..."
|
|
||||||
sudo machinectl start $BACKUP
|
|
||||||
sleep 5
|
|
||||||
sudo machinectl shell $BACKUP /bin/sh -c 'pacman -Syu --noconfirm'
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl poweroff $BACKUP
|
|
||||||
echo "Update complete"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove aios container
|
|
||||||
function aios-remove() {
|
|
||||||
echo "Removing $NAME..."
|
|
||||||
sudo machinectl poweroff $NAME > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl terminate $NAME > /dev/null 2>&1
|
|
||||||
sleep 2
|
|
||||||
sudo machinectl remove $NAME
|
|
||||||
echo "Removed $NAME"
|
|
||||||
}
|
|
||||||
|
|
||||||
# List all machines
|
|
||||||
function aios-list() {
|
|
||||||
sudo machinectl list-images
|
|
||||||
}
|
|
||||||
|
|
||||||
# Show status
|
|
||||||
function aios-status() {
|
|
||||||
sudo machinectl status $NAME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute command in aios
|
|
||||||
function aios-exec() {
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Usage: aios-exec <command>"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
sudo machinectl shell $NAME /bin/sh -c "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Show help
|
|
||||||
function aios-help() {
|
|
||||||
cat <<'EOF'
|
|
||||||
aios machine control commands:
|
|
||||||
|
|
||||||
aios-start Start aios container
|
|
||||||
aios-stop Stop aios container
|
|
||||||
aios-shell Open shell in aios container
|
|
||||||
aios-login Login to aios container console
|
|
||||||
aios-backup Create backup snapshot (aiosback)
|
|
||||||
aios-reset Reset aios from backup
|
|
||||||
aios-update Update packages in backup
|
|
||||||
aios-remove Remove aios container
|
|
||||||
aios-list List all machine images
|
|
||||||
aios-status Show aios status
|
|
||||||
aios-exec Execute command in aios
|
|
||||||
aios-help Show this help
|
|
||||||
|
|
||||||
Example workflow:
|
|
||||||
1. aios-start # Start container
|
|
||||||
2. aios-login # Login and use
|
|
||||||
3. aios-backup # Create backup before major changes
|
|
||||||
4. aios-reset # Restore if something breaks
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
38
cfg/aios.zsh
38
cfg/aios.zsh
@@ -1,38 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
# aios startup script
|
|
||||||
|
|
||||||
CONFIG_DIR="$HOME/.config/syui/ai/os"
|
|
||||||
CONFIG_FILE="$CONFIG_DIR/config.json"
|
|
||||||
|
|
||||||
# 設定ファイルが存在しない場合は何もしない
|
|
||||||
if [ ! -f "$CONFIG_FILE" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# jqで設定読み込み
|
|
||||||
if ! command -v jq &>/dev/null; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
SHELL_MODE=$(cat "$CONFIG_FILE" | jq -r '.shell // false')
|
|
||||||
|
|
||||||
if [ "$SHELL_MODE" = "true" ]; then
|
|
||||||
echo "aios - AI-managed OS"
|
|
||||||
echo " Starting workspace container..."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# 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
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# aios configuration
|
|
||||||
|
|
||||||
[general]
|
|
||||||
version = "0.1.0"
|
|
||||||
name = "aios"
|
|
||||||
description = "AI-managed OS with shared memory"
|
|
||||||
|
|
||||||
[paths]
|
|
||||||
config_dir = "~/.config/syui/ai"
|
|
||||||
memory_db = "~/.config/syui/ai/gpt/memory.db"
|
|
||||||
mcp_config = "~/.config/syui/ai/mcp.json"
|
|
||||||
|
|
||||||
[permissions]
|
|
||||||
# Level 0: Auto-allow (no approval required)
|
|
||||||
auto_allow = [
|
|
||||||
"pacman -Q*",
|
|
||||||
"pacman -Ss*",
|
|
||||||
"systemctl status*",
|
|
||||||
"ls", "cat", "grep", "find",
|
|
||||||
"ps", "top", "htop",
|
|
||||||
"df", "free", "uname"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Level 1: Notify (log only, no approval)
|
|
||||||
notify = [
|
|
||||||
"pacman -S*",
|
|
||||||
"pacman -Sy*",
|
|
||||||
"git clone*",
|
|
||||||
"cargo install*",
|
|
||||||
"systemctl start*",
|
|
||||||
"systemctl enable*"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Level 2: Require approval
|
|
||||||
require_approval = [
|
|
||||||
"pacman -R*",
|
|
||||||
"rm -rf*",
|
|
||||||
"systemctl stop*",
|
|
||||||
"systemctl disable*",
|
|
||||||
"dd*"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Level 3: Deny
|
|
||||||
deny = [
|
|
||||||
"rm -rf /",
|
|
||||||
"rm -rf /*",
|
|
||||||
"mkfs*",
|
|
||||||
":(){ :|:& };:"
|
|
||||||
]
|
|
||||||
|
|
||||||
[aigpt]
|
|
||||||
enable_layer4 = true
|
|
||||||
wal_mode = true
|
|
||||||
cache_size_mb = 64
|
|
||||||
|
|
||||||
[container]
|
|
||||||
runtime = "systemd-nspawn"
|
|
||||||
private_users = true
|
|
||||||
virtual_ethernet = true
|
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
|
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman bc'
|
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d'
|
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'
|
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'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
|
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# aios installation script
|
|
||||||
|
|
||||||
NAME="aios"
|
|
||||||
TARBALL="aios-bootstrap.tar.gz"
|
|
||||||
|
|
||||||
echo "=== aios installation ==="
|
|
||||||
|
|
||||||
# Extract and install
|
|
||||||
tar xf "$TARBALL"
|
|
||||||
mkdir -p /var/lib/machines
|
|
||||||
mv root.x86_64 /var/lib/machines/$NAME
|
|
||||||
|
|
||||||
# Create aios.nspawn for network access
|
|
||||||
echo "Creating network configuration..."
|
|
||||||
mkdir -p /etc/systemd/nspawn
|
|
||||||
cat > /etc/systemd/nspawn/$NAME.nspawn <<'EOF'
|
|
||||||
[Exec]
|
|
||||||
Boot=yes
|
|
||||||
|
|
||||||
[Network]
|
|
||||||
Private=no
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "=== Installation complete ==="
|
|
||||||
echo ""
|
|
||||||
echo "Usage:"
|
|
||||||
echo " sudo machinectl start $NAME"
|
|
||||||
echo " sudo machinectl shell $NAME /bin/su - ai"
|
|
||||||
echo ""
|
|
||||||
12
cfg/mcp.json
12
cfg/mcp.json
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"aigpt": {
|
|
||||||
"command": "aigpt",
|
|
||||||
"args": ["server", "--enable-layer4"],
|
|
||||||
"env": {
|
|
||||||
"AIGPT_DB": "/root/.config/syui/ai/gpt/memory.db"
|
|
||||||
},
|
|
||||||
"description": "AI memory and personality system"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# systemd-nspawn configuration for aios
|
|
||||||
# Place this file in /etc/systemd/nspawn/aios.nspawn
|
|
||||||
|
|
||||||
[Exec]
|
|
||||||
Boot=yes
|
|
||||||
PrivateUsers=pick
|
|
||||||
ResolvConf=copy-host
|
|
||||||
|
|
||||||
[Files]
|
|
||||||
# Bind mount shared memory directory
|
|
||||||
# Host: /root/.config/syui/ai -> Container: /root/.config/syui/ai
|
|
||||||
Bind=/root/.config/syui/ai:/root/.config/syui/ai
|
|
||||||
|
|
||||||
[Network]
|
|
||||||
VirtualEthernet=no
|
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
NAME=aios
|
|
||||||
PRETTY_NAME=aios
|
|
||||||
ID=ai
|
|
||||||
ID_LIKE=arch
|
|
||||||
VERSION_ID=2024.11
|
|
||||||
VERSION="2024.11 (Rolling)"
|
|
||||||
VERSION_CODENAME=rolling
|
|
||||||
BUILD_ID=rolling
|
BUILD_ID=rolling
|
||||||
IMAGE_ID=aios
|
|
||||||
IMAGE_VERSION=2024.11.06
|
|
||||||
ANSI_COLOR="38;2;23;147;209"
|
ANSI_COLOR="38;2;23;147;209"
|
||||||
|
IMAGE_ID=aios
|
||||||
|
IMAGE_VERSION=2024.02.11
|
||||||
|
NAME=ai os
|
||||||
|
PRETTY_NAME=ai os
|
||||||
|
ID=ai
|
||||||
HOME_URL=https://git.syui.ai/ai/os
|
HOME_URL=https://git.syui.ai/ai/os
|
||||||
DOCUMENTATION_URL=https://git.syui.ai/ai/os/wiki
|
DOCUMENTATION_URL=https://git.syui.ai/ai/os/wiki
|
||||||
SUPPORT_URL=https://git.syui.ai/ai/os/issues
|
SUPPORT_URL=https://git.syui.ai/ai/os/issues
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
iso_name="aios"
|
iso_name="aios"
|
||||||
iso_label="AI_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
|
iso_label="AI_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
|
||||||
iso_publisher="aios <https://git.syui.ai/ai/os>"
|
iso_publisher="ai os <https://git.syui.ai/ai/os>"
|
||||||
iso_application="aios Live/Rescue DVD"
|
iso_application="ai os Live/Rescue DVD"
|
||||||
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
|
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
|
||||||
install_dir="ai"
|
install_dir="ai"
|
||||||
#buildmodes=('iso')
|
#buildmodes=('iso')
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# User setup for aios
|
|
||||||
# Creates ai user, configures auto-login, sudo, zshrc
|
|
||||||
|
|
||||||
ROOTFS="root.x86_64"
|
|
||||||
|
|
||||||
echo "=== User Setup ==="
|
|
||||||
|
|
||||||
# Create default user 'ai'
|
|
||||||
echo "Creating user 'ai'..."
|
|
||||||
arch-chroot $ROOTFS /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai'
|
|
||||||
arch-chroot $ROOTFS /bin/sh -c 'echo "ai:root" | chpasswd'
|
|
||||||
|
|
||||||
# Configure securetty for pts login (required for systemd-nspawn)
|
|
||||||
echo "Configuring securetty..."
|
|
||||||
cat >> $ROOTFS/etc/securetty <<'EOF'
|
|
||||||
pts/0
|
|
||||||
pts/1
|
|
||||||
pts/2
|
|
||||||
pts/3
|
|
||||||
pts/4
|
|
||||||
pts/5
|
|
||||||
pts/6
|
|
||||||
pts/7
|
|
||||||
pts/8
|
|
||||||
pts/9
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Enable systemd-machined for container management
|
|
||||||
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
|
|
||||||
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'
|
|
||||||
cat > $ROOTFS/etc/systemd/system/getty@tty1.service.d/override.conf <<'EOF'
|
|
||||||
[Service]
|
|
||||||
ExecStart=
|
|
||||||
ExecStart=-/usr/bin/agetty --autologin ai --noclear %I $TERM
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Copy .zshrc for root
|
|
||||||
echo "Copying zshrc..."
|
|
||||||
cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc
|
|
||||||
|
|
||||||
# Copy .zshrc for user 'ai'
|
|
||||||
cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc
|
|
||||||
|
|
||||||
# Add workspace auto-entry and claude auto-start
|
|
||||||
cat >> $ROOTFS/home/ai/.zshrc <<'EOF'
|
|
||||||
|
|
||||||
# aios: auto-enter workspace container
|
|
||||||
if [[ -o login ]] && [[ -o interactive ]]; then
|
|
||||||
if [[ -z "$INSIDE_WORKSPACE" ]]; then
|
|
||||||
# Enter workspace container
|
|
||||||
export INSIDE_WORKSPACE=1
|
|
||||||
exec sudo systemd-nspawn -q -D /var/lib/machines/workspace /bin/zsh
|
|
||||||
else
|
|
||||||
# Inside workspace - start claude with skip permissions
|
|
||||||
if command -v claude &>/dev/null; then
|
|
||||||
claude --dangerously-skip-permissions
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
|
|
||||||
arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
|
|
||||||
|
|
||||||
echo "✓ User setup complete"
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Create workspace container inside aios for ai user
|
|
||||||
# Backup aios before creating /var/lib/machines to avoid recursion
|
|
||||||
|
|
||||||
ROOTFS="root.x86_64"
|
|
||||||
|
|
||||||
echo "=== Creating workspace container ==="
|
|
||||||
|
|
||||||
# Backup current aios to temp location (before creating /var/lib/machines)
|
|
||||||
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..."
|
|
||||||
cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/workspace
|
|
||||||
|
|
||||||
# Cleanup temp backup
|
|
||||||
rm -rf /tmp/aios-backup-$$
|
|
||||||
|
|
||||||
echo "✓ Workspace container created"
|
|
||||||
40
cfg/zshrc
40
cfg/zshrc
@@ -1,40 +0,0 @@
|
|||||||
# aios .zshrc
|
|
||||||
# AI-managed OS with Claude Code + aigpt
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
export EDITOR=vim
|
|
||||||
export LANG=en_US.UTF-8
|
|
||||||
|
|
||||||
# Path
|
|
||||||
export PATH=$HOME/.local/bin:$PATH
|
|
||||||
|
|
||||||
# aigpt MCP configuration
|
|
||||||
export AIGPT_CONFIG="$HOME/.config/syui/ai/config.toml"
|
|
||||||
export AIGPT_MCP="$HOME/.config/syui/ai/mcp.json"
|
|
||||||
|
|
||||||
# Aliases
|
|
||||||
alias claude='claude --dangerously-skip-permissions'
|
|
||||||
alias c='claude --dangerously-skip-permissions'
|
|
||||||
|
|
||||||
# Prompt
|
|
||||||
autoload -Uz promptinit
|
|
||||||
promptinit
|
|
||||||
prompt adam1
|
|
||||||
|
|
||||||
# History
|
|
||||||
HISTFILE=~/.zsh_history
|
|
||||||
HISTSIZE=10000
|
|
||||||
SAVEHIST=10000
|
|
||||||
setopt SHARE_HISTORY
|
|
||||||
|
|
||||||
# Completion
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit
|
|
||||||
|
|
||||||
# Welcome message
|
|
||||||
echo "aios - AI-managed OS"
|
|
||||||
echo " aigpt: MCP server for shared memory"
|
|
||||||
echo " claude: AI conversation interface"
|
|
||||||
echo ""
|
|
||||||
echo "Type 'claude' or 'ai' to start"
|
|
||||||
echo ""
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
pacman -Syuu --noconfirm git base-devel archiso
|
|
||||||
git clone https://gitlab.archlinux.org/archlinux/archiso
|
|
||||||
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
|
|
||||||
mkdir -p work/x86_64/airootfs/var/lib/machines/arch
|
|
||||||
pacstrap -c work/x86_64/airootfs/var/lib/machines/arch base
|
|
||||||
arch-chroot work/x86_64/airootfs/ /bin/sh -c 'pacman-key --init'
|
|
||||||
arch-chroot work/x86_64/airootfs/ /bin/sh -c 'pacman-key --populate archlinux'
|
|
||||||
tar -zcvf archlinux.tar.gz -C work/x86_64/airootfs/ .
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# 変数定義
|
|
||||||
DISK="/dev/sda"
|
|
||||||
HOSTNAME="ai-arch"
|
|
||||||
USERNAME="ai"
|
|
||||||
|
|
||||||
# パーティション作成(自動)
|
|
||||||
parted $DISK mklabel gpt
|
|
||||||
parted $DISK mkpart ESP fat32 1MiB 1GiB
|
|
||||||
parted $DISK set 1 esp on
|
|
||||||
parted $DISK mkpart primary linux-swap 1GiB 5GiB
|
|
||||||
parted $DISK mkpart primary ext4 5GiB 100%
|
|
||||||
|
|
||||||
# ファイルシステム作成
|
|
||||||
mkfs.fat -F32 ${DISK}1
|
|
||||||
mkswap ${DISK}2
|
|
||||||
mkfs.ext4 ${DISK}3
|
|
||||||
|
|
||||||
# マウント
|
|
||||||
mount ${DISK}3 /mnt
|
|
||||||
mkdir -p /mnt/boot
|
|
||||||
mount ${DISK}1 /mnt/boot
|
|
||||||
swapon ${DISK}2
|
|
||||||
|
|
||||||
# インストール
|
|
||||||
pacstrap -K /mnt base linux linux-firmware base-devel vim networkmanager grub efibootmgr
|
|
||||||
|
|
||||||
# 設定
|
|
||||||
genfstab -U /mnt >> /mnt/etc/fstab
|
|
||||||
|
|
||||||
arch-chroot /mnt /bin/bash << EOF
|
|
||||||
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
|
|
||||||
hwclock --systohc
|
|
||||||
echo "ja_JP.UTF-8 UTF-8" >> /etc/locale.gen
|
|
||||||
locale-gen
|
|
||||||
echo "LANG=ja_JP.UTF-8" > /etc/locale.conf
|
|
||||||
echo "$HOSTNAME" > /etc/hostname
|
|
||||||
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH
|
|
||||||
grub-mkconfig -o /boot/grub/grub.cfg
|
|
||||||
systemctl enable NetworkManager
|
|
||||||
useradd -m -G wheel $USERNAME
|
|
||||||
EOF
|
|
||||||
@@ -1335,7 +1335,6 @@ _validate_requirements_buildmode_bootstrap() {
|
|||||||
local bootstrap_pkg_list_from_file=()
|
local bootstrap_pkg_list_from_file=()
|
||||||
|
|
||||||
# Check if packages for the bootstrap image are specified
|
# Check if packages for the bootstrap image are specified
|
||||||
if [[ -n "${bootstrap_packages}" ]]; then
|
|
||||||
if [[ -e "${bootstrap_packages}" ]]; then
|
if [[ -e "${bootstrap_packages}" ]]; then
|
||||||
mapfile -t bootstrap_pkg_list_from_file < \
|
mapfile -t bootstrap_pkg_list_from_file < \
|
||||||
<(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${bootstrap_packages}")
|
<(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${bootstrap_packages}")
|
||||||
@@ -1348,7 +1347,6 @@ _validate_requirements_buildmode_bootstrap() {
|
|||||||
(( validation_error=validation_error+1 ))
|
(( validation_error=validation_error+1 ))
|
||||||
_msg_error "Bootstrap packages file '${bootstrap_packages}' does not exist." 0
|
_msg_error "Bootstrap packages file '${bootstrap_packages}' does not exist." 0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
_validate_common_requirements_buildmode_all
|
_validate_common_requirements_buildmode_all
|
||||||
if ! command -v bsdtar &>/dev/null; then
|
if ! command -v bsdtar &>/dev/null; then
|
||||||
|
|||||||
Reference in New Issue
Block a user