IMPROVE: Rearanged configparser.sh
Added Comments for Usage Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
parent
cad2acb3c6
commit
5e2d40741e
@ -29,6 +29,7 @@ function get_param {
|
|||||||
} 2> /dev/null
|
} 2> /dev/null
|
||||||
|
|
||||||
# Check for existing file
|
# Check for existing file
|
||||||
|
# Exit with error if not exist
|
||||||
function check_cfg {
|
function check_cfg {
|
||||||
if [ ! -r "${1}" ]; then
|
if [ ! -r "${1}" ]; then
|
||||||
log_msg "ERROR: No Configuration File found. Exiting!"
|
log_msg "ERROR: No Configuration File found. Exiting!"
|
||||||
@ -36,6 +37,17 @@ function check_cfg {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Spits out all [cam <nameornumber>] configured sections
|
||||||
|
function configured_cams {
|
||||||
|
local cam_count cfg
|
||||||
|
cfg="${WEBCAMD_CFG}"
|
||||||
|
cams="$(crudini --existing=file --get "${cfg}" | \
|
||||||
|
sed '/webcamd/d;s/cam//')"
|
||||||
|
echo "${cams}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Checks [cam <nameornumber>] if all needed configuration sections are present
|
||||||
|
# call check_section <nameornumber> ex.: check_section foobar
|
||||||
function check_section {
|
function check_section {
|
||||||
local section param must_exist missing
|
local section param must_exist missing
|
||||||
section="cam ${1}"
|
section="cam ${1}"
|
||||||
@ -54,12 +66,3 @@ function check_section {
|
|||||||
Continue..."
|
Continue..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## Spits out all [cam <nameornumber>] configured sections
|
|
||||||
function configured_cams {
|
|
||||||
local cam_count cfg
|
|
||||||
cfg="${WEBCAMD_CFG}"
|
|
||||||
cams="$(crudini --existing=file --get "${cfg}" | \
|
|
||||||
sed '/webcamd/d;s/cam//')"
|
|
||||||
echo "${cams}"
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user