X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=functions.sh;h=fe93a167e81185bb0bb8f3caea518f11183ac764;hb=2a647ae933cc6284c31276ad345a772e7cab472d;hp=f3124da1f22fccae379682077f0adb129baf7be4;hpb=9335a249285abad7e4bff2d75fb61ffc61149170;p=carnet-tools-cn.git diff --git a/functions.sh b/functions.sh index f3124da..fe93a16 100644 --- a/functions.sh +++ b/functions.sh @@ -179,9 +179,7 @@ cp_check_and_sed() { for i in "$@" do [ -e "$i" ] || continue - if egrep -q "$s" "$i"; then - continue - fi + egrep -q "$s" "$i" || continue [ -h "$i" ] && i=$(readlink -f "$i") sed "$sedcmd" "$i" > "$i.dpkg-tmp" if ! cmp -s "$i" "$i.dpkg-tmp" 2>&1 >/dev/null; then @@ -266,7 +264,7 @@ cp_yes_no () { # check to prevent user from using this when debconf is active # (it would break communication with its backend - uses stdin/out) if [ "$DEBCONF_REDIR" ]; then - echo "cn_yes_no: debconf redirection detected" >&2 + echo "cp_yes_no: debconf redirection detected" >&2 return 1 fi @@ -297,9 +295,17 @@ cp_yes_no () { # --> that's why we wrap the db_get call to return unset RET variable # instead of some gibberish error message that our script does # not expect -cp_db_get_wrap() { +cp_db_get() { local var var="$1" + + # check to prevent user from using this before activating debconf + # confmodule needs to be loaded before accessing db_* functions + if [ -z "$DEBCONF_REDIR" ]; then + echo "cp_db_get: debconf not activated!" >&2 + return 1 + fi + if ! db_get "$var"; then case "$RET" in *doesn\'t\ exist) @@ -311,4 +317,3 @@ cp_db_get_wrap() { esac fi } -