]>
Commit | Line | Data |
---|---|---|
1dbe2781 AG |
1 | #!/bin/sh |
2 | # pacdiff : a simple pacnew/pacorig/pacsave updater for /etc/ | |
3 | # | |
4 | # Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com> | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | # USA. | |
20 | # | |
21 | ||
22 | # Original http://phraktured.net/config/bin/pacdiff | |
23 | ||
24 | diffprog=${DIFFPROG:-vimdiff} | |
25 | for x in $(find /etc/ -name *.pacnew -o -name *.pacorig -o -name *.pacsave) | |
26 | do | |
27 | echo "File: ${x%.pac*}" | |
28 | chk="$(cmp $x ${x%.pac*})" | |
29 | if [ -z "${chk}" ]; then | |
30 | echo " Files are identical, removing..." | |
31 | rm $x | |
32 | else | |
33 | echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] " | |
34 | read c | |
35 | c="$(echo $c| tr A-Z a-z)" #tolower | |
36 | if [ "$c" = "r" ]; then | |
37 | rm $x | |
38 | elif [ "$c" = "s" ]; then | |
39 | continue | |
40 | else | |
41 | [ "$c" = "n" -o "$c" = "N" ] || $diffprog $x ${x%.pac*} | |
42 | echo -n " Remove file? [Y/n] " | |
43 | read c | |
44 | [ "$c" = "n" -o "$c" = "N" ] || rm $x | |
45 | fi | |
46 | fi | |
47 | done |