2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by scripts/Create-CopyPatch.
5 # T2 SDE: misc/target/functions.in
6 # Copyright (C) 2004 - 2021 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # copy, with special files
18 copy_with_list_from_file
()
20 ( cd $1 ; tar cSp
--no-recursion --files-from=$3 ) |
21 ( cd $2 ; tar xvSP
) |
22 ( x
=`wc -l` ; echo "$x files transfered." )
25 # copy out of T2 source without .svn files
30 # the sed is a work around for a find issue, outputting empty rows
31 # in some versions ...
32 find $1 -name '.svn' -prune -o -printf "%P\n" |
sed '/^$/d' > $list
34 copy_with_list_from_file
$1 $2 $list
39 # copy out of T2 source without .svn files and does honor special files to
40 # apply patches, change owner:group or permissions
42 copy_and_parse_from_source
()
44 # the sed is a work around for a find issue, outputting empty rows
45 # in some versions ...
46 find $1 -name '.svn' -prune -o -printf "%P\n" |
sed '/^$/d' |
sort |
49 if [ -h $1/$file ]; then
50 #echo "Symlink: $file"
51 cp -afv $1/$file $2/$file
52 elif [ -d $1/$file ]; then
57 if [[ $cmd = \
#\![a-y]* ]]; then
60 #echo "Code $code Command: $cmd File: $file"
61 args
=`echo $cmd | wc -w`
65 pushd $2/$dirname > /dev
/null
#; set -x
68 if [ $args -le 3 ]; then
74 if [ $args -le 2 ]; then
79 patch) patch -f < $1/$file
81 *) echo "Code: $code unknown" ; exit 1 ;;
84 elif [[ $cmd = \
#\!* ]]; then
86 cp -afv $1/$file $2/$file
90 cp -afv $1/$file $2/$file
96 # link indentical files to save space
97 link_identical_files
()
101 if [ "$oldck" = "$ck" -a -s $fn ] ; then
102 echo "\"$fn -> $oldfn\""
103 rm $fn ; ln $oldfn $fn
105 oldck
=$ck ; oldfn
=$fn
107 done < <( find -type f |
xargs md5sum |
sort )
108 ) |
( x
=`wc -l` ; echo "$x links created." )