diff options
author | plokid | 2023-02-10 09:40:31 +0800 |
---|---|---|
committer | plokid | 2023-02-10 09:40:31 +0800 |
commit | 0b9792b50fcf2a3b0c8145ccdefc8fa9b52fae7e (patch) | |
tree | d37ee8c21c0983230233afe91fc95b7a9727a3b2 | |
download | aur-0b9792b50fcf2a3b0c8145ccdefc8fa9b52fae7e.tar.gz |
init commit
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | PKGBUILD | 20 | ||||
-rwxr-xr-x | wps-bwrap | 32 | ||||
-rw-r--r-- | wps-office-bwrap.desktop | 19 |
4 files changed, 86 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2bb105b4119d --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = wps-office-bwrap + pkgdesc = use bubblewrap sandbox to stop wpscloudsvr + pkgver = 1.0 + pkgrel = 1 + url = https://blog.ruo-chen.wang/2021/08/bwrap-wps.html + arch = any + license = custom + depends = wps-office + depends = bubblewrap + source = wps-office-bwrap.desktop + source = wps-bwrap + sha256sums = c5807be6866bfff6efc471b4f1cb9d6e3df7b51bbca4c29792bc279241f37c06 + sha256sums = 6f449ba7f78365f81d6d8dd1f4624deb4c799e965773e75cd805ed37a31f6166 + +pkgname = wps-office-bwrap diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..111ee403f8c2 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,20 @@ +# Maintainer: plokid <910576949@qq.com> +# 灵感来自https://blog.ruo-chen.wang/2021/08/bwrap-wps.html + +pkgname=wps-office-bwrap +pkgver=1.0 +pkgrel=1 +pkgdesc="use bubblewrap sandbox to stop wpscloudsvr" +arch=('any') +url="https://blog.ruo-chen.wang/2021/08/bwrap-wps.html" +license=('custom') +depends=('wps-office' 'bubblewrap') +source=("wps-office-bwrap.desktop" + "wps-bwrap") +sha256sums=('c5807be6866bfff6efc471b4f1cb9d6e3df7b51bbca4c29792bc279241f37c06' + '6f449ba7f78365f81d6d8dd1f4624deb4c799e965773e75cd805ed37a31f6166') + +package() { + install -Dm664 $srcdir/wps-office-bwrap.desktop $pkgdir/usr/share/applications/wps-office-bwrap.desktop + install -Dm775 $srcdir/wps-bwrap $pkgdir/usr/bin/wps-bwrap +} diff --git a/wps-bwrap b/wps-bwrap new file mode 100755 index 000000000000..acd1c6da3f90 --- /dev/null +++ b/wps-bwrap @@ -0,0 +1,32 @@ +#!/bin/bash + +# 根据扩展名选择对应的 WPS 程序 +file=$1 +case $file in + *.doc | *.docx) exe=/usr/bin/wps ;; + *.xls | *.xlsx) exe=/usr/bin/et ;; + *.ppt | *.pptx) exe=/usr/bin/wpp ;; + *.pdf) exe=/usr/bin/wpspdf ;; + *) exe=/usr/bin/wps ;; +esac + +binds=() +for dir in fontconfig gtk-2.0 gtk-3.0 mimeapps.list Kingsoft; do + binds+=(--bind ~/.config/"$dir" ~/.config/"$dir") +done +binds+=(--bind ~/.local/share/Kingsoft ~/.local/share/Kingsoft) + +# bind mount 需要操作的文件 +if [[ -f "$file" ]]; then + path="$(realpath "$file")" + binds+=(--bind "$path" "$path") +fi + +exec bwrap --unshare-all --share-net --die-with-parent \ + --ro-bind / / \ + --tmpfs /sys --tmpfs /home --tmpfs /tmp --tmpfs /run --proc /proc --dev /dev \ + --ro-bind "$XDG_RUNTIME_DIR" "$XDG_RUNTIME_DIR" \ + --ro-bind /tmp/.X11-unix /tmp/.X11-unix \ + "${binds[@]}" \ + --bind ~/Documents ~/Documents \ + "$exe" "$@" diff --git a/wps-office-bwrap.desktop b/wps-office-bwrap.desktop new file mode 100644 index 000000000000..9477dd3b2cff --- /dev/null +++ b/wps-office-bwrap.desktop @@ -0,0 +1,19 @@ +[Desktop Entry] +Comment=Use WPS Writer to office work. +Comment[zh_CN]=使用 WPS 2019进行办公 +Exec=/usr/bin/wps-bwrap %F +GenericName=WPS +GenericName[zh_CN]=WPS 2019 +Name=WPS 2019 +Name[zh_CN]=WPS 2019 +StartupNotify=false +Terminal=false +Type=Application +Categories=Office;WordProcessor;Qt; +X-DBUS-ServiceName= +X-DBUS-StartupType= +X-KDE-SubstituteUID=false +X-KDE-Username= +Icon=wps-office2019-kprometheus +InitialPreference=3 +StartupWMClass=wpsoffice |