-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup
executable file
·161 lines (148 loc) · 3.8 KB
/
backup
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# optional 1: 0=set init else projName 2: continue after projName
#stats/h,backup_paths,backup_is_pub,dbg
#overall!=1 and not -z to skip overall
#download with mime folder and .. 0
#retest backup_paths with: a=( `~/a/cat backup_paths` ); for b in "${a[@]}"; do stat -L ${b} || { echo error; break; } done; echo done
# 0 lines
no=( appimage.github.io LIEF box64 ming pyaudio gnome-shell-system-monitor-applet tmp bitstorm etcminer sync ruffle jpexs-decompiler wgpu egui )
# c75b874(and cpp_support/freetype_support) petcap/bitstorm +etcminer1/etcminer
if [ ! -e ~/stats/h ]; then echo ~/stats/h; exit 1; fi
yes=( `cat ~/stats/h` )
n=0;m=0
for var in "${yes[@]}"; do
m=$((m+1))
IFS='=' read -a addr <<< "${var}"
proj=${addr[0]}
a=0;i=0
for b in "${no[@]}"; do
if [ "${proj}" = "${b}" ]; then
no=( ${no[@]:0:i} ${no[@]:i+1} )
a=1
break
fi
i=$((i+1))
done
if [ $a = 0 ]; then
z[$n]=${proj}
n=$((n+1))
fi
done
echo ${m} ${n}
dst=~/dbg
i=0
if [ ! -e ~/backup_paths ]; then echo ~/backup_paths; exit 1; fi
if [ ! -e ~/backup_is_pub ]; then echo ~/backup_is_pub; exit 1; fi
paths=( `cat ~/backup_paths` )
is_pub=( `cat ~/backup_is_pub` )
mim=application/gzip
fold=arh
tmp=/tmp/dbgtmp
lang=`locale | grep LANG=`;lang=${lang#*=};lang=${lang%_*}
#overall=0
for var in "${z[@]}"; do
src=${paths[$i]}
dest=${dst}/${var}
if [ -z "${1}" ] || [ "${1}" = "${var}" ]; then
if [ -n "${2}" ]; then
shift
shift
i=$((i+1))
continue
fi
cd ${src} || exit 1
if [ ! -e ${dest} ]; then
mkdir ${dest} || exit 1
fi
response=0
while :; do
~/test/dbg ${var}
case $? in
0) break;;
1) response=1;break;;
*) response=1;;
esac
done
#still can have old files only in dest
echo second diff
diff -r ${dest} ${src} > ${tmp}
firstrow=`head -n 1 ${tmp}`
if [ "${firstrow}" != "Only in ${src}: .git" ]; then echo ${firstrow}; fi
tail -n +2 ${tmp}
has_extra=`tail -n +2 ${tmp}`
if [ -n "${has_extra}" ]; then
echo
z=( );j=0;is_ok=1
while read vr; do
if [ "${lang}" = "ro" ]; then
if [[ ( "${vr:0:7}" != "Doar în" ) || ( ${vr:8:${#src}} != ${src} ) ]]; then # .git .expected swf_backup localtest
is_ok=0
fi
else
if [[ ( "${vr:0:7}" != "Only in" ) || ( ${vr:8:${#src}} != ${src} ) ]]; then
is_ok=0
fi
fi
if [ ${is_ok} = 0 ]; then
a=( ${vr} )
if [ ${#a[@]} = 4 ]; then #only in
z[${j}]=${a[2]::-1}/${a[3]}
else #still in src but .gitignored there
z[${j}]=${a[2]}
fi
j=$((j+1))
is_ok=1
fi
done < ${tmp}
if [ $j != 0 ]; then
for vr in "${z[@]}"; do
echo ${vr}
rm -ri ${vr}
done
response=1
fi
fi
if [ "${response}" = 1 ]; then
if [ ${is_pub[$i]} = 1 ]; then
echo pub ${var}
anyone=1
else
echo priv ${var}
anyone=
fi
git status -s
echo diff
diff -r ${dest} ${src} > ${tmp}
tail -n +2 ${tmp}
echo push \? y \?
read -n1 -t $((60*60*24)) ans
rm ${tmp}
if [ "${ans}" = "y" ]; then
cd ${dst}
f=${var}.tar
fz=${f}.gz
tar -cf ${f} ${var}
gzip ${f}
mimeType="${mim}" folder="${fold}" anyone=${anyone} ~/test/google/a ${fz} || exit 1
rm ${fz}
if [ -z "${overall}" ]; then
overall=1
fi
else
echo no
exit 1
fi
fi
elif [ "${1}" = 0 ]; then
cd ${src}
echo ${var}
read -t $((60*60*24)) ans
echo " ${ans}" >> ~/backup_paths
echo " ${ans}" >> ~/backup_is_pub
fi
i=$((i+1))
done
if [ "${overall}" = 1 ]; then
f=~/arh/index.html
folder="${fold}" html=x ~/test/google/a 0 > ${f} && \
~/test/remote/ftp ${f} depozit
fi