Skip to content

Instantly share code, notes, and snippets.

@tonylambiris
Created May 20, 2018 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonylambiris/36e2b928f5afcc7940e9b720c74990ec to your computer and use it in GitHub Desktop.
Save tonylambiris/36e2b928f5afcc7940e9b720c74990ec to your computer and use it in GitHub Desktop.
Updated PKGBUILD for synergy2-bin
# Generated by debtap
# Maintainer: jaap
# Contributor: jaap
pkgname=synergy2-bin
pkgver=2.0.11.stable~b56+8c94f00f
pkgrel=1
pkgdesc="Keyboard and mouse sharing solution. Synergy allows you to share one mouse and keyboard between multiple computers. Work seamlessly across Windows, macOS and Linux."
arch=('x86_64')
url="https://symless.com/synergy"
license=('unknown')
groups=('')
depends=('gcc>=5.2' 'bash-completion>=1.18.' 'gcc-libs>=3.0' 'hicolor-icon-theme' 'openssl-1.0' 'libx11>=1.2.99.901' 'libxext' 'libxi>=1.2.99.4' 'libxtst' 'openssl-1.0>=1.0.0' 'qt5-base>=5.5.0' 'qt5-declarative>=5.5.0' 'qt5-quickcontrols>=5.5.0' 'qt5-svg>=5.5.0')
conflicts=('synergy' 'synergy2-bin')
options=('!strip' '!emptydirs')
install=${pkgname}.install
source_x86_64=("https://binaries.symless.com/v2.0.11/debian/synergy_2.0.11.stable~b56%2B8c94f00f_amd64.deb")
sha512sums_x86_64=('7dd43c8338d8fa92e939beab118312a026b8c517b9bddf2631bf1d06482a5a609b6a8ca93d1e4d76cd1163a756242871001f99d3af49f5570ee2b6e502bb2c4c')
package(){
# Extract package data
tar xf data.tar.xz --exclude='./lib/*' -C "${pkgdir}"
install -Dm644 "${pkgdir}/usr/share/doc/synergy/copyright" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# Configure display varible
sed -i "/\[Service\]/a Environment=DISPLAY=$(display)" "${pkgdir}/usr/lib/systemd/system/synergy.service"
}
display() {
declare -A disp=() users=()
for i in $(users); do
[[ $i = root ]] && continue
users[$i]=1
done
for u in "${!users[@]}"; do
for i in $(ps e -u "$u" | sed -rn 's/.* DISPLAY=(:[0-9]*).*/\1/p' | sort -u); do
disp[$i]=$u
done
done
[[ "${#disp[@]}" -eq 1 ]] && echo "${!disp[@]}" || echo ":0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment