/
properties-pull.sh
executable file
·66 lines (53 loc) · 1.34 KB
/
properties-pull.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#
# Pull missing properties files from {list_in}
# into 'src' tree file targets
#
# Copy written target file path names to {list_out}
# (git adds)
gwt_dir=~/src/google-web-toolkit
dev_dir=${gwt_dir}/trunk/dev
core_dir=${dev_dir}/core
list_in="properties.txt"
list_out="properties-pull.txt"
for tgt in $(egrep -v '^#' ${list_in} )
do
echo ${tgt}
src=${core_dir}/${tgt}
if 2>/dev/null cp -p $src $tgt
then
if ! git add ${tgt}
then
echo "Warning, 'git add ${tgt}' failed"
fi
echo ${tgt} ${src}
echo ${tgt} >> ${list_out}
else
tgtd=$(dirname ${tgt})
if [ ! -d ${tgtd} ]
then
if mkdir -p ${tgtd}
then
if cp -p $src $tgt
then
if ! git add ${tgt}
then
echo "Warning, 'git add ${tgt}' failed"
fi
echo ${tgt} ${src}
echo ${tgt} >> ${list_out}
else
echo "Failure in 'cp $src $tgt'"
exit 1
fi
else
echo "Failure in 'mkdir -p $tgtd'"
exit 1
fi
else
echo "Failure in 'cp $src $tgt'"
exit 1
fi
fi
done
exit 0