add a var TIMEOUT to repeatedly execute apt-mirror
This commit is contained in:
parent
9f972466de
commit
271994965f
22
mirror.list
22
mirror.list
|
|
@ -14,16 +14,16 @@ set _tilde 0
|
|||
#
|
||||
############# end config ##############
|
||||
|
||||
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
|
||||
#deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
|
||||
#deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
|
||||
deb http://tw.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
|
||||
deb http://tw.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
|
||||
deb http://tw.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
|
||||
#deb http://tw.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
|
||||
#deb http://tw.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
|
||||
|
||||
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
|
||||
deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
|
||||
deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
|
||||
#deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
|
||||
#deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
|
||||
deb-src http://tw.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
|
||||
deb-src http://tw.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
|
||||
deb-src http://tw.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
|
||||
#deb-src http://tw.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
|
||||
#deb-src http://tw.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
|
||||
|
||||
clean http://archive.ubuntu.com/ubuntu
|
||||
clean http://tw.archive.ubuntu.com/ubuntu
|
||||
|
|
|
|||
33
setup.sh
33
setup.sh
|
|
@ -2,18 +2,25 @@
|
|||
|
||||
# read mirror.list to link /var/www/package folder
|
||||
mkdir /var/www/package
|
||||
for i in `egrep -o 'https?://[^ ]+' /etc/apt/mirror.list`; do
|
||||
url=${i/http:\/\//''}
|
||||
target='/var/www/package/'
|
||||
|
||||
IFS='/' read -a distName <<< "$url"
|
||||
dest=$target${distName[-1]}
|
||||
if [ ! -h $dest ]; then
|
||||
echo "create $dest"
|
||||
ln -s /var/spool/apt-mirror/mirror/$url $dest
|
||||
fi
|
||||
done
|
||||
|
||||
sed -i '12s/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/package/' /etc/apache2/sites-enabled/000-default.conf
|
||||
service apache2 restart
|
||||
|
||||
apt-mirror && apache2ctl -D FOREGROUND
|
||||
while true; do
|
||||
|
||||
# parse mirror.list to share under /var/www/package path
|
||||
for i in `egrep -o '(rsync|ftp|https?)://[^ ]+' /etc/apt/mirror.list`; do
|
||||
url=${i/http:\/\//''}
|
||||
target='/var/www/package/'
|
||||
|
||||
IFS='/' read -a distName <<< "$url"
|
||||
dest=$target${distName[-1]}
|
||||
if [ ! -h $dest ]; then
|
||||
echo "create $dest"
|
||||
ln -s /var/spool/apt-mirror/mirror/$url $dest
|
||||
fi
|
||||
done
|
||||
|
||||
printf "\n\n====== wait $TIMEOUT to execute apt-mirror command ======\n\n"
|
||||
sleep $TIMEOUT
|
||||
apt-mirror
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue