X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-mtm.git;a=blobdiff_plain;f=install-substitutions;h=9bcee54da8a0182e7f93432b6408f914ee912735;hp=4f09cd3c06ed52ea06180cba2c6f8f8cbb652d71;hb=ba1a60e8c390874d2fbb484c29d23524e945f934;hpb=fb2fab4c4dcc7ba27dc37e77055c7816a57e3fb5 diff --git a/install-substitutions b/install-substitutions index 4f09cd3..9bcee54 100755 --- a/install-substitutions +++ b/install-substitutions @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ "x$1" = "x-n" ]; then + diffonly=1; diffsparse=0; shift +elif [ "x$1" = "x-nq" ]; then + diffonly=1; diffsparse=1; shift +else + diffonly=0; diffsparse=-1 +fi + +if [ $# != 0 ]; then echo >&2 "usage: ./${0##*/} [-n]"; exit 1; fi + . ./get-settings find -name '*.IN[O1]' ! -path '*/skeleton/*' -exec perl -e ' @@ -27,7 +37,15 @@ find -name '*.IN[O1]' ! -path '*/skeleton/*' -exec perl -e ' chmod 0755, $g or die "$g $!"; } close F or die $!; - if ($overwrite) { + if ('$diffonly') { + if (!-f $d) { + print "Would create $d\n"; + } elsif ('$diffsparse' && !$overwrite) { + print "Not reporting on $d as would not overwrite.\n"; + } else { + system "diff -u $d $g"; + } + } elsif ($overwrite) { rename $g, $d or die "$g $d $!"; } else { if (link $g, $d) {