mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -05:00
pacdiff: provide an --output option to show any .pac* files
This is an option to just echo's the pacnews/pacsaves instead of merging or removing them. This can be used to check the config status such as in a cron job without modifying the system. Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
2d9dad5e14
commit
0f22bef8c3
@ -27,7 +27,7 @@ diffprog=${DIFFPROG:-vimdiff}
|
||||
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
||||
USE_COLOR='y'
|
||||
declare -a oldsaves
|
||||
declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0
|
||||
declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0
|
||||
|
||||
m4_include(../scripts/library/output_format.sh)
|
||||
|
||||
@ -43,6 +43,7 @@ Search Options: select one, default: pacmandb
|
||||
-p/--pacmandb scan active config files from pacman db
|
||||
|
||||
General Options:
|
||||
-o/--output print files instead of merging them
|
||||
--nocolor remove colors from output
|
||||
|
||||
Enviroment Variables:
|
||||
@ -51,6 +52,7 @@ Enviroment Variables:
|
||||
(default: /etc)
|
||||
|
||||
Example: DIFFPROG=meld DIFFSEARCHPATH="/boot /etc /usr" $myname
|
||||
Example: $myname --output --locate
|
||||
|
||||
EOF
|
||||
}
|
||||
@ -98,6 +100,8 @@ while [[ -n "$1" ]]; do
|
||||
USE_FIND=1;;
|
||||
-p|--pacmandb)
|
||||
USE_PACDB=1;;
|
||||
-o|--output)
|
||||
OUTPUTONLY=1;;
|
||||
--nocolor)
|
||||
USE_COLOR='n';;
|
||||
-V|--version)
|
||||
@ -137,6 +141,11 @@ while IFS= read -u 3 -r -d '' pacfile; do
|
||||
file="${pacfile%.pac*}"
|
||||
file_type="pac${pacfile##*.pac}"
|
||||
|
||||
if (( OUTPUTONLY )); then
|
||||
echo "$pacfile"
|
||||
continue
|
||||
fi
|
||||
|
||||
# add matches for pacsave.N to oldsaves array, do not prompt
|
||||
if [[ $file_type = pacsave.+([0-9]) ]]; then
|
||||
oldsaves+=("$pacfile")
|
||||
|
Loading…
Reference in New Issue
Block a user