#!/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 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/." # Taler 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