Richard Felkl | 7ae81d6 | 2018-01-04 22:29:03 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | DEBMLOG=/var/log/debmirror.log |
| 4 | MIRRORDIR=/srv/aptly/public |
| 5 | |
| 6 | if test -s $DEBMLOG |
| 7 | then |
| 8 | test -f $DEBMLOG.3.gz && mv $DEBMLOG.3.gz $DEBMLOG.4.gz |
| 9 | test -f $DEBMLOG.2.gz && mv $DEBMLOG.2.gz $DEBMLOG.3.gz |
| 10 | test -f $DEBMLOG.1.gz && mv $DEBMLOG.1.gz $DEBMLOG.2.gz |
| 11 | test -f $DEBMLOG.0 && mv $DEBMLOG.0 $DEBMLOG.1 && gzip $DEBMLOG.1 |
| 12 | mv $DEBMLOG $DEBMLOG.0 |
| 13 | cp /dev/null $DEBMLOG |
| 14 | chmod 640 $DEBMLOG |
| 15 | fi |
| 16 | |
| 17 | # Record the current date/time |
| 18 | date 2>&1 | tee -a $DEBMLOG |
| 19 | |
| 20 | # Ubuntu General |
| 21 | echo "\n*** Ubuntu Mirror ***\n" 2>&1 | tee -a $DEBMLOG |
| 22 | debmirror --i18n --method=http --progress \ |
| 23 | --host=mirror.mirantis.com \ |
| 24 | $MIRRORDIR/ubuntu \ |
| 25 | --arch=amd64 \ |
| 26 | --dist=xenial,xenial-security,xenial-updates,xenial-backports \ |
| 27 | --root=$MCP_VERSION/ubuntu \ |
| 28 | --dist=main,multiverse,restricted,universe \ |
| 29 | --rsync-extra=none \ |
| 30 | --ignore-small-errors \ |
| 31 | --exclude-deb-section=games \ |
| 32 | --exclude-deb-section=gnome \ |
| 33 | --exclude-deb-section=graphics \ |
| 34 | --exclude-deb-section=kde \ |
| 35 | --exclude-deb-section=video \ |
| 36 | 2>&1 | tee -a $DEBMLOG |
| 37 | |
| 38 | echo "\n*** Fixing ownership ***\n" 2>&1 | tee -a $DEBMLOG |
| 39 | find $MIRRORDIR -type d -o -type f -exec chown aptly:aptly '{}' \; \ |
| 40 | 2>&1 | tee -a $DEBMLOG |
| 41 | |
| 42 | echo "\n*** Fixing permissions ***\n" 2>&1 | tee -a $DEBMLOG |
| 43 | find $MIRRORDIR -type d -o -type f -exec chmod u+rw,g+r,o+r-w {} \; \ |
| 44 | 2>&1 | tee -a $DEBMLOG |
| 45 | |
| 46 | echo "\n*** Mirror size ***\n" 2>&1 | tee -a $DEBMLOG |
| 47 | du -hs $MIRRORDIR 2>&1 | tee -a $DEBMLOG |
| 48 | |
| 49 | # Record the current date/time |
| 50 | date 2>&1 | tee -a $DEBMLOG |