#!/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 CHROOT64="/var/local/chroot-amd64" CHROOT32="/var/local/chroot-i386" # master packages file inside of the chroot MASTER="/var/local/packages" #### MODE=$1; shift case "$MODE" in clean) chroot $CHROOT64 apt-move delete exit 0 ;; search|policy|show) chroot $CHROOT64 apt-cache $MODE $@ exit 0 ;; install) PACKAGES="$*" if [ -f $CHROOT64/$MASTER ]; then OLDPACKAGES=`cat $CHROOT64/$MASTER` else OLDPACKAGES= fi for p in $OLDPACKAGES $PACKAGES; do echo $p; done | \ sort -u > $CHROOT64/$MASTER ;; upgrade) if [ -f $CHROOT64/$MASTER ]; then PACKAGES=`cat $CHROOT64/$MASTER` else exit 0 fi ;; *) echo "Usage:" echo "$0 clean" echo "$0 install " echo "$0 upgrade" exit 1 ;; esac # Sync amd64 and i386 config files and apt caches cp $CHROOT64/etc/apt/sources.list $CHROOT32/etc/apt/sources.list chroot $CHROOT32 apt-get update # Get all the packages chroot $CHROOT64 apt-get update chroot $CHROOT64 apt-get -d --yes --reinstall install $PACKAGES # Move i386 packages to the i386 chroot environment and get all dependencies cp -f $CHROOT64/var/cache/apt/archives/*_i386.deb $CHROOT32/var/cache/apt/archives/ PACKAGES_i386=$(cd $CHROOT32/var/cache/apt/archives/ && ls -1 *.deb | cut -d'_' -f1) chroot $CHROOT32 apt-get -d --yes --reinstall install $PACKAGES_i386 # Apt-move i386 chroot chroot $CHROOT32 bash -c "export LANG=C ; apt-move get" chroot $CHROOT32 bash -c "export LANG=C ; apt-move move" chroot $CHROOT32 bash -c "export LANG=C ; apt-move packages" chroot $CHROOT32 apt-get autoclean # Apt-move amd64 chroot chroot $CHROOT64 bash -c "export LANG=C ; apt-move get" chroot $CHROOT64 bash -c "export LANG=C ; apt-move move" chroot $CHROOT64 bash -c "export LANG=C ; apt-move packages" chroot $CHROOT64 apt-get autoclean # Generate Release files /usr/local/sbin/generate_release_files.sh -a /var/local/mirrors-agregated/ubuntu/dists/precise