APT Mirror is intended to mirror the whole repository from mirror.list
entries only.
In a few sentences apt-mirror
works like this:
Gets index files from the repository and processes them (the same process as apt update
).
Downloads files from collected index files, if they do not exist locally. The folder structure is preserved in this process (similar to wget -c -x <url_file_array>
).
For more detailed information about how apt-mirror
works and for confirming that it is impossible to partially mirror the repository to get latest versions only, you can refer to The Source code of apt-mirror (Written in Perl).
So, what to do to get latest versions from large repositories?
My temporary workaround for your situation (taking for example, gitlab-ce
repository for Ubuntu 18.04 - Bionic):
Enter the path for mirroring:
cd /path/to/mirroring
Backup sources.list
:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
Open and comment every line in sources.list
:
sudo nano /etc/apt/sources.list
Add your desired repository(ies) for mirroring:
4.1. Add this to sources.list
and exit from the file: deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ bionic main
4.2. Add the GPG:
curl -L https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey | sudo apt-key add -
Update index files:
sudo apt update
Fetch latest packages url from added repository and write them to file:
sudo apt-get install '*' --allow-unauthenticated -y --print-uris | grep -o '\'http.*\' | tr "\'" " " > download-list
Download the urls with folder structure, because of -c
option, it will not download files that exist:
wget -i download-list -c -x
Enjoy!!!
For reverting everything back, just replace the sources.list
file with old sources.list.bak
and do:
sudo apt update