From 23689737c7cb9180ab95f48e43cd43554278e4a8 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 3 Dec 2024 14:54:23 +0800 Subject: [PATCH] add dunst --- dunst/package.sh | 115 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100755 dunst/package.sh diff --git a/dunst/package.sh b/dunst/package.sh new file mode 100755 index 0000000..a5d8db1 --- /dev/null +++ b/dunst/package.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +app_name="dunst" +version="1.12.0" +release="v${version}" +pkg_arch="x64" +deb_arch="amd64" +tmp_dir="/data/docker/${app_name}-${version}" + + +if [ -d "./unpack" ]; then + sudo rm -rf ./unpack +fi + +if [ -f "./${app_name}_${version}.deb" ]; then + rm "./${app_name}_${version}.deb" +fi + + +# 创建临时待打包目录 +echo "创建待打包目录..." +mkdir -p "./unpack/DEBIAN" +mkdir -p "./unpack/usr/bin" +mkdir -p "./unpack/usr/lib/systemd/user" +mkdir -p "./unpack/usr/share" +mkdir -p "./unpack/etc/xdg/dunst" + + + +echo "复制编译好的文件到待打包目录..." +cp -rv "${tmp_dir}/dunst" "./unpack/usr/bin/" +cp -rv "${tmp_dir}/dunstctl" "./unpack/usr/bin/" +cp -rv "${tmp_dir}/dunstify" "./unpack/usr/bin/" + +cp -rv "${tmp_dir}/dunstrc" "./unpack/etc/xdg/dunst/" + +cp -rv "${tmp_dir}/dunst.systemd.service" "./unpack/usr/lib/systemd/user/dunst.service" + + +echo """[Install] +WantedBy=default.target +""" >> "./unpack/usr/lib/systemd/user/dunst.service" + + +mkdir -p "./unpack/usr/share/dbus-1/services" +cp -rv "${tmp_dir}/org.knopwob.dunst.service" "./unpack/usr/share/dbus-1/services/" + +mkdir -p "./unpack/usr/share/bash-completion/completions" +mkdir -p "./unpack/usr/share/zsh/site-functions" +mkdir -p "./unpack/usr/share/fish/vendor_completions.d" + +cp -rv "${tmp_dir}/completions/dunst.bashcomp" "./unpack/usr/share/bash-completion/completions/dunst" +cp -rv "${tmp_dir}/completions/dunstctl.bashcomp" "./unpack/usr/share/bash-completion/completions/dunstctl" + +cp -rv "${tmp_dir}/completions/_dunst.zshcomp" "./unpack/usr/share/zsh/site-functions/_dunst" +cp -rv "${tmp_dir}/completions/_dunstctl.zshcomp" "./unpack/usr/share/zsh/site-functions/_dunstctl" + +cp -rv "${tmp_dir}/completions/dunst.fishcomp" "./unpack/usr/share/fish/vendor_completions.d/dunst" +cp -rv "${tmp_dir}/completions/dunstctl.fishcomp" "./unpack/usr/share/fish/vendor_completions.d/dunstctl" +cp -rv "${tmp_dir}/completions/dunstify.fishcomp" "./unpack/usr/share/fish/vendor_completions.d/dunstify" + +mkdir -p "./unpack/usr/share/man/man1" +mkdir -p "./unpack/usr/share/man/man5" + +tar -zcvf ./unpack/usr/share/man/man1/dunst.1.gz "${tmp_dir}/docs/dunst.1" +tar -zcvf ./unpack/usr/share/man/man1/dunstctl.1.gz "${tmp_dir}/docs/dunstctl.1" +tar -zcvf ./unpack/usr/share/man/man5/dunst.5.gz "${tmp_dir}/docs/dunst.5" + +echo "复制完成, 压缩可执行文件..." +strip -s "./unpack/usr/bin/dunst" +strip -s "./unpack/usr/bin/dunstify" + +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} +Installed-Size: ${size[0]} +Architecture: ${deb_arch} +Maintainer: Yutent +Depends: default-dbus-session-bus | dbus-session-bus, xdg-utils, libc6 (>= 2.34), libcairo2 (>= 1.10.0), libgdk-pixbuf-2.0-0 (>= 2.31.1), libglib2.0-0 (>= 2.67.3), libnotify4 (>= 0.7.0), libpango-1.0-0 (>= 1.20.0), libpangocairo-1.0-0 (>= 1.22.0), libwayland-client0 (>= 1.20.0), libwayland-cursor0 (>= 1.0.2), libx11-6, libxext6, libxinerama1 (>= 2:1.1.4), libxrandr2 (>= 2:1.5.0), libxss1 +Provides: notification-daemon +Section: x11 +Priority: optional +Homepage: https://dunst-project.org/ +Description: dmenu-ish notification-daemon + Dunst is a highly configurable and lightweight notification-daemon: The + only thing it displays is a colored box with unformatted text. The whole + notification specification (non-optional parts and the "body" capability) is + supported as long as it fits into this look & feel. + . + Dunst is designed to fit nicely into minimalistic windowmanagers like dwm, but + it should work on any Linux desktop. + +""" > DEBIAN/control + + +echo "/etc/xdg/dunst/dunstrc" > DEBIAN/conffiles + +echo '计算文件md5完成, 打包中...' + +cd .. +sudo chown -R root:root unpack + +dpkg-deb -b ./unpack "./${app_name}-${deb_arch}_${version}.deb" + +sudo rm -rf ./unpack +sudo rm -rf $tmp_dir +echo "打包完成 :)"