sidux.com
Menu

News

Give back
Last 3 Contributions
30-11-2008 20.00
25-11-2008 100.00
25-11-2008 20.00

Donate


Sponsor
hetzner.de

Languages
Preferred language:



Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
mmj
Post subject: Download whole package resource for offline upgrade  PostPosted: Jan 06, 2008 - 11:11 PM



Joined: Dec 04, 2006
Posts: 21
Location: Baden
Status: Offline
Arrow 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
 
 View user's profile Send private message  
Reply with quote Back to top
skol
Post subject:   PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
mmj
Post subject:   PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
 
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2006-2008 by sidux e.V., 10407 Berlin, Kniprodestr. 104. sidux e.V. is a Berlin, Germany based non-profit foundation. Consult Impressum and Legal Terms for details. sidux™ is Free Software released under the GNU/GPL license and other compatible licenses.
powered by Zikula & Zafenio