Re: a simple script for restoring downloaded debs
songbird wrote on 07/19/2014 16:23:
> Jörg-Volker Peetz wrote:
<snip>
>> Why not copy all files back and order something like "apt-get autoclean" to get
>> rid of the older packages?
>
> it's a rather huge archive (i think about 18000
> debs), but yes that would be another way of doing
> it. i think the flaw is that you would lose the
> local, obsolete or debs from unofficial sources
> that you no longer keep in the sources.list (but
> i would have to verify this).
>
Yes, you would lose them.
> the script looks to have gotten the job mostly
> done. i've added a bit to copy my local, obsolete
> and unofficial debs back from another archive and
> i think what remains are those debs that i somehow
> missed archiving. sometimes i have to get files
> via the library and USB stick.
>
>
> songbird
>
A note on your scipt:
If you build a pipe of grep, sed, and awk, it can often be done just with awk.
E.g., your line
debname=`apt-cache show $pkgname=$version | egrep '^Filename: ' | sed -e
's/^Filename: //' | awk --field-separator='/' -e '{print \$NF}'`
could be written as something like
debname=$(apt-cache show $pkgname="$version" | awk '/^Filename: /
{sub(".*/","", $2) ; print $2}')
saving the call of egrep and sed.
--
Regards,
jvp.
Reply to: