| Author |
Message |
|
|
Post subject: Download whole package resource for offline upgrade
Posted: Jan 06, 2008 - 11:11 PM
|
|
Joined: Dec 04, 2006
Posts: 21
Location: Baden
Status: Offline
|
|
The tool apt-mirror makes exactly what my script should do. As I don't know any advantages of my script, I recommend using apt-mirror.
Hello,
I've wrote a Skript to sync Debian package resources to local storage.
In the last year I changed my appertment and cause my cohabitants and I don't managed it to apply for DSL we had no Internet for a few months. So I mirrored the official Debian package resource according to the Debian advice with anonftpsync. Soon I became ambitious and also want to have other ressources and it became tight on my external harddisk. So I wrote this own script. As I still handle with computers are limited to ISDN speed, I still use the script to pull them up-to-date from time to time.
This script downloades the given package lists and all packages listed in them.
features:
- you only load the packages, which are currently linked in the package list. Your pool will be complete, but there will be no unneeded files.
- you can choose each FTP/HTTP source aptitude/apt-get can handle with
- you can choose architectures, dists and sections
- due to using the original package lists the signatures stay well
- you can update your mirror. If you already have a mirror, only the changed packages will be downloaded; outdated packages will be removed
- the script nicely prints out, what it does. So just forward the output to a logfile.
disadvantages:
- the script can't check if packages loaded correctly. As far as I know the bash can't handle arrays. As I can't attach files to checksums this feature would result in very ugly spagetti code. If you have damaged files, you won't realize until you try to install them.
- cause I write it for my own, there are no comments
notes:
- have a look at the script! It erases your outdated files without request. If it can't read a package list or it is partial, the skript will erase all files it dosen't find in it. In a short time 20GB are gone. At the end of function getpgks() I added a request and commentet it out. It is not checked.
- I use Debian Lenny (testing). As I don't have sidux, I only can guess, that all workes well.
use:
The script starts with a few functions. Then there is a well commented block how to set the variables. At last there are a couple of sources I use. Thread them as examples.
If you have a suggestion, how to arrange filenames and checksums in a bash script without ugly tricks like alternating items or combining filenames and checksums: Let me know. Then I could add a function to check the integrity, or preselection according to a set of packages which needed to be able to install.
But: I'm not motivated to learn perl, etc. at the moment. I'm only familar with a small part of bash and algorithm in C++.
OK, then I hope you have a need of the script
mmj
P.S.: I don't know how the notify function exactly workes. Do I get a notify at each reply or only at the first? If I don't reply send me a PM. I will only react to e-mails and don't look by myself in the forum. |
Last edited by mmj on Jan 12, 2008 - 09:32 PM; edited 1 time in total
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 12, 2008 - 10:51 AM
|
|
Joined: Mar 18, 2007
Posts: 5
Location: Rhein-Main Gebiet
Status: Offline
|
|
|
Quote:
As far as I know the bash can't handle arrays.
Bash can handle arrays as well as Korn Shell using the name[subscript]=value syntax. Try man pages or any standard unix/linux handbook.
Quote:
I'm not motivated to learn perl, etc. at the moment. I'm only familar with a small part of bash and algorithm in C++.
You can do a lot with shell scripts. But they are not easy to maintain when they grow and become more and more sophisticated. Shell is not really a programming language.
In your case Java may be a choice for more sophisticated scripts? Or better avoid them?
For debian archives you don't need sophisticated scripts. Have a look at apt-move, apt-cacher, apt-proxy or apt-mirror. There are solutions for different sizes (1 - n machines) discussed in the forum.
Good Luck!
P.S.: Your script looks clean and functional. In this form, it's easy to maintain. When it fit's to your purpose - don't bother arrays. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 12, 2008 - 09:25 PM
|
|
Joined: Dec 04, 2006
Posts: 21
Location: Baden
Status: Offline
|
|
Well, I looked for a apt tool making such a mirror and found nothing. It seemes, I overlook apt-mirror. It makes exactly, what my script should do. For interest I will have a look at the array abilities of the bash. For getting a local mirror I will switch to apt-mirror.
Thanks. |
|
|
| |
|
|
|
 |
|
|
|
|