deb

Ling Yu
Ling Yu

Deb制作

dpkg-deb --build --root-owner-group <deb-dir> <name>.deb
 
du -ks usr | cut -f 1
du -ks * | grep -v DEBIAN | cut -f1 | xargs | sed -e 's/\ /+/g' | bc
size=$(du -ks * | grep -v DEBIAN | cut -f1 | xargs | sed -e 's/\ /+/g' | bc); sed -ri "s/^Installed-Size.*$/Installed-Size: $size/g" ./DEBIAN/control
ar t <name>.deb
#ar tv <name>.deb
tar -xf control.tar.xz -C DEBIAN/ tar -xf data.tar.xz

Deb源搭建

cd /opt/debian-deb
# 生成 Packages 文件(注意路径匹配)
apt-ftparchive --arch amd64 packages pool/main > dists/bookworm/main/binary-amd64/Packages
# 压缩为 Packages.gz
gzip -k -f dists/bookworm/main/binary-amd64/Packages
apt-ftparchive -c bookworm.conf release dists/bookworm > dists/bookworm/Release
gpg --default-key [email protected] -abs -o Release.gpg Release
gpg --default-key [email protected] --clearsign -o InRelease Release
 
gpg --armor --export [email protected] > /opt/debian-deb/science4ai.asc

写入/etc/apt/sources.list.d/science4ai.sources

Types: deb
URIs: https://106.54.212.228
Suites: bookworm
Components: main
Signed-By: /etc/apt/keyrings/science4ai.asc
Architectures: amd64
curl -LsSf https://106.54.212.228/science4ai.asc -o /etc/apt/keyrings/science4ai.asc
wget -qO - https://106.54.212.228/science4ai.asc | sudo tee /etc/apt/keyrings/science4ai.asc
apt update

写入update-repo.sh

#!/bin/bash
REPO_ROOT="/opt/debian-deb"
 
cd $REPO_ROOT
apt-ftparchive --arch amd64 packages pool/main > dists/bookworm/main/binary-amd64/Packages
gzip -k -f dists/bookworm/main/binary-amd64/Packages
apt-ftparchive -c bookworm.conf release dists/bookworm > dists/bookworm/Release
 
cd dists/bookworm
gpg --default-key [email protected] -abs -o Release.gpg Release
gpg --default-key [email protected] --clearsign -o InRelease Release
chmod +x update-repo.sh