You are not logged in.
Pages: 1
Topic closed
I accidentaly remove whole /usr directory, so all installed apps are gone. I then installed the basic system from the install CD, all user and system configuration leave untouched. pacman even remember what packages were installed, when i try install some of the previously installed packages pacman says: this package is up to date, upgrade anyway Y/n? So all I must do to get my system up and running again is reinstall all previsously installed packages. Is there any way how to do this by a single command? Or some script? I don't want to reinstall all the packages one by one ...
Last edited by kotyz (2007-07-03 18:27:21)
Offline
If you're pacman database is not removed, you could use something like this
#! /bin/sh
for pkg in $(pacman -Q | cut -d' ' -f1); do
pacman -S --noconfirm $pkg
done
Offline
Database isn't removed, it seems to be completely OK. I only cleared cache with pacman -Scc, so I have all packages download again, but this really doesn't matter with my connection.
Offline
If you're pacman database is not removed, you could use something like this
#! /bin/sh for pkg in $(pacman -Q | cut -d' ' -f1); do pacman -S --noconfirm $pkg done
pacman would error out if he's using any non-repo pkgs (like stuff from unsuported AUR)
working on a script now, will edit when i get it working.
#!/bin/bash
pacman -Q | awk '{ print $1 }' > installed.tmp
for i in $(pacman -Qm | awk '{ print $1 }'); do
cat installed.tmp | sed "s/^$i\$//;" > installed.tmp.1
mv installed.tmp.1 installed.tmp
done
pacman -S --noconfirm `cat installed.tmp`
rm installed.tmp
i think that'll do the trick... just make sure you backup your /etc before hand, it might overwrite stuff.
Last edited by kano (2007-07-03 19:47:07)
\\ archlinux on a XPS M1530 //
Offline
Problem solved, my system is functional again. I found this advise on forum.archlinux.cz:
sudo pacman -Sy `pacman -Q | awk '{print $1}'`
Offline
#!/bin/bash pacman -Q | awk '{ print $1 }' > installed.tmp for i in $(pacman -Qm | awk '{ print $1 }'); do cat installed.tmp | sed "s/^$i\$//;" > installed.tmp.1 mv installed.tmp.1 installed.tmp done pacman -S --noconfirm `cat installed.tmp` rm installed.tmp
That could be simplified with the 'comm' command:
#!/bin/bash
pacman -Q | awk '{ print $1 }' | sort > /tmp/pacman-installed.tmp
pacman -Qm | awk '{ print $1 }' | sort | comm -3 /tmp/pacman-installed.tmp - > /tmp/pacman-to-reinstall.tmp
pacman -S --noconfirm $(cat /tmp/pacman-to-reinstall.tmp)
rm /tmp/pacman-{to-reinstall,installed}.tmp
That should do the same thing... I think.
Last edited by Cerebral (2007-07-04 01:51:10)
Offline
That could be simplified with the 'comm' command:
#!/bin/bash pacman -Q | awk '{ print $1 }' | sort > /tmp/pacman-installed.tmp pacman -Qm | awk '{ print $1 }' | sort | comm -3 /tmp/pacman-installed.tmp - > /tmp/pacman-to-reinstall.tmp pacman -S --noconfirm $(cat /tmp/pacman-to-reinstall.tmp) rm /tmp/pacman-{to-reinstall,installed}.tmp
That should do the same thing... I think.
I'll have to remember that, thanks
\\ archlinux on a XPS M1530 //
Offline
Mefju's script worked for me. I had a similar issue. Thanks guys.
Offline
No need to use awk
pacman -S $(pacman -Qq) --noconfirm
But this method breaks the database structure, as all packages will be marked as explicitly installed. Not a big issue, but not elegant.
Here's the best way in my opinion (-e option lists explicitly installed packages):
pacman -S $(pacman -Qeq) --noconfirm
Last edited by swiftscythe (2011-09-19 18:23:33)
Offline
Moderator comment:
swiftscythe,
You do realize you are responding to a four year old thread? Don't worry, we have all done it -- just remember the policy though.
Closing
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed