summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan Harris2017-11-30 19:36:10 +0000
committerAidan Harris2017-11-30 19:36:10 +0000
commit225d2e4ec1c17df6462434c14107134ce58a3823 (patch)
tree707349b99a8223bac4456ed4a24ec446427ff421
downloadaur-225d2e4ec1c17df6462434c14107134ce58a3823.tar.gz
Initial Commit
-rw-r--r--.SRCINFO26
-rw-r--r--PKGBUILD53
-rw-r--r--homebridge-system.service12
-rw-r--r--homebridge-user.service8
-rw-r--r--homebridge.install29
5 files changed, 128 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..c9d8ab89194c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = homebridge-git
+ pkgdesc = HomeKit support for the impatient
+ pkgver = 0.4.32.r1.gb670ec1
+ pkgrel = 1
+ url = https://github.com/nfarina/homebridge
+ install = homebridge.install
+ arch = any
+ license = apache
+ makedepends = git
+ makedepends = npm
+ depends = nodejs>=4.3.2
+ depends = avahi
+ provides = homebridge
+ conflicts = homebridge
+ options = !emptydirs
+ source = git+https://github.com/nfarina/homebridge.git
+ source = homebridge-system.service
+ source = homebridge-user.service
+ source = homebridge.install
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+
+pkgname = homebridge-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..78bfe291c033
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,53 @@
+# Maintainer: ahrs <Forward dot to at hotmail dot co dot uk>
+
+pkgname=homebridge-git
+_gitname=homebridge
+pkgver=0.4.32.r1.gb670ec1
+pkgrel=1
+pkgdesc="HomeKit support for the impatient"
+arch=('any')
+url="https://github.com/nfarina/homebridge"
+license=('apache')
+depends=('nodejs>=4.3.2' 'avahi')
+makedepends=('git' 'npm')
+provides=('homebridge')
+conflicts=('homebridge')
+options=(!emptydirs)
+source=(
+ "git+${url}.git"
+ "${_gitname}-system.service"
+ "${_gitname}-user.service"
+ "${_gitname}.install"
+)
+sha256sums=(
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+)
+
+install="${_gitname}.install"
+
+pkgver() {
+ cd "${srcdir}/${_gitname}"
+ git describe --long --tags | sed -r 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "${srcdir}"
+
+ # Fix error with npm5 issue
+ tar -czf homebridge.tar.gz homebridge
+}
+
+package() {
+ cd "${srcdir}/${_gitname}"
+
+ install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${_gitname}"
+ npm install --cache ../cache --user root -g --prefix "${pkgdir}/usr" ../*.tar.gz
+
+ install -D -m644 "${srcdir}/${_gitname}-system.service" "$pkgdir/usr/lib/systemd/system/${_gitname}.service"
+ install -D -m644 "${srcdir}/${_gitname}-user.service" "$pkgdir/usr/lib/systemd/user/${_gitname}.service"
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/homebridge-system.service b/homebridge-system.service
new file mode 100644
index 000000000000..df41d0567bb6
--- /dev/null
+++ b/homebridge-system.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Node.js HomeKit Server
+Requires=avahi-daemon.service
+After=network.target avahi-daemon.service
+
+[Service]
+User=homebridge
+Type=simple
+ExecStart=/usr/bin/homebridge -U /var/lib/homebridge
+
+[Install]
+WantedBy=multi-user.target
diff --git a/homebridge-user.service b/homebridge-user.service
new file mode 100644
index 000000000000..f7b0ca1f797c
--- /dev/null
+++ b/homebridge-user.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Node.js HomeKit Server
+
+[Service]
+ExecStart=/usr/bin/homebridge -U %h/.homebridge
+
+[Install]
+WantedBy=default.target
diff --git a/homebridge.install b/homebridge.install
new file mode 100644
index 000000000000..e2787d7787b1
--- /dev/null
+++ b/homebridge.install
@@ -0,0 +1,29 @@
+_NAME=homebridge
+
+post_install() {
+ mkdir -p /var/lib/${_NAME}
+ getent passwd ${_NAME} > /dev/null || useradd -d /var/lib/${_NAME} -s /bin/false -r ${_NAME} > /dev/null
+ chown -R ${_NAME}:${_NAME} /var/lib/${_NAME}
+
+ echo ""
+ echo "A sample configuration file is provided at /usr/lib/node_modules/homebridge/config-sample.json"
+ echo "Copy this to /var/lib/${_NAME}/config.json and edit accordingly"
+ echo " cp /usr/lib/node_modules/homebridge/config-sample.json /var/lib/${_NAME}/config.json"
+ echo " chown ${_NAME}:${_NAME} /var/lib/${_NAME}/config.json"
+ echo " \$EDITOR /var/lib/${_NAME}/config.json"
+ echo ""
+ echo "You can then start the service as follows:"
+ echo " systemctl start homebridge"
+ echo ""
+ echo "If you get a DNS related error on startup, make sure avahi-daemon is running (systemctl status -l avahi-daemon.service)"
+ echo ""
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ echo "Some files have not been removed because they are created by ${_NAME} itself."
+ userdel -f ${_NAME}
+}