changeset 4:5cc2087b8737

lightsd 0.9.2 lightsd now know how to drop privileges, so let's create an user/group for it. This allows us to integrate more nicely with systemd.
author Louis Opter <kalessin@kalessin.fr>
date Sun, 13 Sep 2015 18:38:36 -0700
parents 6bd6e467bb66
children 520fe381a4f5
files .SRCINFO PKGBUILD lightsd.install
diffstat 3 files changed, 36 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/.SRCINFO	Sat Sep 05 23:21:02 2015 -0700
+++ b/.SRCINFO	Sun Sep 13 18:38:36 2015 -0700
@@ -1,19 +1,19 @@
 pkgbase = lightsd
 	pkgdesc = Daemon to control your LIFX smart bulbs via a JSON-RPC API
-	pkgver = 0.9.1
-	pkgrel = 4
+	pkgver = 0.9.2
+	pkgrel = 1
 	epoch = 1
 	url = https://www.github.com/lopter/lightsd/
+	install = lightsd.install
 	arch = i686
 	arch = x86_64
 	license = GPL3
 	makedepends = cmake>=2.8.11
 	depends = libevent>=2.0.19
-	depends = libbsd>=0.5.0
 	optdepends = python: to run the interactive lightsc.py example client
 	optdepends = ipython: makes lightsc.py more user-friendly
-	source = https://github.com/lopter/lightsd/archive/0.9.1.tar.gz
-	sha256sums = 72eba6074ed18609fb0caf7b7429e1b8f6c3564ca6f81357be22c06ac00956b6
+	source = https://github.com/lopter/lightsd/archive/0.9.2.tar.gz
+	sha256sums = 2d785ede7c2e3b603ad33c11c3e44b5c634ee17e745d39296125025eddbbf420
 
 pkgname = lightsd
 
--- a/PKGBUILD	Sat Sep 05 23:21:02 2015 -0700
+++ b/PKGBUILD	Sun Sep 13 18:38:36 2015 -0700
@@ -1,29 +1,32 @@
 # Maintainer: Louis Opter <kalessin@kalessin.fr>
 
 pkgname=lightsd
-pkgver=0.9.1
-pkgrel=4
+pkgver=0.9.2
+pkgrel=1
 epoch=1
 pkgdesc="Daemon to control your LIFX smart bulbs via a JSON-RPC API"
 arch=("i686" "x86_64")
 url="https://www.github.com/lopter/lightsd/"
 license=("GPL3")
-depends=("libevent>=2.0.19" "libbsd>=0.5.0")
+depends=("libevent>=2.0.19")
 optdepends=(
     "python: to run the interactive lightsc.py example client"
     "ipython: makes lightsc.py more user-friendly"
 )
 makedepends=("cmake>=2.8.11")
 source=("https://github.com/lopter/lightsd/archive/${pkgver}.tar.gz")
-sha256sums=("72eba6074ed18609fb0caf7b7429e1b8f6c3564ca6f81357be22c06ac00956b6")
+sha256sums=("2d785ede7c2e3b603ad33c11c3e44b5c634ee17e745d39296125025eddbbf420")
+#source=("src/${pkgname}-${pkgver}::hg+file:///home/kal/projs/lightsd")
+#sha256sums="SKIP"
+install=lightsd.install
 
 build() {
     cd "$srcdir/$pkgname-$pkgver"
 
-    cmake                           \
+    cmake .                         \
         -DCMAKE_BUILD_TYPE=RELEASE  \
         -DCMAKE_INSTALL_PREFIX=/usr \
-        .
+        -DLGTD_RUNTIME_DIRECTORY=/run/lightsd
 
     make
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lightsd.install	Sun Sep 13 18:38:36 2015 -0700
@@ -0,0 +1,22 @@
+post_install() {
+    getent group lightsd >/dev/null || groupadd -r lightsd
+    getent passwd lightsd >/dev/null || useradd -r -d / -g lightsd lightsd
+
+    cat << 'EOF'
+
+lightsd runs under the `lightsd' user and group by default; add yourself to
+this group to be able to open lightsd's socket and pipe under /run/lightsd:
+
+  gpasswd -a $USER lightsd
+
+Re-open your current desktop or ssh session for the change to take effect.
+Then use systemctl to start lightsd; you can start playing with lightsd with:
+
+  `lightsd --prefix`/share/doc/lightsd/examples/lightsc.py
+
+EOF
+}
+
+post_remove() {
+    getent passwd lightsd >/dev/null && userdel lightsd
+}