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