2019-03-05 18:50:08 +00:00
|
|
|
#!/bin/bash
|
2019-09-13 10:31:57 +00:00
|
|
|
|
|
|
|
md5_source="2cp.md5"
|
|
|
|
md5_source_rm="2rm.md5"
|
|
|
|
|
|
|
|
md5_aim="aim.md5"
|
|
|
|
|
2019-09-13 10:36:24 +00:00
|
|
|
|
|
|
|
md5_aim_tmp="$(mktemp)"
|
|
|
|
cat "${md5_aim}" > $md5_aim_tmp
|
|
|
|
md5_source_tmp="$(mktemp)"
|
|
|
|
cat "${md5_source}" > $md5_source_tmp
|
|
|
|
echo "2cp file: '$md5_source_tmp'"
|
|
|
|
|
2019-03-19 16:21:53 +00:00
|
|
|
#wenn delete file exits -> handle deletons (importand for konflict handling
|
2019-09-13 10:31:57 +00:00
|
|
|
[ -f "${md5_source_rm}" ] && {
|
|
|
|
cat "${md5_source_rm}" | cut -c -32 | while read line; do
|
2019-09-13 10:36:24 +00:00
|
|
|
sed -i "/$line/d" "${md5_aim_tmp}"
|
2019-09-10 23:10:25 +00:00
|
|
|
done
|
2019-09-13 10:31:57 +00:00
|
|
|
cat "${md5_source_rm}" | cut -c 35- | while read line; do
|
2019-09-13 10:36:24 +00:00
|
|
|
l=$(grep " $line"$ "${md5_aim_tmp}")
|
2019-03-19 16:17:49 +00:00
|
|
|
[ -n "$l" ] && {
|
|
|
|
echo $l
|
|
|
|
md5=$(echo $l | cut -c -32)
|
2019-09-13 10:36:24 +00:00
|
|
|
sed -i "/$md5/d" "${md5_aim_tmp}"
|
2019-03-19 16:17:49 +00:00
|
|
|
}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:28:17 +00:00
|
|
|
#gleiche dateien anhand md5 aussortieren
|
2019-09-13 10:36:24 +00:00
|
|
|
cat "${md5_aim_tmp}" | cut -c -32 | while read line; do sed -i "/$line/d" "${md5_source_tmp}" ; done
|
2019-03-05 20:28:17 +00:00
|
|
|
|
|
|
|
#dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln
|
2019-03-05 20:32:31 +00:00
|
|
|
echo Konflicts:
|
|
|
|
echo
|
2019-09-13 10:36:24 +00:00
|
|
|
cat "${md5_aim_tmp}" | cut -c 35- | while read line; do
|
|
|
|
l=$(grep " $line"$ "${md5_source_tmp}" | tee -a konflicts)
|
2019-03-05 20:32:31 +00:00
|
|
|
[ -n "$l" ] && {
|
|
|
|
echo $l
|
|
|
|
md5=$(echo $l | cut -c -32)
|
2019-09-13 10:36:24 +00:00
|
|
|
sed -i "/$md5/d" "${md5_source_tmp}"
|
2019-03-05 20:32:31 +00:00
|
|
|
}
|
2019-03-05 20:28:17 +00:00
|
|
|
done
|