You are not logged in.
Here's a good one. Thought this would be easy but thought it over and then looked around a bit and haven't found anything. There's might just be an easy way to do this that will make me *bonk* my head in the morning but I haven't found it yet. I'm looking to be able to just list the packages I have installed from AUR and not any that I have gotten from the official repos. I've checked out some utilities in AUR (like AURcheck) but as far as I can tell they just look for AUR updates. Anyone know of a way to do this?
Last edited by Gen2ly (2009-10-30 14:32:22)
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
pacman -Qm
Offline
pacman -Qm shows only those installed locally, and AFAIK there is no other way. At least I haven't found any ; ) The thing is, packages aren't really marked as „build from aur", they're just those „installed locally".
Offline
Yeah, gonna have to do a reinstall and needed a database I could use to update from. Here's what I came up with:
#!/bin/bash
# paclist - creates list of all installed packages
# reinstall with pacman -S $(cat pkglist)
USER=gen2ly
pacman -Qqet | grep -v "$(pacman -Qqg base)" | grep -v "$(pacman -Qqm)" > /home/ $USER/Desktop/pkglist
# A list of local packages (includes AUR and locally installed)
pacman -Qm > /home/$USER/Desktop/pkglocallist
This will do, will probably have to reinstall AUR packages manually but no big deal.
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
I recommend slurpy. It will do what you ask.
EDIT: Sorry, I misread. It won't
Last edited by Square (2009-07-18 21:43:49)
Offline
pacman -Qqm lists foreign packages; which, for must users, means AUR
pacman -Qqe lists packages that were explicitely installed.
that said,
pacman -Qqe | grep -v "$(pacman -Qqm)" > pacman.lst
and
cat pacman.lst | xargs pacman -S --needed --noconfirm
are the best backup/restore lines i've seen (don't remember where i got them tho).
that will install only the packages you don't have installed already as well as pull in any needed deps. after that, -Syu and you're good to go.
/edit: typo
Last edited by brisbin33 (2009-07-18 21:37:32)
//github/
Offline
The ugliness of this might make some people want to shed tears, but: for x in `pacman -Qm`; do yaourt -Ss "$x" | grep 'aur/'; done
Last edited by Wintervenom (2009-07-18 22:52:51)
Offline
pacman -Qqe | grep -v "$(pacman -Qqm)" > pacman.lst
and
cat pacman.lst | xargs pacman -S --needed --noconfirm
just fyi, these can be combined into:
pacman -S --needed --noconfirm $(pacman -Qqe | grep -v "$(pacman -Qqm)")
Offline
brisbin33 wrote:pacman -Qqe | grep -v "$(pacman -Qqm)" > pacman.lst
and
cat pacman.lst | xargs pacman -S --needed --noconfirm
just fyi, these can be combined into:
pacman -S --needed --noconfirm $(pacman -Qqe | grep -v "$(pacman -Qqm)")
haha of course they could, but the idea is to do the first command as a daily backup... then you'll only run the second post-crash/reinstall.
besides, the above one liner will do nothing... because no packages will be --needed when the targets are built directly from the current -Qqe
//github/
Offline
haha of course they could, but the idea is to do the first command as a daily backup... then you'll only run the second post-crash/reinstall.
besides, the above one liner will do nothing... because no packages will be --needed when the targets are built directly from the current -Qqe
I had skipped over some posts in the middle (i.e. #4) and didn't get why you posted that.. makes sense now.
Offline
Thanks brisban pacman -Qqm was exactly what I was looking for as I'd like to be able to restore them with:
pacman -S --needed $(cat pkglist)
yaourt -S $(cat pkglocallist)
Oh and thanks for the --needed, hadn't thought of that.
Wow, Ghost, packup looks pretty cool. I'm gonna backup now and try it. Not sure how this is gonna go. I might have to do this manually. I got KDE installed and not sure just a pacman -Syu will do the trick. I'll get back.
Last edited by Gen2ly (2009-08-07 03:07:03)
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
Most of the grep lines have been just "grep -v ..."
The problem with that is that if you have "shortnameplus" in the list being filtered, and "shortname" in the filtering list, then "shortnameplus" is going to get suppressed.
Best to add a "-x" (match whole line) or "-w" (match words) to the filtering "grep -v".
Offline
I just got to reinstalling and this was a lifesaver - it worked great. Thank for the help, brisbin, ghost, Allan...
@Ghost, I would have used packup but I had a couple downgraded packages and I wanted to be able to troubleshoot it.
The tip about the grep -v doing 'shortnameplus' was a good tip, Profjim. I hadn't read this last post before and during the reinstall I was a bit surprised nvidia wasn't installed so... all is good now.
I created a script to be able to create the backup list and restores from it simliar to ghosts and am able to run it in cron job. Probably not a big deal, but... phhht. Here it is for anyone that can use it:
#!/bin/bash
# pacbac - Create and restore from list all installed packages
# Package list locations (official and local)
pkglsoff=/opt/backup/pc-emach/arch-pkglist-official
pkglsloc=/opt/backup/pc-emach/arch-pkglist-local
# Exclude packages
excldoff=()
excldloc=()
# Use filename as program name
prog=${0##*/}
# Text color variables
bldblu='\e[1;34m' # blue
bldred='\e[1;31m' # red
bldwht='\e[1;37m' # white
txtcyn='\e[0;36m' # cyan
txtund=$(tput sgr 0 1) # underline
txtrst='\e[0m' # text reset
info=${bldwht}*${txtrst}
pass=${bldblu}*${txtrst}
warn=${bldred}!${txtrst}
# If restoring, be sure yaourt is installed
if [[ "$1" == 'r' ]] && [[ -z $(pacman -Qs yaourt) ]]; then
echo ""
echo -e "$warn $prog requires ${txtund}}Yaourt${txtrst} to be installed."
echo -e " ${txtcyn}http://wiki.archlinux.org/index.php/Yaourt${txtrst}"
echo ""
exit
fi
case $1 in
b ) # Create list of official repository packages (core, extra, community)
echo -e "$info Creating list of official (core/extra/community packages) packages installed."
# Create list, remove local, base
pacman -Qqe | grep -vx "$(pacman -Qqg base)" | grep -vx "$(pacman -Qqm)" > "$pkglsoff"
# Create list of local packages (includes the AUR)
echo -e "$info Creating list of local (includes AUR) packages installed."
pacman -Qqm > "$pkglsloc"
echo -e "$pass Official package list saved to ${txtund}"$pkglsoff"${txtrst}"
echo -e "$pass Local package list saved to ${txtund}"$pkglsloc"${txtrst}" ;;
r ) # Update repository database, then restore packages from list
echo -e "$info Installing packages from lists"
sudo pacman -Sy
# use -f to overwrite conflicting files
sudo pacman -S --needed $(cat "$pkglsoff")
# Yaourt doesn't have --needed check
yaourt -S $(cat "$pkglsloc" | grep -vx "$(pacman -Qqm)") ;;
* ) echo -e " pacbac b - build installed packages list. (dir:${txtund}"${pkglsoff%/*}"${txtrst})"
echo -e " pacbac r - restore installed packages from package list." ;;
esac
Last edited by Gen2ly (2009-10-31 14:16:55)
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline
Fixed an error in the script, and cleaned up a bit.
I'd like to be able add excludes to an array and exclude them from the package list. 'grep -v' I don't think will work as it will only look at lines. Anyone have an idea on how to do this?
Last edited by Gen2ly (2009-10-31 14:19:55)
Setting Up a Scripting Environment | Proud donor to wikipedia - link
Offline