~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to tool/ifchange

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-05-16 12:37:06 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080516123706-r4llcdfd35aobrjv
Tags: 1.9.0.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.
* debian/control:
  - ruby1.9 pkg: moved rdoc1.9 suggestion to depends. (LP: #228345)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# usage: ifchange target temporary
 
3
 
 
4
target="$1"
 
5
temp="$2"
 
6
if [ "$temp" = - ]; then
 
7
    temp="tmpdata$$.tmp~"
 
8
    cat > "$temp" || exit $?
 
9
    trap 'rm -f "$temp"' 0
 
10
fi
 
11
if cmp "$target" "$temp" >/dev/null 2>&1; then
 
12
    echo "$target unchanged"
 
13
    rm -f "$temp"
 
14
else
 
15
    echo "$target updated"
 
16
    mv -f "$temp" "$target"
 
17
fi