-
-
Notifications
You must be signed in to change notification settings - Fork 466
Expand file tree
/
Copy pathcheckupdate
More file actions
executable file
·106 lines (89 loc) · 2.19 KB
/
Copy pathcheckupdate
File metadata and controls
executable file
·106 lines (89 loc) · 2.19 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
DATA='/data'
RUNTIME=$DATA'/runtime'
copyToBackUp()
{
backup_dir='/data/backup_tmp'
backup_dir_pkl='/data/backup_tmp/pkl'
rm -rf $backup_dir
mkdir -p $backup_dir_pkl
DIR='/data/runtime/facenet/src'
DB=$DIR'/data.sqlite'
if [ -f $DB ];then
echo "copy to ..."
mv $DB $backup_dir
fi
PB=$(find $DIR'/faces/' -name '*.pb')
for i in $PB
do
dir=$(dirname $i)
cp $dir $backup_dir
done
embedding=$(find $DIR'/faces' -name "face_embedding")
for file in $embedding
do
#file = faces/46a3066390c153bba8b9037b/front/face_embedding
dir=$(dirname $file)
#dir = faces/46a3066390c153bba8b9037b/front
#do not backup tmp_data
result=$(echo $dir | grep "tmp_data")
if [ $result"x" != "x" ]
then
continue
fi
dir=$(dirname $dir)
#dir = faces/46a3066390c153bba8b9037b
if [ -d $dir ]
then
echo "copy "$dir" to "$backup_dir_pkl
mv $dir $backup_dir_pkl
fi
done
if [ -d $DIR'/face_testdataset' ]
then
mv $DIR'/face_testdataset' $backup_dir
fi
}
copyFromBackUp()
{
backup_dir='/data/backup_tmp'
backup_dir_pkl='/data/backup_tmp/pkl'
DIR='/data/runtime/facenet/src'
DB=$backup_dir'/data.sqlite'
if [ -f $DB ];then
echo "copy to ..."
mv $DB $DIR'/data.sqlite'
fi
PB=$(find $backup_dir -name '*.pb')
for i in $PB
do
dir=$(dirname $i)
dirname=$(basename $dir)
rm -rf $DIR'/faces/'$dirname
mv $dir $DIR'/faces/'
done
result=$(find $backup_dir_pkl -maxdepth 1 -mindepth 1)
for i in $result
do
echo "cp "$i" "$DIR"/faces"
dirname=$(basename $i)
rm -rf $DIR'/faces/'$dirname
mv $i $DIR'/faces'
done
if [ -d $backup_dir'/face_testdataset' ]
then
rm -rf $DIR'/face_testdataset'
mv $backup_dir'/face_testdataset' $DIR
fi
}
if [ -f $DATA/needupdate ]; then
echo "Updating"
cd $RUNTIME
copyToBackUp
git reset --hard origin/master
git clean -f -d
git merge origin/master
cd ..
rm -f $DATA/needupdate
copyFromBackUp
fi