1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00
pacman/contrib/pacdiff
Allan McRae b3f4bd9750 Quote filenames in find expression in pacdiff
From 41cc28f560bf9843d81ce5fb62b884b6325d06a0 Mon Sep 17 00:00:00 2001
From: Allan McRae <mcrae_allan@hotmail.com>
Date: Sun, 6 Apr 2008 22:18:06 +1000
Subject: [PATCH] Quote filenames in find expression in pacdiff

Small patch to allow pacdiff to run in /etc.  See FS#10090.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 10:44:44 -05:00

46 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# pacdiff : a simple pacnew/pacorig/pacsave updater for /etc/
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Original http://phraktured.net/config/bin/pacdiff
diffprog=${DIFFPROG:-vimdiff}
for x in $(find /etc/ -name "*.pacnew" -o -name "*.pacorig" -o -name "*.pacsave")
do
echo "File: ${x%.pac*}"
chk="$(cmp $x ${x%.pac*})"
if [ -z "${chk}" ]; then
echo " Files are identical, removing..."
rm $x
else
echo -n " File differences found. (V)iew, (S)kip, (R)emove: [v/s/r] "
read c
c="$(echo $c| tr A-Z a-z)" #tolower
if [ "$c" = "r" ]; then
rm $x
elif [ "$c" = "s" ]; then
continue
else
[ "$c" = "n" -o "$c" = "N" ] || $diffprog $x ${x%.pac*}
echo -n " Remove file? [Y/n] "
read c
[ "$c" = "n" -o "$c" = "N" ] || rm $x
fi
fi
done