-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup_from_home_cyg
executable file
·60 lines (51 loc) · 1.82 KB
/
backup_from_home_cyg
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
#!/usr/bin/env bash
#
#
# https://superuser.com/questions/660191/how-to-check-if-cygwin-mintty-bash-is-run-as-administrator
if $(id -G | grep -qE '\<(114|544)\>')
then
echo "running as admin"
else
echo "not admin"
exit 1
fi
SOURCE_VOL=elvis
SOURCE_DRIVE=g
BACKUP_VOL=clash
BACKUP_DRIVE=f
cd /cygdrive
g_str=$(cat $BACKUP_DRIVE/VOLUME.txt)
f_str=$(cat $SOURCE_DRIVE/VOLUME.txt)
if [ "$f_str" != ${SOURCE_VOL} ]; then
echo "/cygdrive/$SOURCE_DRIVE is not ${SOURCE_VOL} volume, is $f_str"
exit 1
else
echo found ${SOURCE_VOL}
fi
if [ "$g_str" != ${BACKUP_VOL} ]; then
echo "/cygdrive/$BACKUP_DRIVE is not ${BACKUP_VOL} volume, is $g_str"
exit 1
else
echo found ${BACKUP_VOL}
fi
# copy from home (CLash) to Elvis
#
RSYNC_CMD='rsync -av --delete --no-owner --no-group --ignore-errors'
${RSYNC_CMD} ${BACKUP_DRIVE}/backup ${SOURCE_DRIVE}/from_home | delete_dir_lines_from_rsync
echo "copy itunes forward - new"
# rsync -av --delete --ignore-errors ${SOURCE_DRIVE}/itunes ${BACKUP_DRIVE}/andrew_itunes
${RSYNC_CMD} ${BACKUP_DRIVE}/andrew_itunes/itunes/Music ${SOURCE_DRIVE}/itunes | delete_dir_lines_from_rsync
echo "copy docs to andrew_docs"
${RSYNC_CMD} ${SOURCE_DRIVE}/docs ${BACKUP_DRIVE}/andrew_docs | delete_dir_lines_from_rsync
echo "copy git stuff"
${RSYNC_CMD} ${SOURCE_DRIVE}/backups ${BACKUP_DRIVE}/git_backups | delete_dir_lines_from_rsync
# backup downloads
echo "downloads..."
${RSYNC_CMD} ${SOURCE_DRIVE}/downloads ${BACKUP_DRIVE}/andrew_downloads | delete_dir_lines_from_rsync
# backup dvd
echo "fulldisc ..."
${RSYNC_CMD} ${BACKUP_DRIVE}/dvd/FullDisc ${SOURCE_DRIVE}/dvd | delete_dir_lines_from_rsync
echo "movies ..."
${RSYNC_CMD} ${BACKUP_DRIVE}/dvd/handbrake_out/Movies ${SOURCE_DRIVE}/dvd | delete_dir_lines_from_rsync
# echo "dvd ..."
# rsync -av --delete --ignore-errors ${BACKUP_DRIVE}/dvd ${SOURCE_DRIVE}/dvd