postinst_aix: fix problem with archives in use
authorFabian Groffen <grobian@gentoo.org>
Mon, 13 Dec 2010 17:51:27 +0000 (18:51 +0100)
committerFabian Groffen <grobian@gentoo.org>
Mon, 13 Dec 2010 17:51:27 +0000 (18:51 +0100)
bin/misc-functions.sh

index eac35caa079119c997247f0b2e7adb2f79b31733..6dbc2f423689adaa6a96811b86164075c8760f96 100644 (file)
@@ -1416,7 +1416,10 @@ postinst_aix() {
                EOF
                [[ -n ${delmembers} ]] || continue
                einfo "dropping ${archive}[${delmembers# }]"
-               ${ar} -X32_64 -z -o -d "${EROOT}${archive}" ${delmembers} || die "cannot remove${delmembers} from ${archive}"
+               rm -f "${EROOT}${archive}".new || die "cannot prune ${EROOT}${archive}.new"
+               cp "${EROOT}${archive}" "${EROOT}${archive}".new || die "cannot backup ${archive}"
+               ${ar} -X32_64 -z -o -d "${EROOT}${archive}".new ${delmembers} || die "cannot remove${delmembers} from ${archive}.new"
+               mv -f "${EROOT}${archive}".new "${EROOT}${archive}" || die "cannot put ${EROOT}${archive} in place"
                eend $?
        done
        local libmetadir keepmembers prunedirs=()