Files
packetary/create_mirror
2015-04-09 17:03:23 +03:00

38 lines
995 B
Bash
Executable File

#!/bin/bash
# This shell script was written in order to help you to create and maintain your
# local mirrors of MOS and/or Ubuntu. You could use this script as a cron job.
# Dependencies: rsync, wget, gpg, apt + dpkg-dev (only for partial Ubuntu mirror)
usage(){
cat <<EOF
Usage: create_mirror [-h|--help] | [mos|ubuntu]
Create and update local mirrors of MOS and/or Ubuntu.
-h| --help This help screen.
Actions could be one of:
mos Create/Update MOS local mirror only
ubuntu Create/Update Ubuntu local mirror only
If no parameters specified, script will Create/Update both MOS and Ubuntu mirrors.
EOF
}
if [[ ( "$1" == "--help" ) || ( "$1" == "-h" ) ]]; then
usage
exit 0
fi
BINROOT=$(dirname `readlink -f "$0"`)
. $BINROOT/config/common.cfg
mkdir -p ${MIRROR_ROOT}
mkdir -p ${LOG_ROOT}
[ "$1" != "ubuntu" ] && $BINROOT/deb-mirror $BINROOT/config/mos-ubuntu-updatesonly.cfg
[ "$1" != "mos" ] && $BINROOT/deb-mirror $BINROOT/config/ubuntu.cfg