#!/bin/sh
for f in etc/init.d/warpgate etc/conf.d/warpgate; do [ -f "/$f.apk-new" ] && mv "/$f.apk-new" "/$f"; done; true
addgroup -S warpgate 2>/dev/null || true
adduser -S -D -H -G warpgate -h /var/lib/warpgate -s /sbin/nologin warpgate 2>/dev/null || true
# Here rather than in package(): the user does not exist until the lines above
# have run, so the ownership cannot be set at build time.
install -dm750 -o warpgate -g warpgate /var/lib/warpgate
[ -f /etc/warpgate.yaml ] || cat << MSG
warpgate: no /etc/warpgate.yaml yet, the service will not start without it.
Create one with:

  warpgate --config /etc/warpgate.yaml setup

then: rc-update add warpgate && rc-service warpgate start
MSG
