Commit 0a1b8825 authored by Seblu's avatar Seblu
Browse files

Add unifi

build from aur unifi-controller with the following improvments:
- create user and group to NOT run controller stuff as root
- handle upgrades and remove compilation echo (which was not read by end user)
- java-runtime-headless instead of java-runtimes
- fix java path in service file
- unzip is not a makedepends
- avoid upper case in service and path (UniFi => unifi)
- avoid overwriting of source filename
- cleaning quoting and tabing
parent bfb902b3
Loading
Loading
Loading
Loading

unifi/PKGBUILD

0 → 100644
+28 −0
Original line number Diff line number Diff line
# Maintainer: Frederik Schwan frederik dot schwan at linux dot com>
# Contributor: Sébastien Luttringer

pkgname=unifi
pkgver=2.4.6
pkgrel=1
pkgdesc='Controller for Ubiquiti UniFi accesspoints'
arch=('any')
url='http://www.ubnt.com/'
license=('custom')
depends=('mongodb' 'java-runtime-headless')
# needed to not break configuration accross upgrades
backup=('opt/unifi/data/system.properties')
install=unifi.install
source=("UniFi-$pkgver.zip::http://dl.ubnt.com/unifi/$pkgver/UniFi.unix.zip"
        'unifi.service')
md5sums=('eb0bafb975b0da45f8fe191ec5ed0595'
         '04934ee4be43b6f80db610d140edf49f')

package() {
  install -d "$pkgdir/opt"
  cp -ar UniFi "$pkgdir/opt/unifi"
  chown -R 113:113 "$pkgdir/opt/unifi"
  rm "$pkgdir/opt/unifi/readme.txt"
  install -D unifi.service "$pkgdir/usr/lib/systemd/system/unifi.service"
}

# vim:set ts=2 sw=2 ft=sh et:

unifi/unifi.install

0 → 100644
+15 −0
Original line number Diff line number Diff line
# arg 1:  the new package version
post_install() {
  getent group unifi >/dev/null || groupadd -g 113 unifi
  getent passwd unifi >/dev/null || useradd -M -d /opt/unifi -u 113 -g 113 unifi
  :
}

# arg 1:  the old package version
post_remove() {
  userdel -f unifi &>/dev/null
  groupdel unifi &>/dev/null
  :
}

# vim:set ts=2 sw=2 et:

unifi/unifi.service

0 → 100644
+11 −0
Original line number Diff line number Diff line
[Unit]
Description=UniFi Controller
After=network.target

[Service]
User=unifi
ExecStart=/usr/bin/java -jar /opt/unifi/lib/ace.jar start
ExecStop=/usr/bin/java -jar /opt/unifi/lib/ace.jar stop

[Install]
WantedBy=multi-user.target