Skip to content

Instantly share code, notes, and snippets.

@sprhawk
Created March 10, 2021 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sprhawk/284df0c8a5c09df0df370abf3defea76 to your computer and use it in GitHub Desktop.
Save sprhawk/284df0c8a5c09df0df370abf3defea76 to your computer and use it in GitHub Desktop.
sync debian mirror
### reference to https://help.ubuntu.com/community/Debmirror
#!/bin/bash
#
# Don't touch the user's keyring, have our own instead
#
# export GNUPGHOME=/home/mirrorkeyring
# Arch= -a # Architecture. For Ubuntu can be i386, powerpc or amd64.
# sparc, only starts in dapper, it is only the later models of sparc.
#
arch=i386,amd64,arm64
# Minimum Ubuntu system requires main, restricted
# Section= -s # Section (One of the following - main/restricted/universe/multiverse).
# You can add extra file with $Section/debian-installer. ex: main/debian-installer,universe/debian-installer,multiverse/debian-installer,restricted/debian-installer
#
section=main,contrib,non-free,main/debian-installer
# Release= -d # Release of the system (...Hardy, Intrepid... Lucid, Precise, Quantal, Saucy, Trusty ), and the -updates and -security ( -backports can be added if desired)
# List of updated releases in: https://wiki.ubuntu.com/Releases
#
release=buster,buster-backports,buster-updates
# Server= -h # Server name, minus the protocol and the path at the end
# CHANGE "*" to equal the mirror you want to create your mirror from. au. in Australia ca. in Canada.
# This can be found in your own /etc/apt/sources.list file, assuming you have Ubuntu installed.
#
server=ftp.debian.org
# Dir= -r # Path from the main server, so http://my.web.server/$dir, Server dependant
#
inPath=/debian
# Proto= --method= # Protocol to use for transfer (http, ftp, hftp, rsync)
# Choose one - http is most usual the service, and the service must be available on the server you point at.
#
proto=rsync
# Outpath= # Directory to store the mirror in
# Make this a full path to where you want to mirror the material.
#
outPath=/var/userdata/Extended/debian-mirror/debian
keyring=/usr/share/keyrings/debian-archive-keyring.gpg
# The --nosource option only downloads debs and not deb-src's
# The --progress option shows files as they are downloaded
# --source \ in the place of --no-source \ if you want sources also.
# --nocleanup Do not clean up the local mirror after mirroring is complete. Use this option to keep older repository
# Start script
#
debmirror -a $arch \
-s $section \
-h $server \
-d $release \
-r $inPath \
--keyring=$keyring \
--progress \
--source \
--method=$proto \
$outPath
#### End script to automate building of Ubuntu mirror ####
sudo -u debmirror sh $HOME/sync-debian-mirror.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment