添加docker同步脚本

master
yutent 2024-12-14 15:21:21 +08:00
parent 1f1c31be5a
commit e9339926cf
1 changed files with 97 additions and 0 deletions

97
docker/package.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/bash
base_url="https://download.docker.com/linux/debian/dists/bookworm/pool/stable"
deb_arch="amd64"
if [ "$1" == "arm" ]; then
deb_arch="arm64"
fi
if [ "$1" == "pack" ]; then
# 不一定有, 只有amd64有这个包
if [ -d "docker-scan-plugin" ]; then
apt deb docker-scan-plugin
sudo rm -rf docker-scan-plugin
fi
apt deb docker-buildx-plugin
apt deb docker-ce-cli
apt deb docker-ce-rootless-extras
apt deb docker-ce
apt deb docker-compose-plugin
sudo rm -rf docker-buildx-plugin
sudo rm -rf docker-ce-cli
sudo rm -rf docker-ce-rootless-extras
sudo rm -rf docker-ce
sudo rm -rf docker-compose-plugin
echo "全部打包完成 :)"
else
if [ "$deb_arch" == "amd64" ] || [ "$deb_arch" == "arm64" ]; then
# 下载原包
echo "下载原包..."
wget "${base_url}/${deb_arch}/containerd.io_1.7.24-1_${deb_arch}.deb" -O containerd.io.deb
wget "${base_url}/${deb_arch}/docker-buildx-plugin_0.19.2-1~debian.12~bookworm_${deb_arch}.deb" -O docker-buildx-plugin.deb
wget "${base_url}/${deb_arch}/docker-ce-cli_27.4.0-1~debian.12~bookworm_${deb_arch}.deb" -O docker-ce-cli.deb
wget "${base_url}/${deb_arch}/docker-ce-rootless-extras_27.4.0-1~debian.12~bookworm_${deb_arch}.deb" -O docker-ce-rootless-extras.deb
wget "${base_url}/${deb_arch}/docker-ce_27.4.0-1~debian.12~bookworm_${deb_arch}.deb" -O docker-ce.deb
wget "${base_url}/${deb_arch}/docker-compose-plugin_2.31.0-1~debian.12~bookworm_${deb_arch}.deb" -O docker-compose-plugin.deb
if [ "$deb_arch" == "amd64" ]; then
wget "${base_url}/${deb_arch}/docker-scan-plugin_0.23.0~debian-bookworm_${deb_arch}.deb" -O docker-scan-plugin.deb
fi
echo "完成^_^"
echo ""
# 解包
echo "解包..."
if [ "$deb_arch" == "amd64" ]; then
apt deb docker-scan-plugin.deb
fi
apt deb docker-buildx-plugin.deb
apt deb docker-ce-cli.deb
apt deb docker-ce-rootless-extras.deb
apt deb docker-ce.deb
apt deb docker-compose-plugin.deb
echo "完成^_^"
echo ""
# 移除旧包
echo "移除旧包..."
if [ "$deb_arch" == "amd64" ]; then
rm -v docker-scan-plugin.deb
fi
rm -v docker-buildx-plugin.deb
rm -v docker-ce-cli.deb
rm -v docker-ce-rootless-extras.deb
rm -v docker-ce.deb
rm -v docker-compose-plugin.deb
echo "完成^_^"
echo ""
echo "修改打包人信息..."
if [ "$deb_arch" == "amd64" ]; then
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-scan-plugin/DEBIAN/control
fi
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-buildx-plugin/DEBIAN/control
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-ce-cli/DEBIAN/control
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-ce-rootless-extras/DEBIAN/control
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-ce/DEBIAN/control
sed -i "s/Docker <support@docker.com>/Yutent <yutent.io@gmail.com>/" docker-compose-plugin/DEBIAN/control
echo "完成^_^"
echo "手动调整版本号, 然后执行打包命令"
fi
fi