summaryrefslogtreecommitdiff
path: root/tool/ifchange
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-15 07:51:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-15 07:51:32 +0000
commit262529fdfb34630cc4702bd607191d1b6c719abb (patch)
tree583384f43b3f339bcc0057e0bcc39f84edb4ad42 /tool/ifchange
parent3f51cff4f9c3babdc0d641ffa8467ceabe5a5e26 (diff)
ifchange: --keep option
* tool/ifchange (--keep=suffix): new option for debug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ifchange')
-rwxr-xr-xtool/ifchange8
1 files changed, 8 insertions, 0 deletions
diff --git a/tool/ifchange b/tool/ifchange
index 177ce7340b..5ff8276b03 100755
--- a/tool/ifchange
+++ b/tool/ifchange
@@ -2,6 +2,7 @@
# usage: ifchange target temporary
timestamp=
+keepsuffix=
until [ "$0" = 0 ]; do
case "$1" in
--timestamp)
@@ -10,6 +11,12 @@ until [ "$0" = 0 ]; do
--timestamp=*)
timestamp=`expr \( "$1" : '[^=]*=\(.*\)' \)`
;;
+ --keep)
+ keepsuffix=.old
+ ;;
+ --keep=*)
+ keepsuffix=`expr \( "$1" : '[^=]*=\(.*\)' \)`
+ ;;
*)
break
;;
@@ -30,6 +37,7 @@ if cmp "$target" "$temp" >/dev/null 2>&1; then
rm -f "$temp"
else
echo "$target updated"
+ ${keepsuffix:+ mv -f "$target" "${target}${keepsuffix}" }
mv -f "$temp" "$target"
fi