}
# by jelly, Tue, 15 Mar 2005 14:04:21 +0100
+# A sed wrapper, to use instead of perl -pi -e
+# - relatively safe in-place s///g
+# - takes care of symlinks and ownership
+# returns true if changed, false if nothing happened
+#
cp_check_and_sed() {
[ "$CP_SCRIPT_DEBUG" ] && set -vx
local s sedcmd ret i
sedcmd="$1"
shift
ret=2
- for i in $*
+ for i in "$@"
do
[ -e "$i" ] || continue
egrep -q "$s" "$i" || continue
[ -h "$i" ] && i=$(readlink -f "$i")
sed "$sedcmd" "$i" > "$i.dpkg-tmp"
- chown --reference "$i" "$i.dpkg-tmp"
- chmod --reference "$i" "$i.dpkg-tmp"
if ! cmp -s "$i" "$i.dpkg-tmp"; then
+ chown --reference "$i" "$i.dpkg-tmp"
+ chmod --reference "$i" "$i.dpkg-tmp"
mv "$i.dpkg-tmp" "$i"
else
rm "$i.dpkg-tmp"
is included below.
----------
-$CP_NOTICE
-----------"
+${CP_NOTICE}----------"
echo "$CP_NOTICE" | /usr/sbin/sendmail -t &
sleep 1