2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: misc/tools-source/install_wrapper.sh
4 # Copyright (C) 2004 - 2022 The T2 SDE Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 PATH
="${PATH/:$INSTALL_WRAPPER_MYPATH:/:}"
14 PATH
="${PATH#$INSTALL_WRAPPER_MYPATH:}"
15 PATH
="${PATH%:$INSTALL_WRAPPER_MYPATH}"
17 filter
="${INSTALL_WRAPPER_FILTER:+|} $INSTALL_WRAPPER_FILTER"
19 if [ "$INSTALL_WRAPPER_NOLOOP" = 1 ]; then
21 echo "Found loop in install_wrapper: $0 $*" >&2
22 echo "INSTALL_WRAPPER_MYPATH=$INSTALL_WRAPPER_MYPATH"
27 export INSTALL_WRAPPER_NOLOOP
=1
29 logfile
="${INSTALL_WRAPPER_LOGFILE:-/dev/null}"
30 [ -z "${logfile##*/*}" -a ! -d "${logfile%/*}" ] && logfile
=/dev
/null
40 echo "$PWD:" >> $logfile
41 echo "* ${INSTALL_WRAPPER_FILTER:-No Filter.}" >> $logfile
42 echo "- $command $*" >> $logfile
44 if [ "${*/--target-directory//}" != "$*" ]; then
45 echo "= $command $*" >> $logfile
46 $command "$@"; exit $?
49 while [ $# -gt 0 ]; do
51 -g|
-m|
-o|
-S|
--group|
--mode|
--owner|
--suffix)
52 newcommand
="$newcommand $1 $2"
56 if [[ $command != *install ]]; then
57 newcommand
="$newcommand $1"
61 : # skip -t for now, as we generate target filenames
64 newcommand
="$newcommand $1"
67 if [ -n "$destination" ]; then
68 sources
[sources_counter
++]="$destination"
76 [ -z "${destination##/*}" ] || destination
="$PWD/$destination"
78 if [ "$filter" != " " ]; then
79 destination
="$( eval "echo \"$destination\" |
tr -s '/' $filter" )"
82 if [ -z "$destination" -o $sources_counter -eq 0 ]; then
83 echo "+ $newcommand $destination" >> $logfile
84 $newcommand "$destination" || error
=$?
85 elif [ -d "$destination" ]; then
86 for source in "${sources[@]}"; do
87 thisdest
="${destination}"
88 [ ! -d "${source//\/\///}" ] && thisdest
="$thisdest/${source##*/}"
89 thisdest
="${thisdest//\/\///}"
90 [ "$filter" != " " ] && thisdest
="$( eval "echo \"$thisdest\" $filter" )"
91 if [ ! -z "$thisdest" ]; then
92 echo "+ $newcommand $source $thisdest" >> $logfile
93 $newcommand "$source" "$thisdest" || error
=$?
97 echo "+ $newcommand ${sources[*]} $destination" >> $logfile
98 $newcommand "${sources[@]}" "$destination" || error
=$?
101 echo "===> Returncode: $error" >> $logfile