aboutsummaryrefslogtreecommitdiff
path: root/utils/lcd4linux/files/lcd4linux.init
blob: 3884b041acea6636a7735eb994500b926e996753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2015 OpenWrt.org

START=98
USE_PROCD=1

DEBUG=1
PROG="/usr/bin/lcd4linux"
STATIC_CONFIG="/etc/lcd4linux.conf"
DYNAMIC_CONFIG="/tmp/lcd4linux.conf"

start_service() {
	if [ -f "$DYNAMIC_CONFIG" ]; then
		CONFIGFILE="$DYNAMIC_CONFIG"
	elif [ -f "$STATIC_CONFIG" ]; then
		CONFIGFILE="$STATIC_CONFIG"
	else
		echo "No config found"
		return 1
	fi

	procd_open_instance
	procd_set_param command "$PROG"
	procd_append_param command -F
	procd_append_param command -q
	procd_append_param command -o /tmp/lcd4linux.png
	procd_append_param command -f "$CONFIGFILE"
	[ "$DEBUG" = 1 ] && {
		procd_append_param command -vv
		procd_set_param stdout 1
		procd_set_param stderr 1
	}
	procd_set_param file "$CONFIGFILE"
	procd_close_instance
}