deb-packs/zellij/package.sh

86 lines
1.9 KiB
Bash
Raw Normal View History

2023-08-02 18:02:08 +08:00
#!/bin/bash
app_name="zellij"
tmp_dir="/tmp/${app_name}_tmp"
version="0.37.2"
release="v${version}"
deb_url="https://github.com/zellij-org/zellij/releases/download/${release}/zellij-x86_64-unknown-linux-musl.tar.gz"
# 创建临时目录, 用于下载官方包
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/share/applications"
echo "下载官方原包..."
wget $deb_url -O "${tmp_dir}/zellij-x86_64.tar.gz"
echo "下载完成, 解包中..."
tar -xvf "${tmp_dir}/zellij-x86_64.tar.gz" -C $tmp_dir
echo "解包完成, 复制到待打包目录..."
mv ${tmp_dir}/zellij "./unpack/usr/bin/"
rm -rf $tmp_dir
echo "复制完成, 计算文件md5..."
cd ./unpack
echo """
[Desktop Entry]
Version=1.0
Name=Zellij
Type=Application
Comment=Manage Your Terminal Applications
Terminal=true
Exec=zellij
Icon=zellij
Categories=ConsoleOnly;System;
GenericName=Terminal Multiplexer
""" > usr/share/applications/zellij.desktop
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: amd64
Maintainer: Yutent <yutent.io@gmail.com>
Priority: optional
Homepage: https://zellij.dev/
Description: A terminal workspace with batteries included.
Zellij is a workspace aimed at developers, ops-oriented people and anyone who loves the terminal. Similar programs are sometimes called "Terminal Multiplexers".
""" > DEBIAN/control
echo '计算文件md5完成, 打包中...'
cd ..
sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
echo "打包完成 :)"