#!/bin/bash ####### # # Debootstrap Mirror Update Script # (c) Privex Inc. 2019 # ####### # Detect directory this script is running from, for relative imports DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Mirrors to use for updating our mirrored copy UBUNTU_MIRROR="http://se.archive.ubuntu.com/ubuntu/" DEBIAN_MIRROR="http://ftp.se.debian.org/debian/" # Directory to create debootstrap mirrors (no ending slash) BASE_DIR="/filesrv/web/images/bootstrap" ## # Distro versions to mirror ## UBUNTU_RELEASES=( xenial bionic ) DEBIAN_RELEASES=( stretch jessie ) ## # CPU architectures to mirror ## ARCHS=( amd64 ) ## # Additional packages to include in the debootstraps ## source "$DIR/debootstrap_conf.sh" for a in "${ARCHS[@]}"; do for r in "${UBUNTU_RELEASES[@]}"; do d="${BASE_DIR}/ubuntu/dbs/$a/$r" echo "===================================================" echo "===================================================" echo "===================================================" echo " Updating distro 'Ubuntu $r $a'" echo " $d" echo "===================================================" echo "===================================================" echo "===================================================" [[ ! -d "$d" ]] && mkdir -pv "$d" debootstrap --components="$UBUNTU_COMPONENTS" \ --include="$UBUNTU_PKGS" --download-only \ --arch="$a" --make-tarball="${d}.tgz" "$r" "$d" "$UBUNTU_MIRROR" done for r in "${DEBIAN_RELEASES[@]}"; do d="${BASE_DIR}/debian/dbs/$a/$r" echo "===================================================" echo "===================================================" echo "===================================================" echo " Updating distro 'Debian $r $a'" echo " $d" echo "===================================================" echo "===================================================" echo "===================================================" [[ ! -d "$d" ]] && mkdir -pv "$d" debootstrap --components="$DEBIAN_COMPONENTS" \ --include="$DEBIAN_PKGS" --download-only \ --arch="$a" --make-tarball="${d}.tgz" "$r" "$d" "$DEBIAN_MIRROR" done done