summaryrefslogtreecommitdiffstats
path: root/rc-services.sh
blob: 4a3686d2f3ab217b7f414c2c627733e97792d0f2 (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

RC_GOT_SERVICES="yes"

[ "$RC_GOT_FUNCTIONS" ] || . /sbin/functions.sh

# void save_options(char *option, char *optstring)
save_options() {
        local myopts="$1"

        shift
        if [ ! -d "${svcdir}/options/${SVCNAME}" ] ; then
                mkdir -p -m 0755 "${svcdir}/options/${SVCNAME}"
        fi

        echo "$*" > "${svcdir}/options/${SVCNAME}/${myopts}"
}

# char *get_options(char *option)
get_options() {
        local svc="${SVCNAME}"
        [ -n $2 ] && svc="$2"

        if [ -f "${svcdir}/options/${svc}/$1" ] ; then
                echo "$(< ${svcdir}/options/${svc}/$1)"
        fi
}