You are not logged in.

#1 2009-07-18 07:02:31

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

[Solved] List AUR packages installed and only AUR packages.

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

#2 2009-07-18 07:03:23

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: [Solved] List AUR packages installed and only AUR packages.

pacman -Qm

Offline

#3 2009-07-18 08:49:52

tadzik
Member
From: &tadzik
Registered: 2009-07-17
Posts: 91

Re: [Solved] List AUR packages installed and only AUR packages.

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

#4 2009-07-18 18:41:52

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] List AUR packages installed and only AUR packages.

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

#5 2009-07-18 18:43:25

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: [Solved] List AUR packages installed and only AUR packages.

packup


.:[My Blog] || [My GitHub]:.

Offline

#6 2009-07-18 21:20:13

Square
Member
Registered: 2008-06-11
Posts: 435

Re: [Solved] List AUR packages installed and only AUR packages.

I recommend slurpy. It will do what you ask.

EDIT: Sorry, I misread. It won't hmm

Last edited by Square (2009-07-18 21:43:49)


 

Offline

#7 2009-07-18 21:37:00

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [Solved] List AUR packages installed and only AUR packages.

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)

Offline

#8 2009-07-18 22:51:29

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: [Solved] List AUR packages installed and only AUR packages.

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

#9 2009-07-21 05:03:55

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: [Solved] List AUR packages installed and only AUR packages.

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)")

Offline

#10 2009-07-21 11:55:25

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [Solved] List AUR packages installed and only AUR packages.

tdy wrote:
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 wink

Offline

#11 2009-07-21 12:28:13

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: [Solved] List AUR packages installed and only AUR packages.

brisbin33 wrote:

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 wink

I had skipped over some posts in the middle (i.e. #4) and didn't get why you posted that.. makes sense now.

Offline

#12 2009-08-07 03:06:35

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] List AUR packages installed and only AUR packages.

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

#13 2009-08-07 07:55:45

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [Solved] List AUR packages installed and only AUR packages.

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

#14 2009-10-30 14:31:17

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] List AUR packages installed and only AUR packages.

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 smile 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

#15 2009-10-31 14:19:17

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] List AUR packages installed and only AUR packages.

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

Board footer

Powered by FluxBB