blob: a31ef095425bd092e73ae2aa3496d75357fea3b8 (
plain)
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
|
#!/bin/bash
#
# TODO: Make this work with data only.
# TODO: Restrict permissions to git from the home user.
# TODO: Work both remotely and locally.
# TODO: Ability to add / remove repositories
# TODO: Support key verification.
# TODO: Support keyrings for different projects.
mirror_files() {
TARGET=/mnt/hd/mirror
RSYNC_OPTS="\
--delete-excluded \
--hard-links \
--links \
--perms \
--recursive \
--safe-links \
--sparse \
--times \
"
# Slackware
mkdir --parents "$TARGET/slackware"
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware-15.0 "$TARGET/slackware/."
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware-15.0-iso "$TARGET/slackware/."
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware-current "$TARGET/slackware/."
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware64-15.0 "$TARGET/slackware/."
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware64-15.0-iso "$TARGET/slackware/."
rsync $RSYNC_OPTS rsync://mirrors.kernel.org/slackware/slackware64-current "$TARGET/slackware/."
# GNU
mkdir --parents "$TARGET/gnu"
rsync $RSYNC_OPTS rsync://mirror.cedia.org.ec/gnu/gnunet "$TARGET/."
rsync $RSYNC_OPTS rsync://mirror.cedia.org.ec/gnu/taler "$TARGET/."
}
mirror_git() {
TARGET=/srv/git/slackcoder
for fp in $(find $TARGET -name 'description' | xargs grep -l 'Mirror of' | xargs -n1 dirname); do
(cd $fp && \
echo $fp && \
git fetch origin "$(git branch --show-current)"
)
done
}
case "$1" in
'files')
mirror_files
;;
'git')
mirror_git
;;
*)
echo "usage $0 files|git"
esac
|