Spotter-VM/openmapkit/setup.sh
2018-09-13 21:54:36 +02:00

18 lines
633 B
Bash
Executable File

#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Configure OpenMapKit
export OPENMAPKIT_ADMIN_USER="admin"
export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
mkdir -p /srv/openmapkit/conf /srv/openmapkit/data
chown -R 8007:8007 /srv/openmapkit/data
cp -rp /var/lib/lxc/openmapkit/openmapkit/srv/openmapkit/data/. /srv/openmapkit/data
envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit
rc-update -u