#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2012 OpenWrt.org

START=60
USE_PROCD=1
PROG=/usr/sbin/dmapd

start_service() {
	[ -d /var/run/dmapd ] || {
		mkdir -m 0755 -p /var/run/dmapd
		chown dmapd:dmapd /var/run/dmapd
	}
	[ -d /var/db/dmapd ] || {
		mkdir -m 0755 -p /var/db/dmapd
		chown dmapd:dmapd /var/db/dmapd
	}
	mkdir -m 0755 -p /var/lock/subsys
	mkdir -m 0755 -p /var/media/music
	mkdir -m 0755 -p /var/media/pictures

	procd_open_instance
	procd_set_param stdout 1
	procd_set_param stderr 1
	procd_set_param pidfile /var/run/dmapd.pid
	procd_set_param user dmapd
	procd_set_param command $PROG -f
	procd_close_instance
}
