support: added install_deps_ubuntu.sh
[rsync.git] / support / rsync-no-vanished
1 #!/usr/bin/env bash
2
3 REAL_RSYNC=/usr/bin/rsync
4 IGNOREEXIT=24
5 IGNOREOUT='^(file has vanished: |rsync warning: some files vanished before they could be transferred)'
6
7 # If someone installs this as "rsync", make sure we don't affect a server run.
8 for arg in "${@}"; do
9     if [[ "$arg" == --server ]]; then
10         exec $REAL_RSYNC "${@}"
11         exit $? # Not reached
12     fi
13 done
14
15 set -o pipefail
16
17 # This filters stderr without merging it with stdout:
18 { $REAL_RSYNC "${@}" 2>&1 1>&3 3>&- | grep -E -v "$IGNOREOUT"; ret=${PIPESTATUS[0]}; } 3>&1 1>&2
19
20 if [[ $ret == $IGNOREEXIT ]]; then
21     ret=0
22 fi
23
24 exit $ret