xref: /aosp_15_r20/external/libconfig/contrib/ls-config/sample/script (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1#!/bin/bash
2
3#title          :script
4#description    :this script only demonstrate usage of ls-config
5#author         :Łukasz A. Grabowski <[email protected]>
6#date           :20130928
7#version        :1.0.3
8#notes          :This only read one value from configuration file
9#               :this script MUST be run from subdirectory of dir
10#               :where ls-config (bin) and lslib-core are stored
11#               :to place script in other places You must reconfigure paths
12#bash_version   :4.2.37(1)-release
13#copywrite      :Copyright (C) 2013 Łukasz A. Grabowski
14#license        :This program is free software: you can redistribute
15#               :it and/or modify it under the terms of the GNU General
16#               :Public License as published by the Free Software
17#               :Foundation, either version 2 of the License or
18#               :any later version.
19#               :
20#               :This program is distributed in the hope that it will
21#               :be useful, but WITHOUT ANY WARRANTY; without even the
22#               :implied warranty of MERCHANTABILITY or FITNESS FOR
23#               :A PARTICULAR PURPOSE. See the GNU General Public
24#               :License for more details.
25#               :
26#               :You should have received a copy of the GNU General
27#               :Public License along with this program. If not, see
28#               :http://www.gnu.org/licenses/.
29#=======================================================================
30
31
32#set app flag
33LS_EXEC=1
34
35#set configuration directory
36CFGD="./"
37
38#source bash library to manipulate config
39source ../lslib-core
40
41#path direcrories onlny for this sample
42PACD="../"
43LIBD=""
44#end path
45
46#read data from configuration file
47TEST=$(cfg_f_g "config" "info")
48ERR="$?"
49
50#show data
51echo "Info value: $TEST"
52echo "Reading error: $ERR"
53
54#show other method of reading value:
55
56#output space and info
57echo ""
58echo "Reading using binary:"
59
60#read data from configuration file
61TEST=$(${PACD}ls-config -f config --get="info" -vq)
62ERR="$?"
63
64#show data
65echo "Info value: $TEST"
66echo "Reading error: $ERR"
67
68exit 0;
69