xref: /aosp_15_r20/external/libconfig/contrib/ls-config/doc/bash.api.txt (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1Instalation:
2------------
3
4First of all, You must place ls-config binary and lslib-core bash
5script in the same directory (default: /usr/share/ls/lib)
6
7Next in lslib-core header chcange configuration:
8PACD tu point to parent directory of paced files
9then LIBD must point relative (tu PACD) to directory
10whrere script placed
11
12Usage:
13------
14
15In You bash script, first of all define LS_EXEC variable,
16and set his value to 1. (It protect lslib-core) to run
17standalone
18
19Next, source library:
20source /usr/share/ls/lib/lslib-core
21
22After thet You can use following function:
23
24Functions:
25----------
26
27cfg_g $PATH               - this echo variable value of given PATH
28                            and return error code
29cfg_t $PATH               - this echo variable type of given PATH
30                            and return error code
31cfg_c $PATH               - this echo cout of variable elements
32                            and return error code
33cfg_s $PATH $DATA [$TYPE] - this set variable of given PATH or create new
34                            variable valuse are set to DATA, and if this
35                            create new variable, variable will be type TYPE
36cfg_u $PATH               - this unset (remove) variable of given PATH
37                            and return error code
38cfg_f_g $FILE $PATH       - same as cfg_g, but operate on given FILE
39cfg_f_t $FILE $PATH       - same as cfg_t, but operate on given FILE
40cfg_f_c $FILE $PATH       - same as cfg_c, but operate on given FILE
41cfg_f_s $FILE $PATH $DATA [$TYPE] - same as cfg_s, but operate on given FILE
42cfg_f_u $FILE $PATH       - same as cfg_u, but operate on given FILE
43
44Configuration files:
45--------------------
46
47By default configuration file are placed in /etc/ls/
48with the same name as script file name
49(used in cfg_g, cfg_t, cfg_c, cfg_s, cfg_u)
50
51But if You need, You can use any location of configuration file
52by using cfg_f_* functions, giving configuration file location as
53first argument
54
55Detailed configuration file shema are publicated on:
56http://www.hyperrealm.com/libconfig/
57And his gramar on:
58http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files
59
60there are only short describe:
61configuration = setting-list | empty
62setting-list = setting | setting-list setting
63setting = name (":" | "=") value (";" | "," | empty)
64value = scalar-value | array | list | group
65value-list = value | value-list "," value
66scalar-value = boolean | integer | integer64 | hex | hex64 | float | string
67scalar-value-list = scalar-value | scalar-value-list "," scalar-value
68array = "[" (scalar-value-list | empty) "]"
69list = "(" (value-list | empty) ")"
70group = "{" (setting-list | empty) "}"
71empty =
72
73smaple configuration file and script are available on sample/ directory
74config - samble configuration file
75script - sample script, then read info variable from config file
76