Skip to content

Instantly share code, notes, and snippets.

@zisk
Created December 4, 2017 21:44
Show Gist options
  • Save zisk/6571c4cd6dc348c238ba1cb8fab1a0d2 to your computer and use it in GitHub Desktop.
Save zisk/6571c4cd6dc348c238ba1cb8fab1a0d2 to your computer and use it in GitHub Desktop.
#!/bin/bash
logpath=/var/log/mirrorsync
menu=$1
dfolder=/mnt/ISOs
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
arch () {
rsync -avSHh --delete --log-file=$logpath/arch.log --no-motd mirror.us.leaseweb.net::archlinux/iso/ $dfolder/Arch/iso
}
centos () {
# --prune-empty-dirs --include=*/ --include=*.iso --exclude=*
rsync -avSHh --delete --log-file=$logpath/centos.log --no-motd --include=*/ --exclude "SCL*" --exclude "contrib*" --exclude "centosplus*" --exclude "cr*" --exclude "fasttrack*" --exclude "xen4*" --include=*.iso --exclude=* --prune-empty-dirs mirror.cs.pitt.edu::centos/6* $dfolder/CentOS/
rsync -avSHh --delete --log-file=$logpath/centos.log --no-motd --prune-empty-dirs --include=*/ --include=*.iso --exclude "SCL*" --exclude "contrib*" --exclude "centosplus*" --exclude "cr*" --exclude "fasttrack*" --exclude "xen4*" --exclude=* mirror.cs.pitt.edu::centos/7* $dfolder/CentOS/
}
debian () {
rsync -avSHh --delete --log-file=$logpath/debian.log --no-motd mirror.us.leaseweb.net::debian-cd/current/amd64 $dfolder/Debian/current
}
ubuntu () {
rsync -avSHh --delete --log-file=$logpath/ubuntu.log --no-motd mirror.us.leaseweb.net::ubuntu-releases $dfolder/Ubuntu
}
fedora () {
rsync -avSHh --log-file=$logpath/fedora.log --no-motd --exclude "armhfp*" --exclude "source*" --exclude "debug*" --delete rsync://mirror.cs.pitt.edu/fedora/linux/releases/24/ $dfolder/Fedora/24
}
kali () {
rsync -avSHh --delete --no-motd --log-file=$logpath/kali.log --exclude "*armel*" --exclude "*armhf*" ftp.halifax.rwth-aachen.de::kali-images $dfolder/Kali
}
knoppix () {
rsync -avSHh --delete --log-file=$logpath/knoppix.log --exclude "*DE*" --no-motd mirror.us.leaseweb.net::knoppix/ $dfolder/Knoppix/
}
mint () {
rsync -avSHh --delete --log-file=$logpath/mint.log --include "18" --exclude "*/" --no-motd ftp.heanet.ie::pub/linuxmint.com/stable/ $dfolder/Mint
}
sync () {
if [ -f /var/lock/subsys/rsync_updates ]; then
echo "Updates via rsync already running."
exit 0
fi
if [ -d $dfolder ] ; then
touch /var/lock/subsys/rsync_updates
$*
/bin/rm -f /var/lock/subsys/rsync_updates
else
echo "Target directory not found!"
fi
}
if [ "$menu" = m ] ;
then
echo "Manual Sync Menu"
echo "[1] Arch"
echo "[2] CentOS"
echo "[3] Debian"
echo "[4] Ubuntu"
echo "[5] Fedora"
echo "[6] Kali"
echo "[7] Knoppix"
echo "[8] Mint"
echo "[0] Exit"
echo
echo "Please select: "
read synct
case $synct in
1) sync arch; exit ;;
2) sync centos; exit ;;
3) sync debian; exit ;;
4) sync ubuntu; exit ;;
5) sync fedora; exit ;;
6) sync kali; exit ;;
7) sync knoppix; exit ;;
8) sync mint; exit ;;
*) echo "Exiting"; exit ;;
esac
fi
sync arch
sync centos
sync debian
sync ubuntu
# sync fedora
sync kali
sync knoppix
#sync mint
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment