diff options
author | papajoker | 2015-10-04 14:22:30 +0200 |
---|---|---|
committer | papajoker | 2015-10-04 14:22:30 +0200 |
commit | 3e13c4d7e7c43df835347b2f649d11d2e29ebec8 (patch) | |
tree | e1c1c2149afeefc3f3f65e34d0642f115819110c | |
parent | cd7620ef9f6ace6a92eb691850add38a0d98aa0c (diff) | |
download | aur-3e13c4d7e7c43df835347b2f649d11d2e29ebec8.tar.gz |
add pacman history
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rwxr-xr-x | pacman-diffs | 21 |
3 files changed, 19 insertions, 6 deletions
@@ -1,7 +1,7 @@ pkgbase = pacman-diffs pkgdesc = finding .pacnew files and compare, and archive pkgver = 1.1.0 - pkgrel = 1 + pkgrel = 2 arch = any license = GPL depends = findutils @@ -1,7 +1,7 @@ # Maintainer: Papajoker <papajoker [at] archlinux [dot] info> pkgname=pacman-diffs pkgver=1.1.0 -pkgrel=1 +pkgrel=2 pkgdesc="finding .pacnew files and compare, and archive" arch=('any') license=('GPL') diff --git a/pacman-diffs b/pacman-diffs index 21e4143ca497..e6dbb614cec8 100755 --- a/pacman-diffs +++ b/pacman-diffs @@ -88,7 +88,6 @@ function archive() function in_archive(){ local file="$1" local name="$2" - declare -a out file=$ARCCHIVEDIR${file/$name.$EXT/*-$name.$EXT} nb=$(ls $file | wc -l) if [ "$nb" -gt "1" ]; then @@ -99,11 +98,11 @@ function in_archive(){ } function make_diff() +#TODO : test permission et faire sudo si besoin ou test_sudo() ? { local file1="$1" local file2="$2" local original="$3" - if [[ $(diff $file1 $file2|wc -l) -eq 0 ]]; then # can remove etc/pacnew echo -e "-- ${c_yellow}${txt[erase]}${c_end} : sudo rm $original" @@ -117,6 +116,16 @@ function make_diff() fi } +function history_pacman() +{ + local history="$1" + if [ "$history" -gt "0" ]; then + grep "pacnew$" /var/log/pacman.log | sed -e "s/\[ALPM\] warning: //" + else + grep "pacnew$" /var/log/pacman.log| awk '{print $8}' | sort | uniq + fi +} + function usage() { echo "usage: pacman-diffs [options]" @@ -126,12 +135,14 @@ function usage() echo -e "\t -e filename : edit files" echo -e "\t -a archive pacnew in /var/cache/pacman/pacnew/" echo -e "\t -c compare archives" + echo -e "\t -i pacman history" + echo -e "\t -j pacman history files" exit } +############## RUN ############## - -while getopts "hd:x:le:ac" flags; do +while getopts "hd:x:le:acij" flags; do case $flags in h) usage;exit 0 ;; d) AGE="${OPTARG}" ;; @@ -140,6 +151,8 @@ while getopts "hd:x:le:ac" flags; do e) edit="${OPTARG}"; listing=1 ;; a) archive=1; listing=1 ;; c) archive=1; archivediff=1 ;; + i) history_pacman 1; exit ;; + j) history_pacman 0; exit ;; :) error "Vous avez oubliƩ un argument"; exit 1 ;; ?) error "invalid Option"; exit 1 ;; *) error "*"; exit 1 ;; |