Maintenance

  • Home
  • Log in
  • « Jenkins mod_proxy setup
  • Added new disk to Papaya's LVM »

Apt-mirror postmirror script

Posted by gregster on 08 Apr 2014 in Servers, Activity log

In order to do an install from completely local resources we need to mirror files that apt-mirror ignores. Specifically, we need the udebs that are used in the debian-installer. To make sure we're up-to-date I've added a little extra to the postmirror script, but I was having trouble debugging a problem with it, so I rewrote it to be a bit tidier. The following creates the administrative layer that tells the debian-installer what files to look for and where they are. It basically mirrors the packages lists in each sub-directory in the apt tree. We still need to run the udebs script to get the udebs themselves.

################################## postmirror.sh ##########################################################
#!/bin/sh -x
# the udebs script gets the actual files we need
#/mnt/repo/apt-mirror/var/udebs.sh

# A quick apt directory structure primer:
# an apt server (e.g. archive.ubuntu.com) contains repositories (e.g. trusty-backports),
# which contain archives (e.g. multiverse), which contain directories
# a complete example - http://archive.ubuntu.com/ubuntu/dists/trusty-backports/multiverse/debian-installer/

# With this in mind, we create bash 'arrays' of the structure:
# server we're syncing against
MIRROR="archive.ubuntu.com"
# repositories we're mirroring
REPOS="trusty
trusty-updates
trusty-security
trusty-proposed
trusty-backports"
# archives in repositories
ARCHIVES="main
multiverse
restricted
universe"
# installer location inside archive
DIRECTORIES="debian-installer
dist-upgrader-all
installer-amd64
installer-i386"
#where we're storing it locally
LOCALDIR="/mnt/repo/apt-mirror/mirror/archive.ubuntu.com"

for REPO in $REPOS; do
    for ARCHIVE in $ARCHIVES; do
        for DIRECTORY in $DIRECTORIES;do
            # create directory structure
            if [ ! -e "$LOCALDIR/ubuntu/dists/$REPO/$ARCHIVE/$DIRECTORY" ]; then
                mkdir -p "$LOCALDIR/ubuntu/dists/$REPO/$ARCHIVE/$DIRECTORY"
            fi
            # do the sync
            rsync --recursive --times --links --hard-links --delete --delete-after \
            rsync://$MIRROR/ubuntu/dists/$REPO/$ARCHIVE/$DIRECTORY/ $LOCALDIR/ubuntu/dists/$REPO/$ARCHIVE/$DIRECTORY
        done
    done    
done
This entry was posted by Greg and filed under Servers, Activity log.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2026 by admin • Help • Run your own website!