add pkg
This commit is contained in:
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,12 +1,9 @@
|
|||||||
.config/ai
|
/.config/ai
|
||||||
|
/claude.md
|
||||||
|
/CLAUDE.md
|
||||||
**.DS_Store
|
**.DS_Store
|
||||||
|
|
||||||
# Build artifacts
|
|
||||||
aios-bootstrap*.tar.gz
|
aios-bootstrap*.tar.gz
|
||||||
root.x86_64/
|
root.x86_64/
|
||||||
archiso/
|
archiso/
|
||||||
install.sh
|
|
||||||
build.log
|
build.log
|
||||||
/claude.md
|
|
||||||
/CLAUDE.md
|
|
||||||
.claude
|
.claude
|
||||||
|
|||||||
@@ -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
|
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-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'
|
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 'useradd -m -G wheel -s /bin/zsh ai'
|
||||||
arch-chroot $ROOTFS /bin/sh -c 'echo "ai:ai" | chpasswd'
|
arch-chroot $ROOTFS /bin/sh -c 'echo "ai:ai" | chpasswd'
|
||||||
echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> $ROOTFS/etc/sudoers
|
echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> $ROOTFS/etc/sudoers
|
||||||
@@ -36,6 +39,10 @@ EOF
|
|||||||
cp cfg/zshrc $ROOTFS/home/ai/.zshrc
|
cp cfg/zshrc $ROOTFS/home/ai/.zshrc
|
||||||
arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /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 <<EOF
|
cat > $ROOTFS/etc/os-release <<EOF
|
||||||
NAME=aios
|
NAME=aios
|
||||||
PRETTY_NAME=aios
|
PRETTY_NAME=aios
|
||||||
|
|||||||
17
cfg/mcp.json
Normal file
17
cfg/mcp.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"aigpt": {
|
||||||
|
"command": "aigpt",
|
||||||
|
"args": ["server"],
|
||||||
|
"env": {}
|
||||||
|
},
|
||||||
|
"ailog": {
|
||||||
|
"command": "ailog",
|
||||||
|
"args": ["mcp"],
|
||||||
|
"env": {
|
||||||
|
"CHAT_SYSTEM_FILE": "/home/ai/.config/aigpt/core.md",
|
||||||
|
"CHAT_OUTPUT": "/home/ai/log/public/content"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
cfg/pkg.sh
Executable file
13
cfg/pkg.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ROOTFS="$1"
|
||||||
|
|
||||||
|
arch-chroot $ROOTFS /bin/sh -c '
|
||||||
|
cd /tmp
|
||||||
|
git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp target/release/aigpt /usr/local/bin/ && cd ..
|
||||||
|
git clone https://git.syui.ai/ai/log && cd log && cargo build --release && cp target/release/ailog /usr/local/bin/ && cd ..
|
||||||
|
git clone https://git.syui.ai/ai/shell && cd shell && cargo build --release && cp target/release/aishell /usr/local/bin/ && cd ..
|
||||||
|
rm -rf gpt log shell
|
||||||
|
'
|
||||||
25
cfg/zshrc
25
cfg/zshrc
@@ -1,14 +1,27 @@
|
|||||||
export EDITOR=vim
|
export PATH=$HOME/.cargo/bin:$PATH
|
||||||
export LANG=en_US.UTF-8
|
|
||||||
export PATH=$HOME/.local/bin:$PATH
|
|
||||||
|
|
||||||
|
alias u="sudo pacman -Syu --noconfirm"
|
||||||
|
alias zs="vim ~/.zshrc"
|
||||||
|
alias zr="exec $SHELL && source ~/.zshrc"
|
||||||
alias claude='claude --dangerously-skip-permissions'
|
alias claude='claude --dangerously-skip-permissions'
|
||||||
alias c='claude --dangerously-skip-permissions'
|
alias c='claude --dangerously-skip-permissions'
|
||||||
|
|
||||||
autoload -Uz promptinit && promptinit && prompt adam1
|
autoload -Uz compinit
|
||||||
autoload -Uz compinit && compinit
|
compinit
|
||||||
|
fpath=(/usr/share/zsh/site-functions $fpath)
|
||||||
|
|
||||||
|
#source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||||
|
|
||||||
HISTFILE=~/.zsh_history
|
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
setopt SHARE_HISTORY
|
setopt SHARE_HISTORY
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
bindkey '^[[A' history-substring-search-up
|
||||||
|
bindkey '^[[B' history-substring-search-down
|
||||||
|
|
||||||
|
if [[ -o login ]] && [[ -o interactive ]] && command -v aishell &>/dev/null; then
|
||||||
|
exec aishell
|
||||||
|
fi
|
||||||
|
|||||||
25
install.sh
Executable file
25
install.sh
Executable file
@@ -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"
|
||||||
30
old/cfg/install.sh
Normal file
30
old/cfg/install.sh
Normal file
@@ -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 ""
|
||||||
44
old/scpt/install.sh
Normal file
44
old/scpt/install.sh
Normal 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
|
||||||
Reference in New Issue
Block a user