( cd "$dstdir" && tar xf - )
}
+## Usage: _substFile <filename> <sed-expression>
+function _substFile()
+{
+ local file=$1
+ local expr=$2
+
+ $_CHROOT_SH testfile "$file" || return 0
+
+ local tmp=$($_MKTEMP /tmp/pkgmgmt_subst.XXXXXX)
+ trap "$_RM -f $tmp" EXIT
+
+ $_CHROOT_SH cat "$file" | \
+ $_SED -e "$expr" >$tmp
+
+ $_CHROOT_SH cat "$file" | $_CMP -s $tmp - || \
+ $_CHROOT_SH truncate "$file" <$tmp
+
+ $_RM -f $tmp
+}
+
function _hashAuto()
{
+ local file=$1
local hash=$2
- local dir=$(dirname "$1")
- local file=$(basename "$1")
- $_EXEC_CD "$dir" "$(which test)" "$file" || return 0
+ $_CHROOT_SH testfile "$file" || return 0
local tmp=$($_MKTEMP /tmp/apt.conf.XXXXXX)
trap "$_RM -f $tmp" EXIT
- $_EXEC_CD "$dir" $_CAT "$file" | \
+ $_CHROOT_SH cat "$file" | \
$_SED -e "s|^\([^$hash].*@autogenerated@\)|$hash$hash\1|" >$tmp
- $_CAT $tmp | $_EXEC_CD "$dir" "$(which cmp)" -s - "$file" || \
- $_CHROOT_SH truncate "$1" <$tmp
+ $_CHROOT_SH cat "$file" | $_CMP -s $tmp - || \
+ $_CHROOT_SH truncate "$file" <$tmp
$_RM -f $tmp
}
_copySecure "$vdir" "$RPMETCDIR" /etc/rpm
_copySecure "$vdir" "$RPMSTATEDIR" /var/lib/rpm
+ pushd "$vdir" >/dev/null
+ ## remove %_dbpath settings
+ _substFile /etc/rpm/macros '/^%_dbpath[ \t].*/D'
+ popd >/dev/null
else
if test -n "$have_apt"; then
_copySecureRev "$vdir" /etc/apt "$APTETCDIR"
_copySecureRev "$vdir" /etc/rpm "$RPMETCDIR"
_copySecureRev "$vdir" /var/lib/rpm "$RPMSTATEDIR"
+
+ echo -e "%_dbpath\t\t$rpmdb_mntpoint" >>$RPMETCDIR/macros
fi
## Cleanups...