r3: 可以和linuxqq共存

This commit is contained in:
Yidaozhan Ya 2022-12-12 17:35:25 +08:00
parent bf60345dc8
commit fd88c7e5e1
3 changed files with 37 additions and 18 deletions

View file

@ -1,12 +1,13 @@
pkgbase = linuxqq-nt-bwrap
pkgdesc = Tencent QQ NT for Linux with bubblewrap wrapper
pkgver = 2.0.1_b1
pkgrel = 2
pkgrel = 3
url = https://im.qq.com
install = linuxqq.install
arch = x86_64
arch = aarch64
license = custom
makedepends = imagemagick
depends = at-spi2-core
depends = desktop-file-utils
depends = gtk3
@ -20,17 +21,16 @@ pkgbase = linuxqq-nt-bwrap
depends = bubblewrap
depends = xdg-utils
depends = xdg-user-dirs
optdepends = libappindicator-gtk3
provides = linuxqq
optdepends = libappindicator-gtk3: 以最小化到托盘
provides = qq-nt
provides = linuxqq-nt
provides = linuxqq-new
conflicts = linuxqq
conflicts = linuxqq-new
conflicts = linuxqq-electron
options = !strip
options = !emptydirs
source = start.sh
sha256sums = 4125f66a4ba979fae2a4d0c91e7f61f985f41e0f65a05b92d8c17326fa2c3d91
sha256sums = 5acc46390fe6435b58a9b9859dc7df6dcb600ee375b72ec2162e0f9f18a4cd1e
source_x86_64 = https://dldir1.qq.com/qqfile/qq/QQNT/4691a571/QQ-v2.0.1-429_x64.deb
sha256sums_x86_64 = e3aa15ff6ae089b655df3913c6020ca56726bd676995aaf29b313fbd0643ea42
source_aarch64 = https://dldir1.qq.com/qqfile/qq/QQNT/0186a650/QQ-v2.0.1-453_arm64.deb

View file

@ -2,15 +2,16 @@
_pkgname=linuxqq
pkgname=linuxqq-nt-bwrap
pkgver=2.0.1_b1
pkgrel=2
pkgrel=3
pkgdesc="Tencent QQ NT for Linux with bubblewrap wrapper"
arch=('x86_64' 'aarch64')
url="https://im.qq.com"
license=('custom')
depends=('at-spi2-core' 'desktop-file-utils' 'gtk3' 'hicolor-icon-theme' 'libnotify' 'libsecret' 'libxss' 'libxtst' 'nss' 'util-linux-libs' 'bubblewrap' 'xdg-utils' 'xdg-user-dirs')
optdepends=('libappindicator-gtk3')
provides=('linuxqq' 'linuxqq-nt' 'linuxqq-new')
conflicts=('linuxqq' 'linuxqq-new' 'linuxqq-electron')
makedepends=('imagemagick')
optdepends=('libappindicator-gtk3: 以最小化到托盘')
provides=('qq-nt' 'linuxqq-nt' 'linuxqq-new')
conflicts=('linuxqq-new' 'linuxqq-electron')
options=('!strip' '!emptydirs')
install=${_pkgname}.install
source_x86_64=("https://dldir1.qq.com/qqfile/qq/QQNT/4691a571/QQ-v2.0.1-429_x64.deb")
@ -18,16 +19,32 @@ source_aarch64=("https://dldir1.qq.com/qqfile/qq/QQNT/0186a650/QQ-v2.0.1-453_arm
source=('start.sh')
sha256sums_x86_64=('e3aa15ff6ae089b655df3913c6020ca56726bd676995aaf29b313fbd0643ea42')
sha256sums_aarch64=('70c286006dae10da06c191b5f0718d17d686a8ef792f6f72215734773f01498b')
sha256sums=('4125f66a4ba979fae2a4d0c91e7f61f985f41e0f65a05b92d8c17326fa2c3d91')
sha256sums=('5acc46390fe6435b58a9b9859dc7df6dcb600ee375b72ec2162e0f9f18a4cd1e') # start.sh
package(){
package() {
# 解压程序包
tar -xJ -f "data.tar.xz" -C "${pkgdir}"
mv "${pkgdir}/usr/share/icons/hicolor/0x0" "${pkgdir}/usr/share/icons/hicolor/512x512"
# 处理图标尺寸不正确的问题
ICON_WORKDIR="${pkgdir}/usr/share/icons/hicolor/0x0"
convert "${ICON_WORKDIR}/apps/qq.png" -trim +repage "${ICON_WORKDIR}/trimmed.png"
convert "${ICON_WORKDIR}/trimmed.png" -resize '512x512' "${ICON_WORKDIR}/resized.png"
mkdir -p "${pkgdir}/usr/share/icons/hicolor/512x512/apps"
mv "${ICON_WORKDIR}/resized.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/qq-nt.png"
rm -rf "${ICON_WORKDIR}"
# 将 LICENSE 移动到正确位置
mkdir -p "${pkgdir}/usr/share/licenses/${_pkgname}"
ln -s "/opt/QQ/LICENSE.electron.txt" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
ln -s "/opt/QQ/LICENSES.chromium.html" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE.chromium.html"
# 对 desktop 文件做处理,使其使用正确的图标,启动 start.sh
cp "${srcdir}/start.sh" "${pkgdir}/opt/QQ/start.sh"
sed -i "s#/opt/QQ/qq#/opt/QQ/start.sh#" "${pkgdir}/usr/share/applications/qq.desktop"
mv "${pkgdir}/usr/share/applications/qq.desktop" "${pkgdir}/usr/share/applications/qq-nt.desktop"
sed -i "s|Icon=/opt/QQ/resources/app/512x512.png|Icon=qq-nt|" "${pkgdir}/usr/share/applications/qq-nt.desktop"
sed -i "s|/opt/QQ/qq|/opt/QQ/start.sh|" "${pkgdir}/usr/share/applications/qq-nt.desktop"
# 这样就可以直接输入 qq-nt 命令启动了
mkdir -p "${pkgdir}/usr/bin"
ln -s "/opt/QQ/start.sh" "${pkgdir}/usr/bin/qq"
ln -s "/opt/QQ/start.sh" "${pkgdir}/usr/bin/qq-nt"
}

View file

@ -5,6 +5,7 @@ CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
FONTCONFIG_DIR="$CONFIG_DIR/fontconfig"
QQ_APP_DIR="${CONFIG_DIR}/QQ"
DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)"
NEW_DISPLAY="$DISPLAY"
if [ "$DOWNLOAD_DIR" == "$HOME" ]; then DOWNLOAD_DIR="$HOME/Downloads"; fi
mkdir -p "$QQ_APP_DIR"
@ -26,12 +27,13 @@ bwrap --new-session --die-with-parent --cap-drop ALL --unshare-user-try --unshar
--bind "$USER_RUN_DIR" "$USER_RUN_DIR" \
--ro-bind-try /etc/fonts /etc/fonts \
--ro-bind-try "$FONTCONFIG_DIR" "$FONTCONFIG_DIR" \
--bind /tmp /tmp \
--bind "$HOME/.pki" "$HOME/.pki" \
--ro-bind "$HOME/.Xauthority" "$HOME/.Xauthority" \
--bind "${DOWNLOAD_DIR}" "${DOWNLOAD_DIR}" \
--dev-bind /tmp /tmp \
--bind-try "$HOME/.pki" "$HOME/.pki" \
--ro-bind-try "$XAUTHORITY" "$XAUTHORITY" \
--bind "$DOWNLOAD_DIR" "$DOWNLOAD_DIR" \
--bind "$QQ_APP_DIR" "$QQ_APP_DIR" \
--setenv IBUS_USE_PORTAL 1 \
--setenv DISPLAY "$NEW_DISPLAY" \
/opt/QQ/qq "$@"
# 移除无用崩溃报告和日志