1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-17 04:44:10 +02:00
openwrt-packages/utils/lcd4linux/files/lcd4linux.init
Florian Eckert 27b0d3bd11 lcd4linux: Possibility added that the config can also be loaded from /tmp
Until now, the configuration must be stored under '/etc/lcd4linux.conf'.
So that the configuration can also be changed dynamically, it makes
sense to store this under /tmp and load them from this directory.
The init script first checks whether there is a configuration under
'/etc/lcd4linux.conf' and only then does it try to find it under
'/tmp/lcd4linux.conf'. If there is no configuration, an error message
is shown.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2022-09-28 10:19:12 +02:00

30 lines
654 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2015 OpenWrt.org
START=98
USE_PROCD=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"
procd_set_param file "$CONFIGFILE"
procd_close_instance
}