You are not logged in.
I want to install Arch on my home PC which has no internet connection (yet).
I have only arch-0.7.1-base.iso but want to install all packages that are on my PC at company where I'm working.
I could bring all packages from work to home on my portable HDD, but...
I have only 20-30% of packages on my PC at work (deleted sometime with -Scc so only upgraded packages are in local database). I have Internet connection on my work so I could redownload all missed packages.
Now the question: how can I redownload all installed packages (without forcing reinstall) in easy way?
to live is to die
Offline
From the wiki :
Downloading a package without installing it:
pacman -Sw package_name
This should help you
Offline
pacman -Sw package_name
I know this from the day when I first Installed Arch.
But I have very much packages so typing all names by hand would be not easy. Maybe someone already has some little script for doing this?
to live is to die
Offline
for package in `pacman -Q | awk '{ print $1 }'`; do yes | pacman -Sw $package; done
Offline
Thank you very much! I'll try it!
to live is to die
Offline
Thank you for pointing me to the right direction.
Here is a better version:
for package in `pacman -Q | awk '{ print $1 }'`; do list="$list $package"; done; yes | pacman -Sw $list
or as in my redownload.sh:
#!/bin/sh
for package in `pacman -Q | awk '{ print $1 }'`; do
list="$list $package"
done
pacman -Sw $list
Added this to wiki: http://wiki.archlinux.org/index.php/Red … d_packages
to live is to die
Offline
Romshaka,
I didn't want to do it that way because, if you have too many packages installed, it might cause a the command line to have too many arguments and not succeed. Then again, I'm not sure what the limit on arguments is, but I know this happened to me once before with a script I was writing.
Your way, but simpler:
yes | pacman -Sw `pacman -Q | awk '{ print $1 }'`
Offline
If you want to use the script as a user instead of root, you can replace the last line with
wget $(pacman -Sp $list)
Offline
Yes, I thought about the command line length limit. I don't know which max length is allowed, but I've never get an error because of too much arguments. But I suppose that if someone has many packages installed an error may occur.
It is really interesting to know exactly what max allowed length is. Anyone knows where this info can be found? (except sources )
Mmm...
yes | pacman -Sw `pacman -Q | awk '{ print $1 }'`
is really much simple. How it didn't came into my mind? :oops:
Thank you for help.
P.S.: corrected Wiki page.
to live is to die
Offline
If you want to use the script as a user instead of root, you can replace the last line with
wget $(pacman -Sp $list)
Nice addition, thanks. IMO it is better to use -Sdp to skip useless dependency checks.
There is few problems:
1) pacman will show the size of all installed packages, so user will not know hom many files are missed
2) wget will download all installed packages (pacman will skip packages that already exist in /var/cache/pacman/pkg/)
It would be better to use this:
#!/bin/sh
for line in `pacman -Q | tr ' ' '/'`; do
name=`echo $line | awk -F '/' '{ print $1 }'`
file=`echo $line | awk -F '/' '{ print $1 "-" $2 }'`.pkg.tar.gz
if [ ! -e /var/cache/pacman/pkg/$file ]; do
list="$list $name"
fi
done
pacman -Sdw $list
wget version:
for line in `pacman -Q | tr ' ' '/'`; do
name=`echo $line | awk -F '/' '{ print $1 }'`
file=`echo $line | awk -F '/' '{ print $1 "-" $2 }'`.pkg.tar.gz
if [ ! -e /var/cache/pacman/pkg/$file ]; do
wget `pacman -Sdp $name`
fi
done
I know that this code is ugly but it works perfectly. Any suggestions how to improve it?
to live is to die
Offline
It tried suggested scripts, but my problem was that pacman failed because some of my packages are foreign ones from the AUR or self made PKGBUILDs.
So I made this little python script, works fine for me:
import string
import os
installed = [pkg.strip().split()[0] for pkg in os.popen("pacman -Q", "r")]
foreign = [pkg.strip().split()[0] for pkg in os.popen("pacman -Qm", "r")]
os.system("pacman -Sydw %s" % string.join(set(installed) - set(foreign)))
digiKam developer - www.digikam.org
Offline
Hi!
Today I wanted to download all packages I had installed to my system because of some corrupted file system. Anyway, I used the following command:
for package in `pacman -Q | awk '{ print $1 }'`; do yes | pacman -Sw $package; done
but unfortunately the new pacman just runs through every package and doesn't download anything at all. I had to use the command above because I also have packages from AUR installed through Yaourt and with all the other commands the problem always was that every version of pacman stopped the moment a file not existing in any of the repositories was requested.
So is there anything I have to change in order to have pacman download all installed packages again?
Thanks!
Offline
This will download all packages installed on your system to /var/cache/pacman/pkg, assuming the package doesn't exist there yet. If you want to download all new, fresh copies, sudo pacman -Scc first - that will clean out your cache directory.
for pkg in $(pacman -Q | awk '{ print $1 }'); do sudo pacman -Sdw --noconfirm ${pkg}; done
Last edited by Cerebral (2007-07-13 03:22:42)
Offline
can anyone make one for aurbuild? to redownload all installed packages, compile them and skipping those in cache?
does aur as a data base showing the installed packages?
thanks in advance! this script as shwn to be very usefull
Last edited by sickhate (2007-07-16 18:45:31)
Its a sick world we live in....
Offline