Blame build-aux/install-sh

Packit 46089f
#!/bin/sh
Packit 46089f
# install - install a program, script, or datafile
Packit 46089f
Packit 46089f
scriptversion=2013-12-25.23; # UTC
Packit 46089f
Packit 46089f
# This originates from X11R5 (mit/util/scripts/install.sh), which was
Packit 46089f
# later released in X11R6 (xc/config/util/install.sh) with the
Packit 46089f
# following copyright and license.
Packit 46089f
#
Packit 46089f
# Copyright (C) 1994 X Consortium
Packit 46089f
#
Packit 46089f
# Permission is hereby granted, free of charge, to any person obtaining a copy
Packit 46089f
# of this software and associated documentation files (the "Software"), to
Packit 46089f
# deal in the Software without restriction, including without limitation the
Packit 46089f
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
Packit 46089f
# sell copies of the Software, and to permit persons to whom the Software is
Packit 46089f
# furnished to do so, subject to the following conditions:
Packit 46089f
#
Packit 46089f
# The above copyright notice and this permission notice shall be included in
Packit 46089f
# all copies or substantial portions of the Software.
Packit 46089f
#
Packit 46089f
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit 46089f
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit 46089f
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
Packit 46089f
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
Packit 46089f
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
Packit 46089f
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit 46089f
#
Packit 46089f
# Except as contained in this notice, the name of the X Consortium shall not
Packit 46089f
# be used in advertising or otherwise to promote the sale, use or other deal-
Packit 46089f
# ings in this Software without prior written authorization from the X Consor-
Packit 46089f
# tium.
Packit 46089f
#
Packit 46089f
#
Packit 46089f
# FSF changes to this file are in the public domain.
Packit 46089f
#
Packit 46089f
# Calling this script install-sh is preferred over install.sh, to prevent
Packit 46089f
# 'make' implicit rules from creating a file called install from it
Packit 46089f
# when there is no Makefile.
Packit 46089f
#
Packit 46089f
# This script is compatible with the BSD install script, but was written
Packit 46089f
# from scratch.
Packit 46089f
Packit 46089f
tab='	'
Packit 46089f
nl='
Packit 46089f
'
Packit 46089f
IFS=" $tab$nl"
Packit 46089f
Packit 46089f
# Set DOITPROG to "echo" to test this script.
Packit 46089f
Packit 46089f
doit=${DOITPROG-}
Packit 46089f
doit_exec=${doit:-exec}
Packit 46089f
Packit 46089f
# Put in absolute file names if you don't have them in your path;
Packit 46089f
# or use environment vars.
Packit 46089f
Packit 46089f
chgrpprog=${CHGRPPROG-chgrp}
Packit 46089f
chmodprog=${CHMODPROG-chmod}
Packit 46089f
chownprog=${CHOWNPROG-chown}
Packit 46089f
cmpprog=${CMPPROG-cmp}
Packit 46089f
cpprog=${CPPROG-cp}
Packit 46089f
mkdirprog=${MKDIRPROG-mkdir}
Packit 46089f
mvprog=${MVPROG-mv}
Packit 46089f
rmprog=${RMPROG-rm}
Packit 46089f
stripprog=${STRIPPROG-strip}
Packit 46089f
Packit 46089f
posix_mkdir=
Packit 46089f
Packit 46089f
# Desired mode of installed file.
Packit 46089f
mode=0755
Packit 46089f
Packit 46089f
chgrpcmd=
Packit 46089f
chmodcmd=$chmodprog
Packit 46089f
chowncmd=
Packit 46089f
mvcmd=$mvprog
Packit 46089f
rmcmd="$rmprog -f"
Packit 46089f
stripcmd=
Packit 46089f
Packit 46089f
src=
Packit 46089f
dst=
Packit 46089f
dir_arg=
Packit 46089f
dst_arg=
Packit 46089f
Packit 46089f
copy_on_change=false
Packit 46089f
is_target_a_directory=possibly
Packit 46089f
Packit 46089f
usage="\
Packit 46089f
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
Packit 46089f
   or: $0 [OPTION]... SRCFILES... DIRECTORY
Packit 46089f
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
Packit 46089f
   or: $0 [OPTION]... -d DIRECTORIES...
Packit 46089f
Packit 46089f
In the 1st form, copy SRCFILE to DSTFILE.
Packit 46089f
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
Packit 46089f
In the 4th, create DIRECTORIES.
Packit 46089f
Packit 46089f
Options:
Packit 46089f
     --help     display this help and exit.
Packit 46089f
     --version  display version info and exit.
Packit 46089f
Packit 46089f
  -c            (ignored)
Packit 46089f
  -C            install only if different (preserve the last data modification time)
Packit 46089f
  -d            create directories instead of installing files.
Packit 46089f
  -g GROUP      $chgrpprog installed files to GROUP.
Packit 46089f
  -m MODE       $chmodprog installed files to MODE.
Packit 46089f
  -o USER       $chownprog installed files to USER.
Packit 46089f
  -s            $stripprog installed files.
Packit 46089f
  -t DIRECTORY  install into DIRECTORY.
Packit 46089f
  -T            report an error if DSTFILE is a directory.
Packit 46089f
Packit 46089f
Environment variables override the default commands:
Packit 46089f
  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
Packit 46089f
  RMPROG STRIPPROG
Packit 46089f
"
Packit 46089f
Packit 46089f
while test $# -ne 0; do
Packit 46089f
  case $1 in
Packit 46089f
    -c) ;;
Packit 46089f
Packit 46089f
    -C) copy_on_change=true;;
Packit 46089f
Packit 46089f
    -d) dir_arg=true;;
Packit 46089f
Packit 46089f
    -g) chgrpcmd="$chgrpprog $2"
Packit 46089f
        shift;;
Packit 46089f
Packit 46089f
    --help) echo "$usage"; exit $?;;
Packit 46089f
Packit 46089f
    -m) mode=$2
Packit 46089f
        case $mode in
Packit 46089f
          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
Packit 46089f
            echo "$0: invalid mode: $mode" >&2
Packit 46089f
            exit 1;;
Packit 46089f
        esac
Packit 46089f
        shift;;
Packit 46089f
Packit 46089f
    -o) chowncmd="$chownprog $2"
Packit 46089f
        shift;;
Packit 46089f
Packit 46089f
    -s) stripcmd=$stripprog;;
Packit 46089f
Packit 46089f
    -t)
Packit 46089f
        is_target_a_directory=always
Packit 46089f
        dst_arg=$2
Packit 46089f
        # Protect names problematic for 'test' and other utilities.
Packit 46089f
        case $dst_arg in
Packit 46089f
          -* | [=\(\)!]) dst_arg=./$dst_arg;;
Packit 46089f
        esac
Packit 46089f
        shift;;
Packit 46089f
Packit 46089f
    -T) is_target_a_directory=never;;
Packit 46089f
Packit 46089f
    --version) echo "$0 $scriptversion"; exit $?;;
Packit 46089f
Packit 46089f
    --) shift
Packit 46089f
        break;;
Packit 46089f
Packit 46089f
    -*) echo "$0: invalid option: $1" >&2
Packit 46089f
        exit 1;;
Packit 46089f
Packit 46089f
    *)  break;;
Packit 46089f
  esac
Packit 46089f
  shift
Packit 46089f
done
Packit 46089f
Packit 46089f
# We allow the use of options -d and -T together, by making -d
Packit 46089f
# take the precedence; this is for compatibility with GNU install.
Packit 46089f
Packit 46089f
if test -n "$dir_arg"; then
Packit 46089f
  if test -n "$dst_arg"; then
Packit 46089f
    echo "$0: target directory not allowed when installing a directory." >&2
Packit 46089f
    exit 1
Packit 46089f
  fi
Packit 46089f
fi
Packit 46089f
Packit 46089f
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
Packit 46089f
  # When -d is used, all remaining arguments are directories to create.
Packit 46089f
  # When -t is used, the destination is already specified.
Packit 46089f
  # Otherwise, the last argument is the destination.  Remove it from $@.
Packit 46089f
  for arg
Packit 46089f
  do
Packit 46089f
    if test -n "$dst_arg"; then
Packit 46089f
      # $@ is not empty: it contains at least $arg.
Packit 46089f
      set fnord "$@" "$dst_arg"
Packit 46089f
      shift # fnord
Packit 46089f
    fi
Packit 46089f
    shift # arg
Packit 46089f
    dst_arg=$arg
Packit 46089f
    # Protect names problematic for 'test' and other utilities.
Packit 46089f
    case $dst_arg in
Packit 46089f
      -* | [=\(\)!]) dst_arg=./$dst_arg;;
Packit 46089f
    esac
Packit 46089f
  done
Packit 46089f
fi
Packit 46089f
Packit 46089f
if test $# -eq 0; then
Packit 46089f
  if test -z "$dir_arg"; then
Packit 46089f
    echo "$0: no input file specified." >&2
Packit 46089f
    exit 1
Packit 46089f
  fi
Packit 46089f
  # It's OK to call 'install-sh -d' without argument.
Packit 46089f
  # This can happen when creating conditional directories.
Packit 46089f
  exit 0
Packit 46089f
fi
Packit 46089f
Packit 46089f
if test -z "$dir_arg"; then
Packit 46089f
  if test $# -gt 1 || test "$is_target_a_directory" = always; then
Packit 46089f
    if test ! -d "$dst_arg"; then
Packit 46089f
      echo "$0: $dst_arg: Is not a directory." >&2
Packit 46089f
      exit 1
Packit 46089f
    fi
Packit 46089f
  fi
Packit 46089f
fi
Packit 46089f
Packit 46089f
if test -z "$dir_arg"; then
Packit 46089f
  do_exit='(exit $ret); exit $ret'
Packit 46089f
  trap "ret=129; $do_exit" 1
Packit 46089f
  trap "ret=130; $do_exit" 2
Packit 46089f
  trap "ret=141; $do_exit" 13
Packit 46089f
  trap "ret=143; $do_exit" 15
Packit 46089f
Packit 46089f
  # Set umask so as not to create temps with too-generous modes.
Packit 46089f
  # However, 'strip' requires both read and write access to temps.
Packit 46089f
  case $mode in
Packit 46089f
    # Optimize common cases.
Packit 46089f
    *644) cp_umask=133;;
Packit 46089f
    *755) cp_umask=22;;
Packit 46089f
Packit 46089f
    *[0-7])
Packit 46089f
      if test -z "$stripcmd"; then
Packit 46089f
        u_plus_rw=
Packit 46089f
      else
Packit 46089f
        u_plus_rw='% 200'
Packit 46089f
      fi
Packit 46089f
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
Packit 46089f
    *)
Packit 46089f
      if test -z "$stripcmd"; then
Packit 46089f
        u_plus_rw=
Packit 46089f
      else
Packit 46089f
        u_plus_rw=,u+rw
Packit 46089f
      fi
Packit 46089f
      cp_umask=$mode$u_plus_rw;;
Packit 46089f
  esac
Packit 46089f
fi
Packit 46089f
Packit 46089f
for src
Packit 46089f
do
Packit 46089f
  # Protect names problematic for 'test' and other utilities.
Packit 46089f
  case $src in
Packit 46089f
    -* | [=\(\)!]) src=./$src;;
Packit 46089f
  esac
Packit 46089f
Packit 46089f
  if test -n "$dir_arg"; then
Packit 46089f
    dst=$src
Packit 46089f
    dstdir=$dst
Packit 46089f
    test -d "$dstdir"
Packit 46089f
    dstdir_status=$?
Packit 46089f
  else
Packit 46089f
Packit 46089f
    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
Packit 46089f
    # might cause directories to be created, which would be especially bad
Packit 46089f
    # if $src (and thus $dsttmp) contains '*'.
Packit 46089f
    if test ! -f "$src" && test ! -d "$src"; then
Packit 46089f
      echo "$0: $src does not exist." >&2
Packit 46089f
      exit 1
Packit 46089f
    fi
Packit 46089f
Packit 46089f
    if test -z "$dst_arg"; then
Packit 46089f
      echo "$0: no destination specified." >&2
Packit 46089f
      exit 1
Packit 46089f
    fi
Packit 46089f
    dst=$dst_arg
Packit 46089f
Packit 46089f
    # If destination is a directory, append the input filename; won't work
Packit 46089f
    # if double slashes aren't ignored.
Packit 46089f
    if test -d "$dst"; then
Packit 46089f
      if test "$is_target_a_directory" = never; then
Packit 46089f
        echo "$0: $dst_arg: Is a directory" >&2
Packit 46089f
        exit 1
Packit 46089f
      fi
Packit 46089f
      dstdir=$dst
Packit 46089f
      dst=$dstdir/`basename "$src"`
Packit 46089f
      dstdir_status=0
Packit 46089f
    else
Packit 46089f
      dstdir=`dirname "$dst"`
Packit 46089f
      test -d "$dstdir"
Packit 46089f
      dstdir_status=$?
Packit 46089f
    fi
Packit 46089f
  fi
Packit 46089f
Packit 46089f
  obsolete_mkdir_used=false
Packit 46089f
Packit 46089f
  if test $dstdir_status != 0; then
Packit 46089f
    case $posix_mkdir in
Packit 46089f
      '')
Packit 46089f
        # Create intermediate dirs using mode 755 as modified by the umask.
Packit 46089f
        # This is like FreeBSD 'install' as of 1997-10-28.
Packit 46089f
        umask=`umask`
Packit 46089f
        case $stripcmd.$umask in
Packit 46089f
          # Optimize common cases.
Packit 46089f
          *[2367][2367]) mkdir_umask=$umask;;
Packit 46089f
          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
Packit 46089f
Packit 46089f
          *[0-7])
Packit 46089f
            mkdir_umask=`expr $umask + 22 \
Packit 46089f
              - $umask % 100 % 40 + $umask % 20 \
Packit 46089f
              - $umask % 10 % 4 + $umask % 2
Packit 46089f
            `;;
Packit 46089f
          *) mkdir_umask=$umask,go-w;;
Packit 46089f
        esac
Packit 46089f
Packit 46089f
        # With -d, create the new directory with the user-specified mode.
Packit 46089f
        # Otherwise, rely on $mkdir_umask.
Packit 46089f
        if test -n "$dir_arg"; then
Packit 46089f
          mkdir_mode=-m$mode
Packit 46089f
        else
Packit 46089f
          mkdir_mode=
Packit 46089f
        fi
Packit 46089f
Packit 46089f
        posix_mkdir=false
Packit 46089f
        case $umask in
Packit 46089f
          *[123567][0-7][0-7])
Packit 46089f
            # POSIX mkdir -p sets u+wx bits regardless of umask, which
Packit 46089f
            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
Packit 46089f
            ;;
Packit 46089f
          *)
Packit 46089f
            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
Packit 46089f
            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
Packit 46089f
Packit 46089f
            if (umask $mkdir_umask &&
Packit 46089f
                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
Packit 46089f
            then
Packit 46089f
              if test -z "$dir_arg" || {
Packit 46089f
                   # Check for POSIX incompatibilities with -m.
Packit 46089f
                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
Packit 46089f
                   # other-writable bit of parent directory when it shouldn't.
Packit 46089f
                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
Packit 46089f
                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
Packit 46089f
                   case $ls_ld_tmpdir in
Packit 46089f
                     d????-?r-*) different_mode=700;;
Packit 46089f
                     d????-?--*) different_mode=755;;
Packit 46089f
                     *) false;;
Packit 46089f
                   esac &&
Packit 46089f
                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
Packit 46089f
                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
Packit 46089f
                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
Packit 46089f
                   }
Packit 46089f
                 }
Packit 46089f
              then posix_mkdir=:
Packit 46089f
              fi
Packit 46089f
              rmdir "$tmpdir/d" "$tmpdir"
Packit 46089f
            else
Packit 46089f
              # Remove any dirs left behind by ancient mkdir implementations.
Packit 46089f
              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
Packit 46089f
            fi
Packit 46089f
            trap '' 0;;
Packit 46089f
        esac;;
Packit 46089f
    esac
Packit 46089f
Packit 46089f
    if
Packit 46089f
      $posix_mkdir && (
Packit 46089f
        umask $mkdir_umask &&
Packit 46089f
        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
Packit 46089f
      )
Packit 46089f
    then :
Packit 46089f
    else
Packit 46089f
Packit 46089f
      # The umask is ridiculous, or mkdir does not conform to POSIX,
Packit 46089f
      # or it failed possibly due to a race condition.  Create the
Packit 46089f
      # directory the slow way, step by step, checking for races as we go.
Packit 46089f
Packit 46089f
      case $dstdir in
Packit 46089f
        /*) prefix='/';;
Packit 46089f
        [-=\(\)!]*) prefix='./';;
Packit 46089f
        *)  prefix='';;
Packit 46089f
      esac
Packit 46089f
Packit 46089f
      oIFS=$IFS
Packit 46089f
      IFS=/
Packit 46089f
      set -f
Packit 46089f
      set fnord $dstdir
Packit 46089f
      shift
Packit 46089f
      set +f
Packit 46089f
      IFS=$oIFS
Packit 46089f
Packit 46089f
      prefixes=
Packit 46089f
Packit 46089f
      for d
Packit 46089f
      do
Packit 46089f
        test X"$d" = X && continue
Packit 46089f
Packit 46089f
        prefix=$prefix$d
Packit 46089f
        if test -d "$prefix"; then
Packit 46089f
          prefixes=
Packit 46089f
        else
Packit 46089f
          if $posix_mkdir; then
Packit 46089f
            (umask=$mkdir_umask &&
Packit 46089f
             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
Packit 46089f
            # Don't fail if two instances are running concurrently.
Packit 46089f
            test -d "$prefix" || exit 1
Packit 46089f
          else
Packit 46089f
            case $prefix in
Packit 46089f
              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
Packit 46089f
              *) qprefix=$prefix;;
Packit 46089f
            esac
Packit 46089f
            prefixes="$prefixes '$qprefix'"
Packit 46089f
          fi
Packit 46089f
        fi
Packit 46089f
        prefix=$prefix/
Packit 46089f
      done
Packit 46089f
Packit 46089f
      if test -n "$prefixes"; then
Packit 46089f
        # Don't fail if two instances are running concurrently.
Packit 46089f
        (umask $mkdir_umask &&
Packit 46089f
         eval "\$doit_exec \$mkdirprog $prefixes") ||
Packit 46089f
          test -d "$dstdir" || exit 1
Packit 46089f
        obsolete_mkdir_used=true
Packit 46089f
      fi
Packit 46089f
    fi
Packit 46089f
  fi
Packit 46089f
Packit 46089f
  if test -n "$dir_arg"; then
Packit 46089f
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
Packit 46089f
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
Packit 46089f
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
Packit 46089f
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
Packit 46089f
  else
Packit 46089f
Packit 46089f
    # Make a couple of temp file names in the proper directory.
Packit 46089f
    dsttmp=$dstdir/_inst.$$_
Packit 46089f
    rmtmp=$dstdir/_rm.$$_
Packit 46089f
Packit 46089f
    # Trap to clean up those temp files at exit.
Packit 46089f
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
Packit 46089f
Packit 46089f
    # Copy the file name to the temp name.
Packit 46089f
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
Packit 46089f
Packit 46089f
    # and set any options; do chmod last to preserve setuid bits.
Packit 46089f
    #
Packit 46089f
    # If any of these fail, we abort the whole thing.  If we want to
Packit 46089f
    # ignore errors from any of these, just make sure not to ignore
Packit 46089f
    # errors from the above "$doit $cpprog $src $dsttmp" command.
Packit 46089f
    #
Packit 46089f
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
Packit 46089f
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
Packit 46089f
    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
Packit 46089f
    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
Packit 46089f
Packit 46089f
    # If -C, don't bother to copy if it wouldn't change the file.
Packit 46089f
    if $copy_on_change &&
Packit 46089f
       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
Packit 46089f
       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
Packit 46089f
       set -f &&
Packit 46089f
       set X $old && old=:$2:$4:$5:$6 &&
Packit 46089f
       set X $new && new=:$2:$4:$5:$6 &&
Packit 46089f
       set +f &&
Packit 46089f
       test "$old" = "$new" &&
Packit 46089f
       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
Packit 46089f
    then
Packit 46089f
      rm -f "$dsttmp"
Packit 46089f
    else
Packit 46089f
      # Rename the file to the real destination.
Packit 46089f
      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
Packit 46089f
Packit 46089f
      # The rename failed, perhaps because mv can't rename something else
Packit 46089f
      # to itself, or perhaps because mv is so ancient that it does not
Packit 46089f
      # support -f.
Packit 46089f
      {
Packit 46089f
        # Now remove or move aside any old file at destination location.
Packit 46089f
        # We try this two ways since rm can't unlink itself on some
Packit 46089f
        # systems and the destination file might be busy for other
Packit 46089f
        # reasons.  In this case, the final cleanup might fail but the new
Packit 46089f
        # file should still install successfully.
Packit 46089f
        {
Packit 46089f
          test ! -f "$dst" ||
Packit 46089f
          $doit $rmcmd -f "$dst" 2>/dev/null ||
Packit 46089f
          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
Packit 46089f
            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
Packit 46089f
          } ||
Packit 46089f
          { echo "$0: cannot unlink or rename $dst" >&2
Packit 46089f
            (exit 1); exit 1
Packit 46089f
          }
Packit 46089f
        } &&
Packit 46089f
Packit 46089f
        # Now rename the file to the real destination.
Packit 46089f
        $doit $mvcmd "$dsttmp" "$dst"
Packit 46089f
      }
Packit 46089f
    fi || exit 1
Packit 46089f
Packit 46089f
    trap '' 0
Packit 46089f
  fi
Packit 46089f
done
Packit 46089f
Packit 46089f
# Local variables:
Packit 46089f
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit 46089f
# time-stamp-start: "scriptversion="
Packit 46089f
# time-stamp-format: "%:y-%02m-%02d.%02H"
Packit 46089f
# time-stamp-time-zone: "UTC"
Packit 46089f
# time-stamp-end: "; # UTC"
Packit 46089f
# End: