blob: ff84c12a4b56ca4ec5f2a91279c30c0299b8e8c7 [file] [log] [blame]
Richard Felkl7ae81d62018-01-04 22:29:03 +01001#!/bin/bash
2
3DEBMLOG=/var/log/debmirror.log
4MIRRORDIR=/srv/aptly/public
5
6if test -s $DEBMLOG
7then
8test -f $DEBMLOG.3.gz && mv $DEBMLOG.3.gz $DEBMLOG.4.gz
9test -f $DEBMLOG.2.gz && mv $DEBMLOG.2.gz $DEBMLOG.3.gz
10test -f $DEBMLOG.1.gz && mv $DEBMLOG.1.gz $DEBMLOG.2.gz
11test -f $DEBMLOG.0 && mv $DEBMLOG.0 $DEBMLOG.1 && gzip $DEBMLOG.1
12mv $DEBMLOG $DEBMLOG.0
13cp /dev/null $DEBMLOG
14chmod 640 $DEBMLOG
15fi
16
17# Record the current date/time
18date 2>&1 | tee -a $DEBMLOG
19
20# Ubuntu General
21echo "\n*** Ubuntu Mirror ***\n" 2>&1 | tee -a $DEBMLOG
22debmirror --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 \
362>&1 | tee -a $DEBMLOG
37
38echo "\n*** Fixing ownership ***\n" 2>&1 | tee -a $DEBMLOG
39find $MIRRORDIR -type d -o -type f -exec chown aptly:aptly '{}' \; \
402>&1 | tee -a $DEBMLOG
41
42echo "\n*** Fixing permissions ***\n" 2>&1 | tee -a $DEBMLOG
43find $MIRRORDIR -type d -o -type f -exec chmod u+rw,g+r,o+r-w {} \; \
442>&1 | tee -a $DEBMLOG
45
46echo "\n*** Mirror size ***\n" 2>&1 | tee -a $DEBMLOG
47du -hs $MIRRORDIR 2>&1 | tee -a $DEBMLOG
48
49# Record the current date/time
50date 2>&1 | tee -a $DEBMLOG