#!/bin/bash set -e # create xpilotng user/group if they do not exist if [ "$1" = "configure" ] && ! getent passwd | grep -q "^xpilotng:"; then echo "Adding xpilotng group and user..." adduser --quiet --system --home /run/xpilot-ng-server --group \ --shell /bin/sh --disabled-password xpilotng || true fi chown -R xpilotng:xpilotng /etc/xpilot-ng chmod -f 600 /etc/xpilot-ng/password.txt DEFAULTFILE=/etc/default/xpilot-ng-server if [ ! -e $DEFAULTFILE ]; then touch $DEFAULTFILE chmod 644 $DEFAULTFILE fi grep -q AUTOSTART $DEFAULTFILE || cat >>$DEFAULTFILE <>$DEFAULTFILE <>$DEFAULTFILE <>$DEFAULTFILE </dev/null invoke-rc.d xpilot-ng-server start fi