2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: misc/tools-source/install_wrapper.sh
4 # Copyright (C) 2004 - 2023 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 if [ "$INSTALL_WRAPPER_NOLOOP" = 1 ]; then
19 echo "Found loop in install_wrapper: $0 $*" >&2
20 echo "INSTALL_WRAPPER_MYPATH=$INSTALL_WRAPPER_MYPATH"
25 export INSTALL_WRAPPER_NOLOOP
=1
27 logfile
="${INSTALL_WRAPPER_LOGFILE:-/dev/null}"
28 [ -z "${logfile##*/*}" -a ! -d "${logfile%/*}" ] && logfile
=/dev
/null
38 echo "$PWD:" >> $logfile
39 echo "* ${INSTALL_WRAPPER_FILTER:-No Filter.}" >> $logfile
40 echo "- $command $*" >> $logfile
42 if [ "${*/--target-directory//}" != "$*" ]; then
43 echo "= $command $*" >> $logfile
44 $command "$@"; exit $?
47 while [ $# -gt 0 ]; do
51 # split combined args, like -m755
52 for a
in `echo $1 | sed '/^-[^-]/ {s/^-//; s/\([^0-9-]\)/ -\1/g}'`; do
54 -g|
-m|
-o|
-S|
--group|
--mode|
--owner|
--suffix)
55 newcommand
="$newcommand $a $2"
59 if [[ $command != *install ]]; then
60 newcommand
="$newcommand $a"
64 : # skip -t for now, as we generate target filenames
67 newcommand
="$newcommand $a"
74 if [ -n "$destination" ]; then
75 sources
[sources_counter
++]="$destination"
83 [ -z "${destination##/*}" ] || destination
="$PWD/$destination"
85 if [ "$INSTALL_WRAPPER_FILTER" != "" ]; then
86 # normalize multiple / path separators to allow filters to just match
87 destination
="$(eval "echo \"$destination\" |
tr -s '/' |
$INSTALL_WRAPPER_FILTER" )"
90 if [ -z "$destination" -o $sources_counter -eq 0 ]; then
91 echo "+ $newcommand $destination" >> $logfile
92 $newcommand "$destination" || error
=$?
93 elif [ -d "$destination" ]; then
94 for source in "${sources[@]}"; do
95 thisdest
="${destination}"
96 [ ! -d "${source//\/\///}" ] && thisdest
="$thisdest/${source##*/}"
97 thisdest
="${thisdest//\/\///}"
98 [ "$INSTALL_WRAPPER_FILTER" != "" ] &&
99 thisdest
="$(eval "echo \"$thisdest\" |
$INSTALL_WRAPPER_FILTER" )"
100 if [ ! -z "$thisdest" ]; then
101 echo "+ $newcommand $source $thisdest" >> $logfile
102 $newcommand "$source" "$thisdest" || error
=$?
106 echo "+ $newcommand ${sources[*]} $destination" >> $logfile
107 $newcommand "${sources[@]}" "$destination" || error
=$?
110 echo "===> Returncode: $error" >> $logfile