Compare commits
2 Commits
7bb8e0cd14
...
93c603e417
| Author | SHA1 | Date | |
|---|---|---|---|
|
93c603e417
|
|||
|
c31240ec37
|
56
build.zsh
Executable file
56
build.zsh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/zsh
|
||||
|
||||
set -e
|
||||
|
||||
ROOTFS="root.x86_64"
|
||||
OUTPUT="aios.tar.gz"
|
||||
BUILD_DATE=$(date +%Y.%m.%d)
|
||||
|
||||
echo "=== aios build $BUILD_DATE ==="
|
||||
|
||||
rm -rf $ROOTFS
|
||||
rm -f $OUTPUT
|
||||
mkdir -p $ROOTFS
|
||||
|
||||
pacstrap -c $ROOTFS base
|
||||
|
||||
echo 'Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
|
||||
Server = http://mirrors.cat.net/archlinux/$repo/os/$arch' > $ROOTFS/etc/pacman.d/mirrorlist
|
||||
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 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 '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
|
||||
|
||||
mkdir -p $ROOTFS/etc/systemd/system/console-getty.service.d
|
||||
cat > $ROOTFS/etc/systemd/system/console-getty.service.d/override.conf <<'EOF'
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/usr/bin/agetty --autologin ai --noclear --keep-baud console 115200,38400,9600 $TERM
|
||||
EOF
|
||||
|
||||
cp cfg/zshrc $ROOTFS/home/ai/.zshrc
|
||||
arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
|
||||
|
||||
cat > $ROOTFS/etc/os-release <<EOF
|
||||
NAME=aios
|
||||
PRETTY_NAME=aios
|
||||
ID=ai
|
||||
ID_LIKE=arch
|
||||
BUILD_ID=rolling
|
||||
IMAGE_ID=aios
|
||||
IMAGE_VERSION=$BUILD_DATE
|
||||
HOME_URL=https://git.syui.ai/ai/os
|
||||
EOF
|
||||
|
||||
echo "aios" > $ROOTFS/etc/hostname
|
||||
|
||||
tar czf $OUTPUT -C $ROOTFS .
|
||||
|
||||
echo "=== build complete: $OUTPUT ==="
|
||||
5
cfg/aios.nspawn
Normal file
5
cfg/aios.nspawn
Normal file
@@ -0,0 +1,5 @@
|
||||
[Exec]
|
||||
Boot=yes
|
||||
|
||||
[Network]
|
||||
Private=no
|
||||
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
|
||||
'
|
||||
23
cfg/zshrc
Normal file
23
cfg/zshrc
Normal file
@@ -0,0 +1,23 @@
|
||||
export PATH=$HOME/.cargo/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 c='claude --dangerously-skip-permissions'
|
||||
|
||||
autoload -Uz 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
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
HISTFILE=~/.zsh_history
|
||||
setopt SHARE_HISTORY
|
||||
setopt HIST_IGNORE_DUPS
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
Reference in New Issue
Block a user