diff --git a/.gitignore b/.gitignore index 2af4337..ed6daf4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,9 @@ -.config/ai +/.config/ai +/claude.md +/CLAUDE.md **.DS_Store - -# Build artifacts aios-bootstrap*.tar.gz root.x86_64/ archiso/ -install.sh build.log -/claude.md -/CLAUDE.md .claude diff --git a/build.zsh b/build.zsh index b295aac..9383633 100755 --- a/build.zsh +++ b/build.zsh @@ -19,9 +19,12 @@ Server = http://mirrors.cat.net/archlinux/$repo/os/$arch' > $ROOTFS/etc/pacman.d sed -i 's/CheckSpace/#CheckSpace/' $ROOTFS/etc/pacman.conf arch-chroot $ROOTFS /bin/sh -c 'pacman-key --init && pacman-key --populate archlinux' -arch-chroot $ROOTFS /bin/sh -c 'pacman -Syu --noconfirm base-devel vim git zsh rust openssh jq nodejs npm' +arch-chroot $ROOTFS /bin/sh -c 'pacman -Syu --noconfirm base-devel vim git zsh rust openssh jq nodejs npm zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search' arch-chroot $ROOTFS /bin/sh -c 'npm i -g @anthropic-ai/claude-code' +bash cfg/pkg.sh $ROOTFS + +arch-chroot $ROOTFS /bin/sh -c 'chsh -s /bin/zsh' arch-chroot $ROOTFS /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai' arch-chroot $ROOTFS /bin/sh -c 'echo "ai:ai" | chpasswd' echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> $ROOTFS/etc/sudoers @@ -36,6 +39,10 @@ EOF cp cfg/zshrc $ROOTFS/home/ai/.zshrc arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /home/ai/.zshrc' +mkdir -p $ROOTFS/home/ai/.config/claude +cp cfg/mcp.json $ROOTFS/home/ai/.config/claude/mcp.json +arch-chroot $ROOTFS /bin/sh -c 'chown -R ai:ai /home/ai/.config' + cat > $ROOTFS/etc/os-release </dev/null; then + exec aishell +fi diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..0300444 --- /dev/null +++ b/install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +NAME="aios" +TARBALL="aios.tar.gz" +DEST="/var/lib/machines/$NAME" + +if [[ ! -f "$TARBALL" ]]; then + echo "error: $TARBALL not found" + exit 1 +fi + +echo "=== aios install ===" + +mkdir -p "$DEST" +tar xzf "$TARBALL" -C "$DEST" + +mkdir -p /etc/systemd/nspawn +cp cfg/aios.nspawn /etc/systemd/nspawn/$NAME.nspawn + +echo "=== install complete ===" +echo "" +echo " sudo machinectl start $NAME" +echo " sudo machinectl shell $NAME /bin/su - ai" diff --git a/old/cfg/install.sh b/old/cfg/install.sh new file mode 100644 index 0000000..d86ff55 --- /dev/null +++ b/old/cfg/install.sh @@ -0,0 +1,30 @@ +#!/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 "" diff --git a/old/scpt/install.sh b/old/scpt/install.sh new file mode 100644 index 0000000..1e026bf --- /dev/null +++ b/old/scpt/install.sh @@ -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