add gitea
parent
be17da886f
commit
a3fbccd104
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
|
||||
app_name="gitea"
|
||||
tmp_dir="/tmp/${app_name}_tmp"
|
||||
version="1.22"
|
||||
release="v${version}"
|
||||
deb_arch="amd64"
|
||||
|
||||
if [ "$1" == "arm" ]; then
|
||||
deb_arch="arm64"
|
||||
fi
|
||||
|
||||
|
||||
deb_url="https://dl.gitea.com/gitea/${version}/gitea-${version}-linux-${deb_arch}.xz"
|
||||
|
||||
# 创建临时目录, 用于下载官方包
|
||||
if [ -d $tmp_dir ]; then
|
||||
rm -rf $tmp_dir
|
||||
fi
|
||||
|
||||
if [ -d "./unpack" ]; then
|
||||
sudo rm -rf ./unpack
|
||||
fi
|
||||
|
||||
if [ -f "./${app_name}_${version}.deb" ]; then
|
||||
rm "./${app_name}_${version}.deb"
|
||||
fi
|
||||
|
||||
mkdir $tmp_dir
|
||||
|
||||
# 创建临时待打包目录
|
||||
echo "创建待打包目录..."
|
||||
mkdir -p "./unpack/DEBIAN"
|
||||
mkdir -p "./unpack/usr/bin"
|
||||
mkdir -p "./unpack/usr/lib/systemd/system"
|
||||
mkdir -p "./unpack/usr/share/licenses/gitea"
|
||||
mkdir -p "./unpack/etc/gitea/"
|
||||
|
||||
|
||||
echo "下载官方原包..."
|
||||
wget $deb_url -O "${tmp_dir}/gitea-${deb_arch}.xz"
|
||||
# cp ~/Downloads/gitea-1.22-linux-amd64.xz "${tmp_dir}/gitea-${deb_arch}.xz"
|
||||
|
||||
|
||||
echo "下载完成, 解包中..."
|
||||
xz -dc "${tmp_dir}/gitea-${deb_arch}.xz" > "${tmp_dir}/gitea"
|
||||
|
||||
echo "解包完成, 复制到待打包目录..."
|
||||
mv ${tmp_dir}/gitea ./unpack/usr/bin/
|
||||
|
||||
chmod +x ./unpack/usr/bin/gitea
|
||||
|
||||
echo "下载service文件和协议文件"
|
||||
wget "https://raw.githubusercontent.com/go-gitea/gitea/release/${release}/contrib/systemd/gitea.service" -O ./unpack/usr/lib/systemd/system/gitea.service
|
||||
wget https://raw.githubusercontent.com/go-gitea/gitea/main/LICENSE -O ./unpack/usr/share/licenses/gitea/LICENSE
|
||||
wget h"ttps://raw.githubusercontent.com/go-gitea/gitea/release/${release}/custom/conf/app.example.ini" -O ./unpack/etc/gitea/app.example.ini
|
||||
|
||||
rm -rf $tmp_dir
|
||||
|
||||
echo "复制完成, 计算文件md5..."
|
||||
|
||||
cd ./unpack
|
||||
|
||||
find usr/ -type f | xargs md5sum > DEBIAN/md5sums
|
||||
|
||||
IFS=$'\t' read -ra size <<< "$(du -d 0)"
|
||||
|
||||
echo """
|
||||
Package: ${app_name}
|
||||
Version: ${version}
|
||||
Section: devlop
|
||||
Installed-Size: ${size[0]}
|
||||
Architecture: ${deb_arch}
|
||||
Maintainer: Yutent <yutent.io@gmail.com>
|
||||
Depends: git
|
||||
Priority: extra
|
||||
Homepage: https://gitea.io/zh-cn/
|
||||
Description: Gitea 是一个开源社区驱动的轻量级代码托管解决方案,后端采用 Go 编写。
|
||||
|
||||
""" > DEBIAN/control
|
||||
|
||||
echo '计算文件md5完成, 打包中...'
|
||||
|
||||
cd ..
|
||||
sudo chown -R root:root unpack
|
||||
|
||||
dpkg-deb -b ./unpack "./${app_name}-${deb_arch}_${version}.deb"
|
||||
|
||||
sudo rm -rf ./unpack
|
||||
echo "打包完成 :)"
|
Loading…
Reference in New Issue