Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
debmirror ubuntu
#!/bin/bash
CWD="/home/bigeagle/scripts/mirror"
SYNC_HOME="/home/mirror"
SYNC_FILES="$SYNC_HOME/ubuntu"
SYNC_LOCK="$SYNC_HOME/ubuntu.lck"
#SYNC_SERVER="rsync://mirrors.6.tuna.tsinghua.edu.cn/ubuntu/"
#SYNC_SERVER="rsync://mirrors6.ustc.edu.cn/ubuntu/"
LOG_FILE="/tmp/ubuntu.log"
[ -f $SYNC_LOCK ] && exit 1
touch $SYNC_LOCK
echo ">> Starting sync on $(date --rfc-3339=seconds)" > $LOG_FILE
arch="i386,amd64"
sections="main,main/debian-installer,multiverse,restricted,universe"
dists="precise,precise-backports,precise-proposed,precise-updates,precise-security,trusty,trusty-backports,trusty-proposed,trusty-updates,trusty-security"
server="mirrors6.ustc.edu.cn"
inPath="/ubuntu"
proto="rsync"
outpath="$SYNC_FILES"
debmirror -h $server -a $arch --no-source -s $sections -d $dists -r $inPath -e $proto --verbose $outpath >> $LOG_FILE
date --rfc-3339=seconds > "$SYNC_FILES/lastsync"
echo ">> Finished sync on $(date --rfc-3339=seconds)" >> "$LOG_FILE"
rm -f "$SYNC_LOCK"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.