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
# 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
# --> 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)
fi
}
+# by ddzeko, Tue, 05 Apr 2005 15:47:37 +0200
+# - check is the script run by effective root
+cp_check_root() {
+ euid=`awk 'BEGIN{print PROCINFO["euid"]}'`
+ case "$euid" in
+ 0) RET=y
+ return 0 ;;
+ ?*) RET=n
+ return 1 ;;
+ *) RET=""
+ echo "cp_check_root: cannot determine euid" 2>&1
+ ;;
+ esac
+}