Skip to content

Instantly share code, notes, and snippets.

@sukanka
Created November 5, 2023 13:00
Show Gist options
  • Save sukanka/94697d80813839d6256119ac36c2627a to your computer and use it in GitHub Desktop.
Save sukanka/94697d80813839d6256119ac36c2627a to your computer and use it in GitHub Desktop.
bitcomet
#!/usr/bin/bash
USER_RUN_DIR="/run/user/$(id -u)"
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
exec bwrap \
--new-session \
--ro-bind / / \
--dev-bind /dev /dev \
--bind /tmp /tmp \
--ro-bind /dev/null /proc/cpuinfo \
--tmpfs /sys/devices/virtual \
--bind "$USER_RUN_DIR" "$USER_RUN_DIR" \
--tmpfs /var \
--tmpfs "$CONFIG_DIR" \
--ro-bind-try /usr/share/resources /usr/share/BitComet \
--bind "$USER_RUN_DIR" "$USER_RUN_DIR" \
/usr/lib/BitComet/bitcomet "$@"
# Maintainer: sukanka <su975853527 [AT] gmail.com>
pkgname=bitcomet-bin
_pkgname=bitcomet
pkgver=2.4.2
pkgrel=1
pkgdesc="BitComet, a free BitTorrent download client"
arch=('x86_64')
url="https://www.bitcomet.com"
license=('unknown')
depends=(webkit2gtk bubblewrap)
makedepends=(patchelf p7zip)
provides=('bitcomet')
source=(bitcomet.sh)
source_x86_64=("https://download.bitcomet.com/linux/BitComet-${pkgver}-x86_64.AppImage")
sha256sums=('778740ec0072c524c4a9e4534eef2d9174222e2d962a5d8ffee13194010aff01')
sha256sums_x86_64=('85b22b6bbcfabd56795ac9e480606c81646ae1eec82f035b75b79e7d1dc5e5fe')
prepare() {
cd "$srcdir"
7z x -aoa BitComet-${pkgver}-x86_64.AppImage
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 usr/bin/BitComet
sed -i 's|usr/bin/BitComet|bitcomet|g' com.bitcomet.linux.desktop
chmod a+rx -R usr/share/icons
chmod 644 usr/share/icons/hicolor/512x512/apps/*.png
}
package(){
cd "$srcdir"
install -Dm755 bitcomet.sh ${pkgdir}/usr/bin/bitcomet
install -Dm755 usr/bin/BitComet ${pkgdir}/usr/lib/BitComet/bitcomet
install -d ${pkgdir}/usr/share
cp -rf usr/share/icons ${pkgdir}/usr/share
cp -rf usr/share/resources ${pkgdir}/usr/share/BitComet
install -Dm644 com.bitcomet.linux.desktop -t ${pkgdir}/usr/share/applications
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment