xref: /aosp_15_r20/external/libconfig/contrib/ls-config/doc/bash.api.txt (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1*2e9d4914SAndroid Build Coastguard WorkerInstalation:
2*2e9d4914SAndroid Build Coastguard Worker------------
3*2e9d4914SAndroid Build Coastguard Worker
4*2e9d4914SAndroid Build Coastguard WorkerFirst of all, You must place ls-config binary and lslib-core bash
5*2e9d4914SAndroid Build Coastguard Workerscript in the same directory (default: /usr/share/ls/lib)
6*2e9d4914SAndroid Build Coastguard Worker
7*2e9d4914SAndroid Build Coastguard WorkerNext in lslib-core header chcange configuration:
8*2e9d4914SAndroid Build Coastguard WorkerPACD tu point to parent directory of paced files
9*2e9d4914SAndroid Build Coastguard Workerthen LIBD must point relative (tu PACD) to directory
10*2e9d4914SAndroid Build Coastguard Workerwhrere script placed
11*2e9d4914SAndroid Build Coastguard Worker
12*2e9d4914SAndroid Build Coastguard WorkerUsage:
13*2e9d4914SAndroid Build Coastguard Worker------
14*2e9d4914SAndroid Build Coastguard Worker
15*2e9d4914SAndroid Build Coastguard WorkerIn You bash script, first of all define LS_EXEC variable,
16*2e9d4914SAndroid Build Coastguard Workerand set his value to 1. (It protect lslib-core) to run
17*2e9d4914SAndroid Build Coastguard Workerstandalone
18*2e9d4914SAndroid Build Coastguard Worker
19*2e9d4914SAndroid Build Coastguard WorkerNext, source library:
20*2e9d4914SAndroid Build Coastguard Workersource /usr/share/ls/lib/lslib-core
21*2e9d4914SAndroid Build Coastguard Worker
22*2e9d4914SAndroid Build Coastguard WorkerAfter thet You can use following function:
23*2e9d4914SAndroid Build Coastguard Worker
24*2e9d4914SAndroid Build Coastguard WorkerFunctions:
25*2e9d4914SAndroid Build Coastguard Worker----------
26*2e9d4914SAndroid Build Coastguard Worker
27*2e9d4914SAndroid Build Coastguard Workercfg_g $PATH               - this echo variable value of given PATH
28*2e9d4914SAndroid Build Coastguard Worker                            and return error code
29*2e9d4914SAndroid Build Coastguard Workercfg_t $PATH               - this echo variable type of given PATH
30*2e9d4914SAndroid Build Coastguard Worker                            and return error code
31*2e9d4914SAndroid Build Coastguard Workercfg_c $PATH               - this echo cout of variable elements
32*2e9d4914SAndroid Build Coastguard Worker                            and return error code
33*2e9d4914SAndroid Build Coastguard Workercfg_s $PATH $DATA [$TYPE] - this set variable of given PATH or create new
34*2e9d4914SAndroid Build Coastguard Worker                            variable valuse are set to DATA, and if this
35*2e9d4914SAndroid Build Coastguard Worker                            create new variable, variable will be type TYPE
36*2e9d4914SAndroid Build Coastguard Workercfg_u $PATH               - this unset (remove) variable of given PATH
37*2e9d4914SAndroid Build Coastguard Worker                            and return error code
38*2e9d4914SAndroid Build Coastguard Workercfg_f_g $FILE $PATH       - same as cfg_g, but operate on given FILE
39*2e9d4914SAndroid Build Coastguard Workercfg_f_t $FILE $PATH       - same as cfg_t, but operate on given FILE
40*2e9d4914SAndroid Build Coastguard Workercfg_f_c $FILE $PATH       - same as cfg_c, but operate on given FILE
41*2e9d4914SAndroid Build Coastguard Workercfg_f_s $FILE $PATH $DATA [$TYPE] - same as cfg_s, but operate on given FILE
42*2e9d4914SAndroid Build Coastguard Workercfg_f_u $FILE $PATH       - same as cfg_u, but operate on given FILE
43*2e9d4914SAndroid Build Coastguard Worker
44*2e9d4914SAndroid Build Coastguard WorkerConfiguration files:
45*2e9d4914SAndroid Build Coastguard Worker--------------------
46*2e9d4914SAndroid Build Coastguard Worker
47*2e9d4914SAndroid Build Coastguard WorkerBy default configuration file are placed in /etc/ls/
48*2e9d4914SAndroid Build Coastguard Workerwith the same name as script file name
49*2e9d4914SAndroid Build Coastguard Worker(used in cfg_g, cfg_t, cfg_c, cfg_s, cfg_u)
50*2e9d4914SAndroid Build Coastguard Worker
51*2e9d4914SAndroid Build Coastguard WorkerBut if You need, You can use any location of configuration file
52*2e9d4914SAndroid Build Coastguard Workerby using cfg_f_* functions, giving configuration file location as
53*2e9d4914SAndroid Build Coastguard Workerfirst argument
54*2e9d4914SAndroid Build Coastguard Worker
55*2e9d4914SAndroid Build Coastguard WorkerDetailed configuration file shema are publicated on:
56*2e9d4914SAndroid Build Coastguard Workerhttp://www.hyperrealm.com/libconfig/
57*2e9d4914SAndroid Build Coastguard WorkerAnd his gramar on:
58*2e9d4914SAndroid Build Coastguard Workerhttp://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files
59*2e9d4914SAndroid Build Coastguard Worker
60*2e9d4914SAndroid Build Coastguard Workerthere are only short describe:
61*2e9d4914SAndroid Build Coastguard Workerconfiguration = setting-list | empty
62*2e9d4914SAndroid Build Coastguard Workersetting-list = setting | setting-list setting
63*2e9d4914SAndroid Build Coastguard Workersetting = name (":" | "=") value (";" | "," | empty)
64*2e9d4914SAndroid Build Coastguard Workervalue = scalar-value | array | list | group
65*2e9d4914SAndroid Build Coastguard Workervalue-list = value | value-list "," value
66*2e9d4914SAndroid Build Coastguard Workerscalar-value = boolean | integer | integer64 | hex | hex64 | float | string
67*2e9d4914SAndroid Build Coastguard Workerscalar-value-list = scalar-value | scalar-value-list "," scalar-value
68*2e9d4914SAndroid Build Coastguard Workerarray = "[" (scalar-value-list | empty) "]"
69*2e9d4914SAndroid Build Coastguard Workerlist = "(" (value-list | empty) ")"
70*2e9d4914SAndroid Build Coastguard Workergroup = "{" (setting-list | empty) "}"
71*2e9d4914SAndroid Build Coastguard Workerempty =
72*2e9d4914SAndroid Build Coastguard Worker
73*2e9d4914SAndroid Build Coastguard Workersmaple configuration file and script are available on sample/ directory
74*2e9d4914SAndroid Build Coastguard Workerconfig - samble configuration file
75*2e9d4914SAndroid Build Coastguard Workerscript - sample script, then read info variable from config file
76