econf: teak timestamp preservation
authorZac Medico <zmedico@gentoo.org>
Tue, 5 Feb 2013 08:39:30 +0000 (00:39 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 5 Feb 2013 08:39:30 +0000 (00:39 -0800)
Use the sed -i so we can keep the same inode, avoiding potential issues
with loss of file metadata.

bin/phase-helpers.sh

index 7426229a6c0d69a213a377f695dd2bb3c13ea750..d278dd6702bd8de4be52ddae1b4d796ea59bc179 100644 (file)
@@ -439,13 +439,12 @@ econf() {
        if [ -x "${ECONF_SOURCE}/configure" ]; then
                if [[ -n $CONFIG_SHELL && \
                        "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
-                       sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" "$ECONF_SOURCE/configure" > \
-                               "$ECONF_SOURCE/configure._portage_tmp_.$$" || \
-                               die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
                        # preserve timestamp, see bug #440304
                        touch -r "$ECONF_SOURCE/configure" "$ECONF_SOURCE/configure._portage_tmp_.$$" || die
-                       mv "$ECONF_SOURCE/configure._portage_tmp_.$$" "$ECONF_SOURCE/configure" || die
-                       chmod +x "$ECONF_SOURCE/configure" || die
+                       sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
+                               die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
+                       touch -r "$ECONF_SOURCE/configure._portage_tmp_.$$" "$ECONF_SOURCE/configure" || die
+                       rm -f "$ECONF_SOURCE/configure._portage_tmp_.$$"
                fi
                if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then
                        find "${WORKDIR}" -type f '(' \