Improve setFTLConfigValue function
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
@@ -86,9 +86,17 @@ getFTLConfigValue(){
|
|||||||
# setFTLConfigValue dns.upstreams '[ "8.8.8.8" , "8.8.4.4" ]'
|
# setFTLConfigValue dns.upstreams '[ "8.8.8.8" , "8.8.4.4" ]'
|
||||||
#######################
|
#######################
|
||||||
setFTLConfigValue(){
|
setFTLConfigValue(){
|
||||||
pihole-FTL --config "${1}" "${2}" >/dev/null
|
local err
|
||||||
if [ $? -eq 5 ]; then
|
{ pihole-FTL --config "${1}" "${2}" >/dev/null; err="$?"; } || true
|
||||||
printf " %s %s set by environment variable. Please unset it to use this function\n" "${CROSS}" "${1}"
|
|
||||||
exit 5
|
case $err in
|
||||||
fi
|
0) ;;
|
||||||
|
5)
|
||||||
|
# FTL returns 5 if the value was set by an environment variable and is therefore read-only
|
||||||
|
printf " %s %s set by environment variable. Please unset it to use this function\n" "${CROSS}" "${1}";
|
||||||
|
exit 5;;
|
||||||
|
*)
|
||||||
|
printf " %s Failed to set %s. Try with sudo power\n" "${CROSS}" "${1}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user