You are not logged in.

#1 2012-01-31 09:20:02

drsjlazar
Member
From: Kasama
Registered: 2009-10-01
Posts: 133
Website

[Script] Generate a download script for aria2c

Description: This is a bash script that will generate another script which can be run on another box with aria2c installed. The job of the generated script is to download all the packages required for a system upgrade.

Why?: My only internet connection right now is a tethered mobile connection with a 2GB cap. When something like KDE 4.8 hits the servers (and even otherwise), a full system upgrade is not feasible. However, my brother has uncapped internet at work. So... you get the picture.

Manual: The script is rather simple and self explanatory. You can change most of the options and settings by editing the variables defined in the 'setVars' function.  Dependencies?... bash, grep, sed, pacman and sudo on the Arch box to be upgraded; and bash and aria2c on the box used for downloading.

Suggestions are most welcome. If there is some other script or app that does this better, please do let me know.

Changelog:
v0.1: Initial release -->  http://pastebin.com/nWzhKggT

Offline

#2 2012-01-31 12:32:34

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Script] Generate a download script for aria2c

Alternatively, you can just print the urls and stuff them into a file that you can feed to wget or some other app.

[karol@black ~]$ sudo pacman -Syup
:: Synchronizing package databases...
 testing                    148,1 KiB   350K/s 00:00 [###########################] 100%
 community-testing          158,4 KiB   389K/s 00:00 [###########################] 100%
 core                       106,4 KiB  72,1K/s 00:01 [###########################] 100%
 extra                     1197,9 KiB   453K/s 00:03 [###########################] 100%
 community                 1056,4 KiB   207K/s 00:05 [###########################] 100%
 xyne-any is up to date
 archlinuxfr is up to date
 archstuff is up to date
 herecura-stable is up to date
 andrwe is up to date
 rfad is up to date
 heftig                       2,6 KiB  1436K/s 00:00 [###########################] 100%
:: Starting full system upgrade...
http://ftp5.gwdg.de/pub/linux/archlinux/testing/os/i686/gdk-pixbuf2-2.24.1-3-i686.pkg.tar.xz
http://ftp5.gwdg.de/pub/linux/archlinux/testing/os/i686/gtk-update-icon-cache-2.24.9-3-i686.pkg.tar.xz
http://ftp5.gwdg.de/pub/linux/archlinux/testing/os/i686/gtk2-2.24.9-3-i686.pkg.tar.xz
http://ftp5.gwdg.de/pub/linux/archlinux/testing/os/i686/kmod-4-2-i686.pkg.tar.xz
http://ftp5.gwdg.de/pub/linux/archlinux/core/os/i686/sudo-1.8.3.p2-2-i686.pkg.tar.xz

Offline

#3 2012-01-31 13:58:32

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [Script] Generate a download script for aria2c

karol wrote:
...
 xyne-any is up to date
 archlinuxfr is up to date
 archstuff is up to date
 herecura-stable is up to date
 andrwe is up to date
 rfad is up to date
 heftig                       2,6 KiB  1436K/s 00:00 [###########################] 100%
...

Off-topic: is there some competition I don't know about to see who runs the most unofficial repos? tongue

Last edited by tomk (2012-01-31 13:59:43)

Offline

#4 2012-01-31 14:19:07

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Script] Generate a download script for aria2c

I've got eight more commented out atm.
I'll be doing some cleanup in two days, trying things out, purging unused stuff.


Back on topic: until https://bugs.archlinux.org/task/20683 is fixed, you have to use e.g.

pacman -Su --quiet --print | sed 1,2d > update_list

to make it nicely scriptable.

Offline

#5 2012-01-31 14:27:24

drsjlazar
Member
From: Kasama
Registered: 2009-10-01
Posts: 133
Website

Re: [Script] Generate a download script for aria2c

karol wrote:

Alternatively, you can just print the urls and stuff them into a file that you can feed to wget or some other app.

Yeah, that's pretty much how I got the list of packages to download. But I also wanted to make use of aria2c's ability to download from multiple mirrors, have something I can repeat with one command and a script I could easily pass on requiring minimal effort on the part of the recipient.

About the bug, yes, I noticed that. I sed'd the extra line out somewhere...

Offline

#6 2012-01-31 15:01:53

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [Script] Generate a download script for aria2c

This is better suited in Community Contributions. Moving there.


To know or not to know ...
... the questions remain forever.

Offline

#7 2012-01-31 16:42:34

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Script] Generate a download script for aria2c

Have you seen pacman2aria2 from xyne-any unofficial repo?

[karol@black ~]$ pacman2aria2 -h
USAGE:
  pacman -Sp --print-format '%r %l' ... | /usr/bin/pacman2aria2 <reflector options> | aria2c -i - ...

  /usr/bin/pacman2aria2 accepts a formatted list of pacman package URLs from STDIN and then uses
  Reflector to generate a download list that can be passed to aria2c.

  The following help message is directly from Reflector. Most options apply,
  including all filtering options.

REFLECTOR HELP MESSAGE

usage: pacman2aria2 [-h] [--list-countries] [--save <filepath>]
                    [--sort {country,age,rate}] [--threads n] [-a n]
                    [-c <country>] [-f n] [--grep <regex>] [-l n] [-n n]
                    [-p <protocol>]

retrieve and filter a list of the latest Arch Linux mirrors
...

Offline

Board footer

Powered by FluxBB