Compare commits

...

35 Commits

Author SHA1 Message Date
e0e012da9e fix ignore
Some checks failed
build and push image / Release (push) Failing after 1m14s
2025-11-07 20:28:53 +09:00
97be1cd8c4 rm aios-install.sh
Some checks failed
build and push image / Release (push) Failing after 1m16s
2025-11-07 20:24:54 +09:00
syui
514930c2e3 Merge pull request #1 from syui/claude/aios-initial-direction-011CUrcij89bjpsbc7k8wQeo
Some checks failed
build and push image / Release (push) Failing after 1m24s
Claude/aios initial direction 011 c urcij89bjpsbc7k8w qeo
2025-11-07 16:14:43 +09:00
Claude
7d531c2608 fix: Remove claude.service and fix network settings
- Remove cfg/claude.service (claude should be run manually, not as systemd service)
- Fix bind mount: change %h to /root for proper path resolution
- Fix network: change to VirtualEthernet=no for internet access
- Update install.sh to create proper nspawn configs for all containers
- Create /root/.config/syui/ai directory in install.sh

Working flow:
- aios OS boot -> ai user login
- machinectl login workspace
- manually run 'claude' command
2025-11-07 07:02:43 +00:00
Claude
ff161f84a0 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
2025-11-07 06:02:40 +00:00
Claude
ab50bc29f0 fix: Configure Claude Code settings via symlink for sharing
- Move MCP config to ~/.config/syui/ai/claude/ (bind-mounted)
- Create symlink ~/.config/claude -> ~/.config/syui/ai/claude
- Apply to both root and ai user
- Settings now shared across containers via bind mount
- No need to copy config files, they are automatically shared
2025-11-06 17:12:49 +00:00
Claude
c2149966ec chore: Add build artifacts to .gitignore 2025-11-06 16:00:49 +00:00
Claude
a3e1878c14 feat: Add machinectl management and backup/restore system
- Create cfg/aios-ctl.zsh with machinectl control commands
  - aios-start/stop/shell/login for basic operations
  - aios-backup to save current state to aiosback
  - aios-reset to restore from backup (preserves config files)
  - aios-update to update packages in backup
- Create cfg/install.sh for automated installation
  - Extracts tarball to /var/lib/machines/aios
  - Creates systemd-nspawn configuration
  - Automatically creates initial backup image (aiosback)
- Include aios-ctl.zsh in container at /opt/aios-ctl.zsh
- Include install.sh in tarball for easy deployment
- Config files in ~/.config/syui/ai are bind-mounted and preserved across resets
2025-11-06 15:56:00 +00:00
Claude
8e74f906a0 feat: Add optional auto-startup for claude
- Create cfg/aios.zsh startup script with config-based claude launch
- Install startup script to /usr/local/bin/aios-startup
- Create default config at ~/.config/syui/ai/os/config.json
- Source startup script from user 'ai' .zshrc
- Enable optional "shell mode" via config {"shell": true}
2025-11-06 15:39:47 +00:00
Claude
baece04bba fix: Configure sudo for specific commands only
Changed sudo configuration to allow NOPASSWD for specific commands only:
- pacman -Syu --noconfirm (system update)
- rm -rf /var/lib/pacman/db.lck (unlock pacman)
- poweroff (shutdown)
- reboot (reboot)

This is more secure than allowing all commands without password.
2025-11-06 15:19:48 +00:00
Claude
69754d9df0 feat: Add default user 'ai' with auto-login
Added user setup:
- Username: ai
- Password: root
- Shell: zsh
- Groups: wheel (sudo enabled)

Auto-login configuration:
- getty@tty1 with --autologin ai
- .zshrc copied for both root and ai user

This provides a ready-to-use environment with AI-first user.
2025-11-06 15:18:04 +00:00
Claude
a411b36108 fix: Create Claude MCP config file directly
claude mcp add command does not support args parameter.
Changed to directly create claude_desktop_config.json with full config:
- command: aigpt
- args: ["server", "--enable-layer4"]

This ensures aigpt is properly registered with Layer 4 enabled.
2025-11-06 15:14:42 +00:00
Claude
b7077becdb feat: Auto-register aigpt to Claude MCP during build
Added automatic MCP registration:
- claude mcp add aigpt $(which aigpt) server

This eliminates manual MCP setup after installation.
Users can immediately use 'claude' with aigpt memory system.
2025-11-06 15:13:03 +00:00
Claude
22b1502f58 fix: Add missing os-release copy to build process
cfg/os-release was not being copied, causing NAME to remain 'Arch Linux'
instead of 'aios'.

Added os-release copy to both:
- build.zsh
- .github/workflows/release.yml
2025-11-06 14:51:31 +00:00
Claude
bf27244544 fix: Update arch-chroot paths for new archiso structure
archiso now creates bootstrap with systemd-nspawn standard structure:
root.x86_64/var/lib/machines/arch/ instead of root.x86_64/

Changes:
- build.zsh: Updated all arch-chroot paths to root.x86_64/var/lib/machines/arch
- build.zsh: Updated file copy paths for .zshrc, mcp.json, config.toml
- .github/workflows/release.yml: Same path updates
- Added aigpt + Claude Code installation steps to GitHub Actions

This aligns with systemd-nspawn's standard container directory structure
(/var/lib/machines/).
2025-11-06 14:26:53 +00:00
Claude
34f40e82c1 feat: Improve os-release with standard fields
- Added ID_LIKE=arch (indicates Arch Linux base)
- Added VERSION_ID and VERSION (version information)
- Added VERSION_CODENAME=rolling
- Reorganized fields in standard order
- Updated IMAGE_VERSION to 2024.11.06
2025-11-06 13:35:21 +00:00
Claude
f5c5b83955 fix: Change "ai os" to "aios" in cfg files
- cfg/os-release: NAME and PRETTY_NAME
- cfg/profiledef.sh: iso_publisher and iso_application
2025-11-06 13:34:31 +00:00
Claude
80e40a53ec Refactor aios: Focus on Claude Code + aigpt simplicity
Simplified aios to focus on core value:
- Pre-configured systemd-nspawn environment
- Claude Code + aigpt (MCP) pre-installed
- Shared memory across containers

Philosophy:
Don't build new tools. Use existing ones (Claude Code, systemd-nspawn).
Just provide the optimal environment and automation.

Changes:
- Added cfg/zshrc: Shell config with claude alias
- Updated build.zsh: Install Claude Code (npm) + aigpt
- Updated aios-install.sh: Simplified installation flow
- Updated README.md: Focus on simplicity and practicality

Installation:
1. npm i -g @anthropic-ai/claude-code
2. Build aigpt from source
3. Configure .zshrc with aliases
4. Set up systemd-nspawn with bind mounts

Usage:
$ sudo machinectl shell aios
$ claude  # or: ai
2025-11-06 13:19:48 +00:00
Claude
ee4b8c052f Implement aios initial direction: AI-managed OS with shared memory
This commit implements the new direction for aios:
- AI conversation interface replaces traditional shell
- aigpt integration for shared memory across containers
- systemd-nspawn for environment isolation

Changes:
- Added aios-install.sh: Complete installer script
- Added cfg/mcp.json: MCP server configuration for aigpt
- Added cfg/config.toml: aios configuration with permission system
- Added cfg/nspawn/aios.nspawn: systemd-nspawn configuration
- Updated build.zsh: Integrated aigpt installation and setup
- Updated README.md: Documented new architecture and philosophy

Architecture:
User → AI Chat → Commands → Execution
         ↓
     aigpt (shared memory)
         ↓
  systemd-nspawn (isolated environment)

Philosophy:
Simply insert AI into existing flows (shell → AI chat)
2025-11-06 12:36:50 +00:00
94d16d9a21 add scpt
Some checks failed
build and push image / Release (push) Failing after 1m36s
2025-08-10 07:56:31 +09:00
ccd4aab9af add ai.conf
Some checks failed
build and push image / Release (push) Failing after 2m24s
2025-07-04 11:46:50 +09:00
591c34b61b fix podman
Some checks are pending
build and push image / Release (push) Waiting to run
2025-04-12 03:06:43 +09:00
c3772d1b93 fix actions 2025-04-12 02:51:16 +09:00
d4e96f0282 fix actions 2025-04-12 02:51:16 +09:00
2dc46f5897 fix gh-actions 2025-04-12 02:51:15 +09:00
15a6af27ce add gh-actions cron 2025-02-24 16:55:38 +09:00
65aa20dfe6 fix bc
All checks were successful
build and push image / Release (push) Successful in 3m29s
2025-01-20 16:31:50 +09:00
04b6c5de6c test ge-actions
Some checks failed
build and push image / Release (push) Failing after 1m28s
2024-08-25 13:29:13 +09:00
35a33a7ca6 add bc 2024-08-25 13:07:31 +09:00
862dca006b fix actions 2024-08-04 08:12:07 +09:00
f396610305 fix gh 2024-03-06 07:46:34 +09:00
cd9472d18a config podman 2024-03-06 07:21:52 +09:00
74c7d3b1bb add podman 2024-03-06 07:17:13 +09:00
c3330a75d9 update readme 2024-03-06 03:11:31 +09:00
f1c3874ed2 add gitea actions
All checks were successful
Build and Push Image / Release (push) Successful in 11s
2024-03-05 23:32:36 +09:00
20 changed files with 865 additions and 61 deletions

View File

@@ -0,0 +1,6 @@
# 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"

View File

@@ -1,9 +1,13 @@
name: Build and Push Image
on: [ push ]
name: build and push image
on:
schedule:
- cron: '0 0 * * *'
push:
env:
USERNAME: ai
TAG: latest
IMAGE_ID: aios
IMAGE_NAME: ${{ gitea.repository }}
APP_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: localhost:8088
@@ -13,13 +17,14 @@ jobs:
name: Release
runs-on: ubuntu-latest
container:
image: archlinux
image: ghcr.io/syui/aios
options: --privileged
steps:
- name: Initialize
run: |
pacman -Syuu --noconfirm base-devel archiso docker git
docker pull syui/aios
docker tag syui/aios ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:latest
pacman -Syuu --noconfirm base-devel archiso docker git curl
docker pull ghcr.io/syui/aios
docker tag syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}

View File

@@ -2,10 +2,8 @@ name: release
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
tags:
- 'v*'
permissions:
contents: write
@@ -28,7 +26,7 @@ jobs:
uses: actions/checkout@v4
- name: Initialize
run: |
pacman -Syuu --noconfirm base-devel archiso docker git nodejs
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
@@ -39,14 +37,71 @@ jobs:
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'
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/
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/var/lib/machines/arch/etc/pacman.d/mirrorlist
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/var/lib/machines/arch/etc/pacman.conf
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman-key --init'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman-key --populate archlinux'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs npm docker podman bc sqlite'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d'
arch-chroot root.x86_64/var/lib/machines/arch /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/var/lib/machines/arch /bin/sh -c 'chsh -s /bin/zsh'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
cp -rf ./cfg/os-release root.x86_64/var/lib/machines/arch/etc/os-release
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'echo "ai:root" | chpasswd'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/rm -rf /var/lib/pacman/db.lck, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl" >> /etc/sudoers'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /etc/systemd/system/getty@tty1.service.d'
cat > root.x86_64/var/lib/machines/arch/etc/systemd/system/getty@tty1.service.d/override.conf <<'EOF'
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin ai --noclear %I $TERM
EOF
cp -rf ./cfg/zshrc root.x86_64/var/lib/machines/arch/root/.zshrc
cp -rf ./cfg/zshrc root.x86_64/var/lib/machines/arch/home/ai/.zshrc
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
cp -rf ./cfg/aios.zsh root.x86_64/var/lib/machines/arch/usr/local/bin/aios-startup
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chmod +x /usr/local/bin/aios-startup'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /home/ai/.config/syui/ai/os'
cat > root.x86_64/var/lib/machines/arch/home/ai/.config/syui/ai/os/config.json <<'EOF'
{
"shell": false
}
EOF
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown -R ai:ai /home/ai/.config'
cat >> root.x86_64/var/lib/machines/arch/home/ai/.zshrc <<'EOF'
# aios startup
source /usr/local/bin/aios-startup
EOF
arch-chroot root.x86_64/var/lib/machines/arch /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/var/lib/machines/arch /bin/sh -c 'mkdir -p /root/.config/syui/ai/claude'
cat > root.x86_64/var/lib/machines/arch/root/.config/syui/ai/claude/claude_desktop_config.json <<'EOF'
{
"mcpServers": {
"aigpt": {
"command": "aigpt",
"args": ["server", "--enable-layer4"]
}
}
}
EOF
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'ln -sf /root/.config/syui/ai/claude /root/.config/claude'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /home/ai/.config/syui/ai/claude'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'cp /root/.config/syui/ai/claude/claude_desktop_config.json /home/ai/.config/syui/ai/claude/'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'ln -sf /home/ai/.config/syui/ai/claude /home/ai/.config/claude'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown -R ai:ai /home/ai/.config/syui'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /root/.config/syui/ai/gpt'
cp -rf ./cfg/mcp.json root.x86_64/var/lib/machines/arch/root/.config/syui/ai/mcp.json
cp -rf ./cfg/config.toml root.x86_64/var/lib/machines/arch/root/.config/syui/ai/config.toml
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'aigpt server --enable-layer4 &'
sleep 2
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pkill aigpt'
arch-chroot root.x86_64/var/lib/machines/arch /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'
cp -rf ./cfg/aios-ctl.zsh root.x86_64/var/lib/machines/arch/opt/aios-ctl.zsh
cp -rf ./cfg/install.sh ./install.sh
chmod +x ./install.sh
tar -zcvf aios-bootstrap.tar.gz root.x86_64/ install.sh
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
docker push ${{ env.IMAGE_NAME }}

8
.gitignore vendored
View File

@@ -1 +1,9 @@
.config/ai
**.DS_Store
# Build artifacts
aios-bootstrap*.tar.gz
root.x86_64/
archiso/
install.sh
build.log

188
README.md
View File

@@ -1,34 +1,188 @@
## ai `os`
# <img src="./icon/ai.png" width="30"> ai `os`
<img src="./icon/ai.png" width="100">
**aios** = ArchLinux + Claude Code + aigpt in systemd-nspawn
- name : ai os
- image : [aios-bootstrap.tar.gz](https://github.com/syui/aios/releases/tag/latest)
- base : [archlinux](https://gitlab.archlinux.org/archlinux)
A minimal ArchLinux environment optimized for Claude Code with shared AI memory.
### docker
```
systemd-nspawn container
├── Claude Code (AI interface)
├── aigpt (shared memory)
└── zsh (.zshrc configured)
```sh
$ docker run -it syui/aios ai
$ sudo machinectl shell aios
$ claude # Start Claude Code
```
> Dockerfile
## 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
FROM syui/aios
$ claude
# Claude Code starts, with MCP connection to aigpt
> Install rust development environment
✓ Installing rust, rust-analyzer, neovim
```
- https://hub.docker.com/r/syui/aios
### 2. aigpt (Shared Memory)
### github
MCP server that provides persistent memory to Claude Code:
```
~/.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
$ docker run -it ghcr.io/syui/aios ai
$ sudo machinectl shell aios
# Inside container with aigpt + Claude Code
```
- https://github.com/users/syui/packages/container/package/aios
Multiple containers can share the same memory.
### link
## Architecture
- https://git.syui.ai/ai/os
- https://github.com/syui/aios
```
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
# 1. Clone repository
$ git clone https://github.com/syui/aios
$ cd aios
# 2. Run installer (creates systemd-nspawn container)
$ sudo ./aios-install.sh
# 3. Enter container
$ sudo machinectl shell aios
# 4. Start Claude Code
$ claude
# or
$ ai
```
## Container Distribution
Pre-built containers are available:
```sh
# Docker
$ docker run -it git.syui.ai/ai/os
$ docker run -it ghcr.io/syui/aios
# Podman
$ podman pull aios # using shortname alias
```
## Configuration
### Directory Structure
```
~/.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
$ pacman -S base-devel archiso docker git rust nodejs npm
$ ./build.zsh
# Creates: aios-bootstrap.tar.gz
```
## How It Works
1. **systemd-nspawn** provides lightweight containers
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.
## Why Not Just Use Claude Code?
You can! aios just provides:
- Pre-configured environment
- Shared memory (aigpt) pre-installed
- Container isolation
- Easy multi-environment setup
## Links
- Repository: https://github.com/syui/aios
- Git: https://git.syui.ai/ai/os
- aigpt: https://git.syui.ai/ai/gpt
- Container: https://git.syui.ai/ai/-/packages/container/os
## Philosophy
**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

117
build.zsh
View File

@@ -1,5 +1,5 @@
#!/bin/zsh
pacman -Syuu --noconfirm base-devel archiso docker git nodejs
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
@@ -10,11 +10,110 @@ 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'
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/
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/var/lib/machines/arch/etc/pacman.d/mirrorlist
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/var/lib/machines/arch/etc/pacman.conf
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman-key --init'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman-key --populate archlinux'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs npm docker podman bc sqlite'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d'
arch-chroot root.x86_64/var/lib/machines/arch /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/var/lib/machines/arch /bin/sh -c 'chsh -s /bin/zsh'
# Install Claude Code
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
# Copy os-release
cp -rf ./cfg/os-release root.x86_64/var/lib/machines/arch/etc/os-release
# Create default user 'ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'echo "ai:root" | chpasswd'
# Enable wheel group for sudo (specific commands without password)
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/rm -rf /var/lib/pacman/db.lck, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl" >> /etc/sudoers'
# Setup auto-login for user 'ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /etc/systemd/system/getty@tty1.service.d'
cat > root.x86_64/var/lib/machines/arch/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
cp -rf ./cfg/zshrc root.x86_64/var/lib/machines/arch/root/.zshrc
# Copy .zshrc for user 'ai'
cp -rf ./cfg/zshrc root.x86_64/var/lib/machines/arch/home/ai/.zshrc
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
# Copy aios startup script
cp -rf ./cfg/aios.zsh root.x86_64/var/lib/machines/arch/usr/local/bin/aios-startup
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chmod +x /usr/local/bin/aios-startup'
# Create default config directory and file for user 'ai'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /home/ai/.config/syui/ai/os'
cat > root.x86_64/var/lib/machines/arch/home/ai/.config/syui/ai/os/config.json <<'EOF'
{
"shell": false
}
EOF
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown -R ai:ai /home/ai/.config'
# Update .zshrc to source startup script
cat >> root.x86_64/var/lib/machines/arch/home/ai/.zshrc <<'EOF'
# aios startup
source /usr/local/bin/aios-startup
EOF
# Install aigpt (AI memory system)
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/'
# Setup Claude Code MCP configuration (shared via symlink)
# Create actual config in syui/ai/claude (bind-mounted)
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /root/.config/syui/ai/claude'
cat > root.x86_64/var/lib/machines/arch/root/.config/syui/ai/claude/claude_desktop_config.json <<'EOF'
{
"mcpServers": {
"aigpt": {
"command": "aigpt",
"args": ["server", "--enable-layer4"]
}
}
}
EOF
# Create symlink for root
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'ln -sf /root/.config/syui/ai/claude /root/.config/claude'
# Setup for ai user too
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /home/ai/.config/syui/ai/claude'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'cp /root/.config/syui/ai/claude/claude_desktop_config.json /home/ai/.config/syui/ai/claude/'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'ln -sf /home/ai/.config/syui/ai/claude /home/ai/.config/claude'
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chown -R ai:ai /home/ai/.config/syui'
# Install ai/bot (optional, for backward compatibility)
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
# Create config directory
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'mkdir -p /root/.config/syui/ai/gpt'
# Copy MCP and aios configuration
cp -rf ./cfg/mcp.json root.x86_64/var/lib/machines/arch/root/.config/syui/ai/mcp.json
cp -rf ./cfg/config.toml root.x86_64/var/lib/machines/arch/root/.config/syui/ai/config.toml
# Initialize aigpt database with WAL mode
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'aigpt server --enable-layer4 &'
sleep 2
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pkill aigpt'
arch-chroot root.x86_64/var/lib/machines/arch /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'
# Copy aios-ctl.zsh for host machine control
cp -rf ./cfg/aios-ctl.zsh root.x86_64/var/lib/machines/arch/opt/aios-ctl.zsh
# Copy install script to root for easy access
cp -rf ./cfg/install.sh ./install.sh
chmod +x ./install.sh
tar -zcvf aios-bootstrap.tar.gz root.x86_64/ install.sh

6
cfg/ai.conf Normal file
View File

@@ -0,0 +1,6 @@
# 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"

132
cfg/aios-ctl.zsh Normal file
View File

@@ -0,0 +1,132 @@
#!/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
function aios-login() {
sudo machinectl login $NAME
}
# 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 Normal file
View File

@@ -0,0 +1,38 @@
#!/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

59
cfg/config.toml Normal file
View File

@@ -0,0 +1,59 @@
# 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

View File

@@ -4,8 +4,6 @@ on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
permissions:
contents: write
@@ -28,7 +26,7 @@ jobs:
uses: actions/checkout@v4
- name: Initialize
run: |
pacman -Syuu --noconfirm base-devel archiso docker git nodejs
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
@@ -43,7 +41,9 @@ jobs:
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'
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 '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/

118
cfg/install.sh Normal file
View File

@@ -0,0 +1,118 @@
#!/bin/bash
# aios installation script
set -e
NAME="aios"
BACKUP="${NAME}back"
TARBALL="aios-bootstrap.tar.gz"
echo "=== aios installation ==="
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "Error: This script must be run as root"
exit 1
fi
# Check if tarball exists
if [ ! -f "$TARBALL" ]; then
echo "Error: $TARBALL not found"
echo "Please download aios-bootstrap.tar.gz first"
exit 1
fi
# Extract tarball
echo "1. Extracting $TARBALL..."
tar xf "$TARBALL"
# Move to /var/lib/machines/
echo "2. Installing to /var/lib/machines/$NAME..."
rm -rf /var/lib/machines/$NAME
mkdir -p /var/lib/machines
mv root.x86_64/var/lib/machines/arch /var/lib/machines/$NAME
# Copy nspawn configuration
echo "3. Installing systemd-nspawn configuration..."
mkdir -p /etc/systemd/nspawn
# Create aios.nspawn
cat > /etc/systemd/nspawn/$NAME.nspawn <<'EOF'
[Exec]
Boot=yes
PrivateUsers=pick
ResolvConf=copy-host
[Files]
Bind=/root/.config/syui/ai:/root/.config/syui/ai
[Network]
VirtualEthernet=no
EOF
# Create aiosback.nspawn
cat > /etc/systemd/nspawn/$BACKUP.nspawn <<'EOF'
[Exec]
Boot=yes
PrivateUsers=pick
ResolvConf=copy-host
[Files]
Bind=/root/.config/syui/ai:/root/.config/syui/ai
[Network]
VirtualEthernet=no
EOF
# Create workspace.nspawn
cat > /etc/systemd/nspawn/workspace.nspawn <<'EOF'
[Exec]
Boot=yes
PrivateUsers=pick
ResolvConf=copy-host
[Files]
Bind=/root/.config/syui/ai:/root/.config/syui/ai
[Network]
VirtualEthernet=no
EOF
# Create bind mount directory
mkdir -p /root/.config/syui/ai
# Enable systemd-machined
echo "4. Enabling systemd-machined..."
systemctl enable --now systemd-machined
# Create initial backup
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 ""
echo "Next steps for each user:"
echo " 1. Copy control script to your home:"
echo " cp /var/lib/machines/$NAME/opt/aios-ctl.zsh ~/.aios-ctl.zsh"
echo ""
echo " 2. Add to your .zshrc:"
echo " echo 'source ~/.aios-ctl.zsh' >> ~/.zshrc"
echo " source ~/.zshrc"
echo ""
echo " 3. Start aios:"
echo " aios-start"
echo ""
echo " 4. Login to aios:"
echo " aios-login"
echo ""
echo "Available commands:"
echo " aios-start, aios-stop, aios-shell, aios-login"
echo " aios-backup, aios-reset, aios-update"
echo " aios-help for full list"
echo ""

12
cfg/mcp.json Normal file
View File

@@ -0,0 +1,12 @@
{
"mcpServers": {
"aigpt": {
"command": "aigpt",
"args": ["server", "--enable-layer4"],
"env": {
"AIGPT_DB": "/root/.config/syui/ai/gpt/memory.db"
},
"description": "AI memory and personality system"
}
}
}

15
cfg/nspawn/aios.nspawn Normal file
View File

@@ -0,0 +1,15 @@
# 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

View File

@@ -1,10 +1,14 @@
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
IMAGE_ID=aios
IMAGE_VERSION=2024.02.11
NAME=ai os
PRETTY_NAME=ai os
NAME=aios
PRETTY_NAME=aios
ID=ai
ID_LIKE=arch
VERSION_ID=2024.11
VERSION="2024.11 (Rolling)"
VERSION_CODENAME=rolling
BUILD_ID=rolling
IMAGE_ID=aios
IMAGE_VERSION=2024.11.06
ANSI_COLOR="38;2;23;147;209"
HOME_URL=https://git.syui.ai/ai/os
DOCUMENTATION_URL=https://git.syui.ai/ai/os/wiki
SUPPORT_URL=https://git.syui.ai/ai/os/issues

View File

@@ -3,8 +3,8 @@
iso_name="aios"
iso_label="AI_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
iso_publisher="ai os <https://git.syui.ai/ai/os>"
iso_application="ai os Live/Rescue DVD"
iso_publisher="aios <https://git.syui.ai/ai/os>"
iso_application="aios Live/Rescue DVD"
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
install_dir="ai"
#buildmodes=('iso')

40
cfg/zshrc Normal file
View File

@@ -0,0 +1,40 @@
# 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 ai='claude'
alias c='claude'
# 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 ""

View File

@@ -9,8 +9,6 @@ on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
permissions:
contents: write
@@ -69,3 +67,5 @@ echo '#!/bin/zsh' >! $dd/build.zsh
echo $yml_b >> $dd/build.zsh
cat $dd/build.zsh
cp -rf $dd/cfg/gh-actions.yml $dd/.github/workflows/release.yml

9
scpt/img.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/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/ .

44
scpt/install.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/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