From: Ian Abbott Date: Fri, 11 Aug 2006 17:28:59 +0000 (+0000) Subject: Restore the old COPYING and INSTALL files after they are overwritten by X-Git-Tag: r0_7_72~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=52adbbf2c17fe0a3c48e43b4da447627517c531b;p=comedi.git Restore the old COPYING and INSTALL files after they are overwritten by autoreconf -i -f. --- diff --git a/autogen.sh b/autogen.sh index 3b1fdfc6..0fc93302 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,31 @@ #!/bin/sh -autoreconf -i -f && -./configure --enable-maintainer-mode $* +# function saves 'COPYING' and 'INSTALL' as they get clobbered. +save () { + COPYING_ok=false + INSTALL_ok=false + cp COPYING COPYING.save && COPYING_ok=true + cp INSTALL INSTALL.save && INSTALL_ok=true +} + +# function restores 'COPYING' and 'INSTALL' which have probably been clobbered. +restore () { + $COPYING_ok && mv COPYING.save COPYING + $INSTALL_ok && mv INSTALL.save INSTALL +} + +# save the files before they get clobbered. +save +trap "restore; exit 130" 1 2 15 + +# run autoreconf. The -i and -f flags causes files to be overwritten. +autoreconf_ok=false +autoreconf -i -f && autoreconf_ok=true + +# unclobber the overwritten files. +restore +trap - 1 2 15 + +# re-run configure script if autoreconf was successful. +$autoreconf_ok && ./configure --enable-maintainer-mode $*