refactor: Simplify install.sh and rename arch to aios throughout
- Simplified install.sh to just extract and mv - Renamed root.x86_64/var/lib/machines/arch to aios - Updated all references in build.zsh, setup-user.sh, setup-claude.sh
This commit is contained in:
34
build.zsh
34
build.zsh
@@ -35,45 +35,45 @@ cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
|
|||||||
|
|
||||||
# Extract and prepare
|
# Extract and prepare
|
||||||
tar xf aios-bootstrap*.tar.gz
|
tar xf aios-bootstrap*.tar.gz
|
||||||
mkdir -p root.x86_64/var/lib/machines/arch
|
mkdir -p root.x86_64/var/lib/machines/aios
|
||||||
pacstrap -c root.x86_64/var/lib/machines/arch base
|
pacstrap -c root.x86_64/var/lib/machines/aios base
|
||||||
|
|
||||||
# Configure pacman
|
# 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/var/lib/machines/arch/etc/pacman.d/mirrorlist
|
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/arch/etc/pacman.conf
|
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/var/lib/machines/aios/etc/pacman.conf
|
||||||
|
|
||||||
# Initialize pacman keys
|
# Initialize pacman keys
|
||||||
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'pacman-key --init'
|
arch-chroot root.x86_64/var/lib/machines/aios /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/aios /bin/sh -c 'pacman-key --populate archlinux'
|
||||||
|
|
||||||
# Install base packages (including systemd-container for machinectl)
|
# Install base packages (including systemd-container for machinectl)
|
||||||
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 systemd arch-install-scripts'
|
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'
|
||||||
|
|
||||||
# Configure containers
|
# Configure containers
|
||||||
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/aios /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/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'
|
||||||
|
|
||||||
# Set default shell
|
# Set default shell
|
||||||
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'chsh -s /bin/zsh'
|
arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'chsh -s /bin/zsh'
|
||||||
|
|
||||||
# Install Claude Code
|
# Install Claude Code
|
||||||
arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
|
arch-chroot root.x86_64/var/lib/machines/aios /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
|
||||||
|
|
||||||
# Copy os-release
|
# Copy os-release
|
||||||
cp -rf ./cfg/os-release root.x86_64/var/lib/machines/arch/etc/os-release
|
cp -rf ./cfg/os-release root.x86_64/var/lib/machines/aios/etc/os-release
|
||||||
|
|
||||||
# Configure sudoers for wheel group
|
# Configure sudoers for wheel group
|
||||||
echo "Configuring sudoers..."
|
echo "Configuring sudoers..."
|
||||||
arch-chroot root.x86_64/var/lib/machines/arch /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/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'
|
||||||
|
|
||||||
# Install aigpt (aios core package)
|
# Install aigpt (aios core package)
|
||||||
echo "Installing aigpt..."
|
echo "Installing aigpt..."
|
||||||
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/aios /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)
|
# Install aibot (aios core package)
|
||||||
echo "Installing aibot..."
|
echo "Installing aibot..."
|
||||||
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/aibot /bin/ && aibot ai'
|
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'
|
||||||
|
|
||||||
echo "✓ Arch Linux base complete"
|
echo "✓ Arch Linux base complete"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -99,11 +99,11 @@ echo ""
|
|||||||
echo "=== Finalizing ==="
|
echo "=== Finalizing ==="
|
||||||
|
|
||||||
# Copy aios-ctl.zsh for host machine control
|
# 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
|
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)
|
# Prepare directory for child containers (ai user will create them as needed)
|
||||||
echo "Preparing directory for child containers..."
|
echo "Preparing directory for child containers..."
|
||||||
mkdir -p root.x86_64/var/lib/machines/arch/var/lib/machines
|
mkdir -p root.x86_64/var/lib/machines/aios/var/lib/machines
|
||||||
|
|
||||||
# Copy install script
|
# Copy install script
|
||||||
cp -rf ./cfg/install.sh ./install.sh
|
cp -rf ./cfg/install.sh ./install.sh
|
||||||
|
|||||||
@@ -1,81 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# aios installation script
|
# aios installation script
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
NAME="aios"
|
NAME="aios"
|
||||||
TARBALL="aios-bootstrap.tar.gz"
|
TARBALL="aios-bootstrap.tar.gz"
|
||||||
|
|
||||||
echo "=== aios installation ==="
|
echo "=== aios installation ==="
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Check if running as root
|
# Extract and install
|
||||||
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"
|
tar xf "$TARBALL"
|
||||||
|
|
||||||
# Install aios (base container)
|
|
||||||
echo "2. Installing aios to /var/lib/machines/..."
|
|
||||||
rm -rf /var/lib/machines/$NAME
|
|
||||||
mkdir -p /var/lib/machines
|
mkdir -p /var/lib/machines
|
||||||
mv root.x86_64/var/lib/machines/arch /var/lib/machines/$NAME
|
mv root.x86_64/var/lib/machines/aios /var/lib/machines/$NAME
|
||||||
|
|
||||||
# Copy nspawn configuration
|
|
||||||
echo "3. Installing systemd-nspawn configuration..."
|
|
||||||
mkdir -p /etc/systemd/nspawn
|
|
||||||
|
|
||||||
# Create aios.nspawn (only one container needed)
|
|
||||||
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 bind mount directory
|
|
||||||
mkdir -p /root/.config/syui/ai
|
|
||||||
|
|
||||||
# Enable systemd-machined
|
|
||||||
echo "4. Enabling systemd-machined..."
|
|
||||||
systemctl enable --now systemd-machined
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "=== Installation complete ==="
|
echo "=== Installation complete ==="
|
||||||
echo ""
|
echo ""
|
||||||
echo "Next steps for each user:"
|
echo "Usage:"
|
||||||
echo " 1. Copy control script to your home:"
|
echo " sudo machinectl start $NAME"
|
||||||
echo " cp /var/lib/machines/$NAME/opt/aios-ctl.zsh ~/.aios-ctl.zsh"
|
echo " sudo machinectl shell $NAME /bin/su - ai"
|
||||||
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 ""
|
echo ""
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Claude Code MCP setup for aios
|
# Claude Code MCP setup for aios
|
||||||
# Configures MCP, sets up shared memory
|
# Configures MCP, sets up shared memory
|
||||||
|
|
||||||
ROOTFS="root.x86_64/var/lib/machines/arch"
|
ROOTFS="root.x86_64/var/lib/machines/aios"
|
||||||
|
|
||||||
echo "=== Claude MCP Setup ==="
|
echo "=== Claude MCP Setup ==="
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# User setup for aios
|
# User setup for aios
|
||||||
# Creates ai user, configures auto-login, sudo, zshrc
|
# Creates ai user, configures auto-login, sudo, zshrc
|
||||||
|
|
||||||
ROOTFS="root.x86_64/var/lib/machines/arch"
|
ROOTFS="root.x86_64/var/lib/machines/aios"
|
||||||
|
|
||||||
echo "=== User Setup ==="
|
echo "=== User Setup ==="
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user