Skip to content

Instantly share code, notes, and snippets.

@thewisenerd
Created June 12, 2016 04:43
Show Gist options
  • Save thewisenerd/c0a86ad144c67c64060dab63c27c2e8e to your computer and use it in GitHub Desktop.
Save thewisenerd/c0a86ad144c67c64060dab63c27c2e8e to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
#cat /var/log/pacman.log | grep "\[ALPM\] installed" | sed 's/\[ALPM\] installed//g' | sed 's/ \((.\+)\)$//gm' > listPacmanLog
# pacman log - goes all the way back to first install
# get only install not updates
cat /var/log/pacman.log | grep "\[ALPM\] installed" | sed 's/\[ALPM\] installed//g' | sed 's/ \((.\+)\)$//gm' | sed 's/ / : /gm' > listPacmanLog
## todo: skip database backup if not needed
# find . -type f -name "pacman-$(date +'%Y-%m-%d')*"
if [ ! -e listYaourtLog ]; then
# backup database in current folder
yaourt -B
# put that in a file?
yaourt -Q --nocolor --backupfile | grep -v "core" | grep -v "extra" | grep -v "multilib" > listYaourtLog
fi
# read line by line
while IFS='' read -r line || [[ -n "$line" ]]; do
package=$( echo $line | cut -d':' -f3 | sed 's/^ //g' )
echo -n ${line}" : "
echo -n $( pacman -Qi "${package}" | grep "Description" | sed 's/Description : //g' | tr '\n' ' ' | sed 's/ $//g' )
echo -n " : "
if grep --quiet "${package}" ./listYaourtLog; then
echo "aur"
else
echo "cem"
fi
done < "listPacmanLog"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment