wget command help to download packages from mirror

Index of /distribution/openSUSE-stable/repo/oss/suse/i586

How can i download packages with wget from that mirror with a string “alsa”?
Such as:
alsa-1.0.23-2.12.i586.rpm
alsa-devel-1.0.23-2.12.i586.rpm
alsa-oss-1.0.17-29.2.i586.rpm

[noparse]wget http://download.opensuse.org/distribution/openSUSE-stable/repo/oss/suse/i586/{alsa-1.0.23-2.12,alsa-devel-1.0.23-2.12,alsa-oss-1.0.17-29.2}.i586.rpm[/noparse]

The simple answer is:
wget http://download.opensuse.org/distribution/openSUSE-stable/repo/oss/suse/i586/alsa-1.0.23-2.12.i586.rpm

I’m guessing what you are really after is an automated way to parse the whole repo via http and wget them? In that case, you could use curl, then parse the output and feed the result set you want into wget with a for loop in bash.

Lews Therin

Not manually downloading packages.
But i’m trying to download packages that has a string/word “alsa”.
wget will automatically download those packages.

How can it be done?

for pkg in $(wget -O - [noparse]http://download.opensuse.org/distribution/openSUSE-stable/repo/oss/suse/i586/[/noparse] | sed -n '/alsa/s|.*href="\(.*\)\(.i586.rpm\).*|\1\2|p') ; do
    wget [noparse]http://download.opensuse.org/distribution/openSUSE-stable/repo/oss/suse/i586/$pkg[/noparse] 
done

It works … but that might be possible to do it just with wget command line.
man wget

colao wrote:
> How can i download packages with wget from that mirror with a string
> “alsa”?

does man wget not help?

does the following not work? did you try it?


wget [option] /*alsa*

is this homework?


DenverD
CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

Does not work. Gives a 404 Error.

On Tue, 30 Nov 2010 19:36:03 +0530, colao
<colao@no-mx.forums.opensuse.org> wrote:

>
> Not manually downloading packages.
> But i’m trying to download packages that has a string/word “alsa”.
> wget will automatically download those packages.
>
> How can it be done?
>

you can tell wget to download files according to regex. i did this once
for images, but don’t remember the syntax. instead of me looking this up
for you, i recommend “man wget”, which answers your question.


phani.

On Tue, 30 Nov 2010 21:36:02 +0530, Knurpht
<Knurpht@no-mx.forums.opensuse.org> wrote:

> Does not work. Gives a 404 Error.

of course, you can’t use wget like you would a bash command, specifying
reg.ex. as URL. wget tried to download from the exact location you
specified as argument, with asterisks and all: such an address doesn’t
exist, that’s what 404 means.

you’ll really have to read the manual on this if you want to use wget for
anything else than downloading one particular file. to in- or exclude
certain files, you use these command options (from the wget manual):


-A acclist --accept acclist
-R rejlist --reject rejlist
Specify comma-separated lists of file name suffixes or patterns to accept
or reject. Note that if any of the wildcard characters, *, ?,  or ],
appear in an element of acclist or rejlist, it will be treated as a
pattern, rather than a suffix.


phani.

On Tue, 30 Nov 2010 22:16:27 +0530, phanisvara <listmail@phanisvara.com>
wrote:

>


> -A acclist --accept acclist
> -R rejlist --reject rejlist
>  Specify comma-separated lists of file name suffixes or patterns to
> accept or reject. Note that if any of the wildcard characters, *, ?, 
> or ], appear in an element of acclist or rejlist, it will be treated as
> a pattern, rather than a suffix.
> 

i’m sorry, i have been writing nonsense. this allows you only to specify
file suffixes, not file names. (haven’t actually tried this out, but from
the man text it seems clear it’s only suffix, not filename.) then i’m
afraid i don’t know if or how this is possible with wget. since wget is
otherwise very complex, i’d be surprised if it couldn’t handle this (file
name patterns). my man file says it’s not the complete documentation for
wget:

For more complete information, including more detailed
explanations of some of the options, and a number of commands
available for use with .wgetrc files and the -e option, see the GNU Info
entry for wget.

i don’t have the time right now, but do believe the answer is in there
somewhere.


phani.

phanisvara wrote:
> since wget is otherwise very complex, i’d be surprised if it
> couldn’t handle this (file name patterns). my man file says it’s
> not the complete documentation for wget

somehow i GUESS we were/are helping the student/OP with his
homework…a task he should be required to figure out on his own…

otherwise, what is the point?


DenverD
CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

On Tue, 30 Nov 2010 17:54:45 +0000, DenverD wrote:

> phanisvara wrote:
>> since wget is otherwise very complex, i’d be surprised if it couldn’t
>> handle this (file name patterns). my man file says it’s not the
>> complete documentation for wget
>
> somehow i GUESS we were/are helping the student/OP with his homework…a
> task he should be required to figure out on his own…
>
> otherwise, what is the point?

I don’t see anything that makes me think this is someone asking the
community to do their homework for them. You know I agree that if that
is the case, of course they should be pointed in the right direction so
they can learn the answer.

But let’s not default to that assumption without some sort of evidence -
we don’t want to be seen as being unsupportive of people who are just
trying to learn how to use openSUSE. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On Tue, 30 Nov 2010 23:41:52 +0530, Jim Henderson
<hendersj@no-mx.forums.opensuse.org> wrote:

> I don’t see anything that makes me think this is someone asking the
> community to do their homework for them. You know I agree that if that
> is the case, of course they should be pointed in the right direction so
> they can learn the answer.

+1

don’t forget that there are people who don’t spend half their lives behind
a monitor. this question doesn’t seem to have an obvious answer and
requires some research. to find one’s way around SUSE documentation, man
files, and GNU info.txts may take some time.


phani.

Jim Henderson wrote:
> I don’t see anything that makes me think this is someone asking the
> community to do their homework for them.

just that s/he is a student, and since there are only 16 files in
that directory it is MUCH easier, rather than asking how, to just wget
the 16 one at a time by name (or easy copy paste file names into an
input file) and let’er rip…

> But let’s not default to that assumption without some sort of evidence -
> we don’t want to be seen as being unsupportive of people who are just
> trying to learn how to use openSUSE. :slight_smile:

you might note that i did provide a direction to go (over two hours
before the note you responded to) as had others before i asked a
second time if it was homework…

or are you saying that asking after helping is somehow unsupportive?

odd.

what other questions would you say we should not ask?


DenverD
CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

On Tue, 30 Nov 2010 18:37:46 +0000, DenverD wrote:

> Jim Henderson wrote:
>> I don’t see anything that makes me think this is someone asking the
>> community to do their homework for them.
>
> just that s/he is a student, and since there are only 16 files in that
> directory it is MUCH easier, rather than asking how, to just wget the 16
> one at a time by name (or easy copy paste file names into an input file)
> and let’er rip…

Plenty of options why they might want to script it - perhaps as a
specific instance of a more general ultimate goal.

>> But let’s not default to that assumption without some sort of evidence
>> - we don’t want to be seen as being unsupportive of people who are just
>> trying to learn how to use openSUSE. :slight_smile:
>
> you might note that i did provide a direction to go (over two hours
> before the note you responded to) as had others before i asked a second
> time if it was homework…

Yes, I did note that.

> or are you saying that asking after helping is somehow unsupportive?

No, I’m just saying let’s avoid the appearance of accusing students of
asking the community to do their homework for them when it may well not
be such a request. That’s all.

Please don’t read into my message any more than what is there.

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On Tue, 30 Nov 2010 18:37:46 +0000, DenverD wrote:

> just that s/he is a student

I certainly don’t get that from anything in this thread, but my crystal
ball is perhaps broken. (?)

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

I think the solution I provided at the start of this thread - of using curl to just return the html contents of the url, then parsing out the package names matching alsa, and feeding that into wget would be one possible solution. Of course there are many other ways.

Unless the person themselves shows some motivation to actually learn and understand the “how” of something better I typically think a short “man wget” or “man curl” is not inappropriate - point them in the right way and let them try. That’s how you learn! Who knows if this is homework or not, but in any event the person who originated the question can make the effort and relay the results.

I guess what I’m saying is the amount of support should be commensurate with the level of effort exerted by the person requesting it.

Lews Therin

Jim Henderson wrote:
>> student
> I certainly don’t get that from anything in this thread, but my crystal
> ball is perhaps broken. (?)

http://forums.opensuse.org/member.php?userid=35268


DenverD
CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

On Tue, 30 Nov 2010 20:39:21 +0000, DenverD wrote:

> Jim Henderson wrote:
>>> student
>> I certainly don’t get that from anything in this thread, but my crystal
>> ball is perhaps broken. (?)
>
> http://forums.opensuse.org/member.php?userid=35268

A student of computing? An accounting student? An engineering student?
A student at the school of hard knocks? That really doesn’t tell me
anything about what the OP is studying, nor does it give me any reason to
assume that the questions they ask are related to a homework assignment.

Again, the crystal ball isn’t telling me anything that would indicate
that this specific question or thread has anything to do with a homework
assignment.

If you want to discuss further, feel free to PM me, but let’s not derail
this thread any further than it already is.

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

@DD. Maybe we even have to accept, that joining a forum, asking questions, persisting in finding answers, are modern ways of doing your homework. About a year ago I realized that I probably learned more in about linux in the couple of years I hang around in these forums, than in 11 years of a day-to-day UNIX sysadmin job. For a teacher/trainer it’s quite easy to find out if a student is copying/having others do the work. A student that takes an effort to ask the proper questions in the proper place is already more than halfway. They’re the future of the communities.