#!/bin/sh # update a partial Debian mirror with apt-move # 2004-02, W. Borgert # Released under the terms of the GNU General Public License # 2012-12 Modified by Jorge Suárez de Lis # the root directory of the mirror system CHROOT=/var/local/chroot-amd64 # the mirror directory inside of the chroot MIRRORDIR=/var/local/mirrors-amd64/ubuntu/dists/precise # master packages file inside of the chroot MASTER=/var/local/packages #### MODE=$1; shift case "$MODE" in clean) chroot $CHROOT apt-move delete exit 0 ;; search|policy|show) chroot $CHROOT_BASEDIR-$ARCH apt-cache $MODE $@ exit 0 ;; install) PACKAGES="$*" if [ -f $CHROOT/$MASTER ]; then OLDPACKAGES=`cat $CHROOT/$MASTER` else OLDPACKAGES= fi for p in $OLDPACKAGES $PACKAGES; do echo $p; done | \ sort -u > $CHROOT/$MASTER ;; upgrade) if [ -f $CHROOT/$MASTER ]; then PACKAGES=`cat $CHROOT/$MASTER` else exit 0 fi ;; *) echo "Usage:" echo "$0 clean" echo "$0 install " echo "$0 upgrade" echo "$0 search" echo "$0 policy " echo "$0 show " exit 1 ;; esac chroot $CHROOT apt-get update chroot $CHROOT apt-get -d --yes --reinstall install $PACKAGES chroot $CHROOT apt-move get chroot $CHROOT apt-move move chroot $CHROOT apt-move packages /usr/local/sbin/generate_release_files.sh -a $MIRRORDIR chroot $CHROOT apt-get autoclean