diff --git a/.gitignore b/.gitignore index ff8707e..591b7bd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ root.x86_64/ archiso/ build.log .claude -/cfg/repo.sh +/.env diff --git a/build.zsh b/build.zsh index 5ed992b..98e0945 100755 --- a/build.zsh +++ b/build.zsh @@ -26,7 +26,7 @@ sed -i 's/CheckSpace/#CheckSpace/' $ROOTFS/etc/pacman.conf sed -i '/\[options\]/a NoUpgrade = etc/os-release' $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 clang openssh jq nodejs npm zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search' +arch-chroot $ROOTFS /bin/sh -c 'pacman -Syu --noconfirm base-devel vim git zsh rust clang openssh jq nodejs npm zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search jq' if [[ "$BUILD_MODE" == "image" ]]; then arch-chroot $ROOTFS /bin/sh -c 'pacman -S --noconfirm linux linux-firmware mkinitcpio' diff --git a/cfg/repo.sh b/cfg/repo.sh new file mode 100755 index 0000000..3df2d42 --- /dev/null +++ b/cfg/repo.sh @@ -0,0 +1,74 @@ +#!/bin/zsh +set -e + +d=${0:a:h:h} +source $d/.env + +echo "=== Building and publishing packages on $HOST ===" +ssh "$HOST" zsh -s -- "$GPG_KEY" <<'REMOTE' +set -e +setopt nonomatch 2>/dev/null || true +GPG_KEY="$1" +REPO_NAME="aios" +REPO_DIR="${HOME}/ai/repo" +WORK="${HOME}/aios-pkg" + +if [ ! -d "$REPO_DIR/.git" ]; then + git clone git@git.syui.ai:ai/repo.git "$REPO_DIR" + cd "$REPO_DIR" + git config user.email 'syui@syui.ai' + git config user.name 'syui' +fi + +cd "$REPO_DIR" +git config user.signingkey "$GPG_KEY" +git config commit.gpgsign true + +rm -rf "$WORK" +mkdir -p "$WORK" + +cd "$WORK" +git clone --depth 1 https://git.syui.ai/ai/os.git + +for pkg in ailog aigpt aishell; do + echo "=== Building $pkg ===" + cp -r "$WORK/os/pkg/$pkg" "$WORK/$pkg" + cd "$WORK/$pkg" + makepkg -sf --noconfirm --sign --key "$GPG_KEY" + cd "$WORK" +done + +mkdir -p "$REPO_DIR/x86_64" + +for pkg in ailog aigpt aishell; do + rm -f "$REPO_DIR/x86_64/${pkg}"-*.pkg.tar.zst + rm -f "$REPO_DIR/x86_64/${pkg}"-*.pkg.tar.zst.sig + rm -f "$REPO_DIR/x86_64/${pkg}-debug"-*.pkg.tar.zst + rm -f "$REPO_DIR/x86_64/${pkg}-debug"-*.pkg.tar.zst.sig + cp "$WORK"/"$pkg"/*.pkg.tar.zst "$REPO_DIR/x86_64/" + cp "$WORK"/"$pkg"/*.pkg.tar.zst.sig "$REPO_DIR/x86_64/" 2>/dev/null || true +done + +cd "$REPO_DIR/x86_64" +rm -f "${REPO_NAME}".{db,files}* +repo-add --sign --key "$GPG_KEY" "${REPO_NAME}.db.tar.gz" *.pkg.tar.zst +gpg --export "$GPG_KEY" > "$REPO_DIR/aios.gpg" + +for f in "${REPO_NAME}.db" "${REPO_NAME}.files" "${REPO_NAME}.db.sig" "${REPO_NAME}.files.sig"; do + if [ -L "$f" ]; then + target=$(readlink "$f") + rm "$f" + cp "$target" "$f" + fi +done +rm -f *.old *.old.sig + +cd "$REPO_DIR" +git add -A +git commit -m "update $(date +%Y.%m.%d)" || true +git push + +rm -rf "$WORK" + +echo "=== Done ===" +REMOTE diff --git a/pkg/aigpt/PKGBUILD b/pkg/aigpt/PKGBUILD index 51d5cb0..a75f5c7 100644 --- a/pkg/aigpt/PKGBUILD +++ b/pkg/aigpt/PKGBUILD @@ -1,16 +1,25 @@ pkgname=aigpt pkgver=0.0.1 pkgrel=1 + pkgdesc='ai memory and personality system for aios' arch=('x86_64') url='https://git.syui.ai/ai/gpt' license=('MIT') depends=('gcc-libs') makedepends=('rust' 'cargo' 'git') -options=('!lto') +options=('!lto' '!debug') source=("git+https://git.syui.ai/ai/gpt.git#branch=main") sha256sums=('SKIP') +pkgver() { + cd gpt + printf "%s.r%s.g%s" \ + "$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')" \ + "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short HEAD)" +} + build() { cd gpt export CC=gcc diff --git a/pkg/ailog/PKGBUILD b/pkg/ailog/PKGBUILD index c2f0fb3..596d92e 100644 --- a/pkg/ailog/PKGBUILD +++ b/pkg/ailog/PKGBUILD @@ -1,16 +1,25 @@ pkgname=ailog pkgver=0.0.1 pkgrel=1 + pkgdesc='atproto blog cli for aios' arch=('x86_64') url='https://git.syui.ai/ai/log' license=('MIT') depends=('gcc-libs') makedepends=('rust' 'cargo' 'git') -options=('!lto') +options=('!lto' '!debug') source=("git+https://git.syui.ai/ai/log.git#branch=main") sha256sums=('SKIP') +pkgver() { + cd log + printf "%s.r%s.g%s" \ + "$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')" \ + "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short HEAD)" +} + build() { cd log export CC=gcc diff --git a/pkg/aishell/PKGBUILD b/pkg/aishell/PKGBUILD index 235b031..5da9b20 100644 --- a/pkg/aishell/PKGBUILD +++ b/pkg/aishell/PKGBUILD @@ -1,16 +1,25 @@ pkgname=aishell pkgver=0.0.1 pkgrel=1 + pkgdesc='custom shell for aios' arch=('x86_64') url='https://git.syui.ai/ai/shell' license=('MIT') depends=('gcc-libs') makedepends=('rust' 'cargo' 'git') -options=('!lto') +options=('!lto' '!debug') source=("git+https://git.syui.ai/ai/shell.git#branch=main") sha256sums=('SKIP') +pkgver() { + cd shell + printf "%s.r%s.g%s" \ + "$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')" \ + "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short HEAD)" +} + build() { cd shell export CC=gcc