[pacman-dev] [PATCH 3/3] pacdiff: provide an --output option to show any .pac* files

Dave Reisner d at falconindy.com
Thu Jul 18 20:28:23 EDT 2013


On Thu, Jul 18, 2013 at 06:17:34PM -0400, Jonathan Frazier wrote:
> 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 chron job without modifying the system.

s/chron/cron/

> 
> Signed-off-by: Jonathan Frazier <eyeswide at gmail.com>
> ---
>  contrib/pacdiff.sh.in | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
> index fa6a0c5..4bc8a33 100644
> --- a/contrib/pacdiff.sh.in
> +++ b/contrib/pacdiff.sh.in
> @@ -25,7 +25,7 @@ diffprog=${DIFFPROG:-vimdiff}
>  diffsearchpath=${DIFFSEARCHPATH:-/etc}
>  USE_COLOR='y'
>  
> -declare -i findActive=0 locateActive=0 dbActive=0
> +declare -i findActive=0 locateActive=0 dbActive=0 outputOnly=0
>  declare -a oldsaves
>  
>  m4_include(../scripts/library/output_format.sh)
> @@ -42,6 +42,7 @@ Search Options:     select one, default: find
>    -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:
> @@ -50,6 +51,7 @@ Enviroment Variables:
>                      (default: /etc)
>  
>  Example: DIFFPROG=meld DIFFSEARCHPATH="/boot /etc /usr" $myname
> +Example: $myname --output --locate
>  
>  EOF
>  }
> @@ -97,6 +99,8 @@ while [[ -n "$1" ]]; do
>  		findActive=1;;
>  		-p|--pacmandb)
>  		dbActive=1;;
> +		-o|--outputOnly)
> +		outputOnly=1;;
>  		--nocolor)
>  		USE_COLOR='n';;
>  		-V|--version)
> @@ -135,6 +139,11 @@ fi
>  while IFS= read -u 3 -r -d '' pacfile; do
>  	file="${pacfile%.pac*}"
>  	file_type="pac${pacfile##*.pac}"
> +	
> +	if (( outputOnly )); then
> +		echo $pacfile

quotes...

> +		continue
> +	fi
>  
>  	# add matches for pacsave.N to oldsaves array, do not prompt
>  	if [[ $file_type = pacsave.+([0-9]) ]]; then
> -- 
> 1.8.3.2
> 
> 


More information about the pacman-dev mailing list