I want to download package year wise. I have created the 18 copies of /etc/apt/sources.list with url of particular year. like using 2001 in 1st copy..using 2002 URL in second copy..and so on.

Now I want to automate the process of downloading the package, so I am trying to write a script, but I don't know to how to use the particular /etc/apt/sources.list file to downloading a particular year.

So far I have:

#! /bin/bash 
Read -p “Enter the name of the package: ” pkg
Mkdir $pkg
Cd $pkd
For i in {1..18}
    Do  mkdir §i
    Cd $i
    Sudo nano/etc/apt/sources.list{i} (this will open particular source.list 
    file.. but i dont know how to make that file as current file.)
    Sudo apt-get update
    Sudo apt-get source $pkg*.*
    Sloccout ./ (save output in some file- say file 1)

Suggest how to do this?

closed as unclear what you're asking by Jesse_b, Ipor Sircer, schily, Thomas, Rui F Ribeiro Jul 22 '18 at 15:39

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I don't really understand what you want to achieve. Even if you have the sources.list from last year, it doesn't mean you have the status on the server side from last year. With other words: that is kind of the point of the sources.list file. You have one (unchanged) and you can keep your server up to date, because the ftp servers are updated. – redseven Jul 21 '18 at 22:46
  • I would look into using something like what's mentioned in this Q - stackoverflow.com/questions/4419268/…. – slm Jul 21 '18 at 22:48
  • In /etc/apt/sources.list.d all files are current. If you want to download (or install) a particular version of a package there are other means which are more likely to work. – Jasen Jul 22 '18 at 2:30
  • ok.. how can i do that? what are other options? – Hazel Jul 22 '18 at 7:23