Last active
August 29, 2015 14:14
-
-
Save sarum9in/ad8c4b77a94db0413683 to your computer and use it in GitHub Desktop.
revert_last
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
regex='^(\[.*\]) (\[.*\]) ([^ ]+) ([^ ]+) \((.*) -> (.*)\)$' | |
prepare() | |
{ | |
while read str | |
do | |
date=$(echo $str | sed -r "s|$regex|\1|") | |
db=$(echo $str | sed -r "s|$regex|\2|") | |
action=$(echo $str | sed -r "s|$regex|\3|") | |
pkg=$(echo $str | sed -r "s|$regex|\4|") | |
v1=$(echo $str | sed -r "s|$regex|\5|") | |
v2=$(echo $str | sed -r "s|$regex|\6|") | |
ls /var/cache/pacman/pkg/${pkg}-${v1}*.pkg.tar.xz | |
done | |
} | |
pacman -U "$(grep $1 /var/log/pacman.log | grep upgraded | prepare)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment