docker-debmirror/run-debmirror.sh

81 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
set -eux
if [ "$UID" != "1000" ]; then echo "run this script as uid 1000"; exit 1; fi
BASEDIR=/data
#
# Don't touch the user's keyring, have our own instead
#
export GNUPGHOME=$BASEDIR/keyring
mkdir -p $GNUPGHOME
#gpg --no-default-keyring --keyring /media/realm/debmirror/keyring/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg
# 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=$MIRROR_ARCH
# amd64,i386
# 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=$MIRROR_SECTION
#main,restricted,universe,multiverse
# 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=$MIRROR_RELEASE
# 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=$MIRROR_SERVER
#server=archive.ubuntu.com
#server=mirror.pnl.gov
#server=mirrors.digitalocean.com
# Dir= -r # Path from the main server, so http://my.web.server/$dir, Server dependant
#
inPath=/ubuntu
# Proto= --method= # Protocol to use for transfer (http, ftp, hftp, rsync)
# Choose one - http is most usual the service, and the service must be avaialbe on the server you point at.
#
proto=$MIRROR_PROTO
# Outpath= # Directory to store the mirror in
# Make this a full path to where you want to mirror the material.
#
outPath=$BASEDIR/files
mkdir -p $outPath
# 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 \
--no-source \
-s $section \
-h $server \
-d $release \
-r $inPath \
--getcontents \
--progress \
--method=$proto \
$outPath
touch $BASEDIR/complete
date