tazpkg rev 143

tazpkgbox: can edit config files
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 30 09:51:15 2008 +0000 (2008-07-30)
parents 76d09109221b
children 80c3ca076c24
files lib/tazpkgbox/package_infos tazpkg tazpkgbox
line diff
     1.1 --- a/lib/tazpkgbox/package_infos	Tue Jul 29 08:53:01 2008 +0000
     1.2 +++ b/lib/tazpkgbox/package_infos	Wed Jul 30 09:51:15 2008 +0000
     1.3 @@ -8,11 +8,19 @@
     1.4  PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
     1.5  
     1.6  if [ "$1" = "list_files" ]; then
     1.7 -	tazpkg list-files $2 | awk '
     1.8 -BEGIN { ls=0 } {
     1.9 -  if (/^===/) ls=1-ls;
    1.10 -  else if (ls) system("stat -c \"%A|%U|%G|%s|%n\" " $0);
    1.11 -}'
    1.12 +	AWK_FILTER='BEGIN { ls=0 } { if (/^===/) ls=1-ls; else if (ls) print; }'
    1.13 +	CONF_FILES="$(tazpkg list-config $2 | awk "$AWK_FILTER")"
    1.14 +	tazpkg list-files $2 | awk "$AWK_FILTER" | while read file; do
    1.15 +		echo -n "$(stat -c "%A|%U|%G|%s|$type %n|" "$file")"
    1.16 +		if [ -L "$file" ]; then
    1.17 +			echo -n "$(readlink "$file")"
    1.18 +		elif [ -f "$file" ]; then
    1.19 +			case "$CONF_FILES" in
    1.20 +			*$file*) echo -n "[configuration file]";;
    1.21 +			esac
    1.22 +		fi
    1.23 +		echo ""
    1.24 +	done
    1.25  	exit 0
    1.26  fi
    1.27  
    1.28 @@ -25,10 +33,12 @@
    1.29  export LIST_FILES="
    1.30  <window title=\"$PKG files\" icon-name=\"system-file-manager\">
    1.31    <vbox>
    1.32 -	<tree>
    1.33 +	<tree exported_column=\"4\">
    1.34 +		<variable>FILE</variable>
    1.35  		<width>600</width><height>160</height>
    1.36 -		<label>Access | User | Group | Size | Name</label>
    1.37 +		<label>Access | User | Group | Size | Name | Target</label>
    1.38  		<input> $0 list_files $PKG </input>
    1.39 +		<action>tazpkg list-config $PKG | grep -q ^\$FILE$ && leafpad \$FILE</action>
    1.40  	</tree>
    1.41  	<hbox>
    1.42  		<button>
     2.1 --- a/tazpkg	Tue Jul 29 08:53:01 2008 +0000
     2.2 +++ b/tazpkg	Wed Jul 30 09:51:15 2008 +0000
     2.3 @@ -1121,10 +1121,10 @@
     2.4  			for i in $INSTALLED/*/volatile.cpio.gz; do 
     2.5  				zcat $i | cpio -id > /dev/null
     2.6  				find * -type f | while read file; do
     2.7 -					echo -n "/$file|"
     2.8 +					echo -n "$(stat -c "%A|%U|%G|%s|" /$file)"
     2.9  					cmp $file /$file > /dev/null 2>&1 || \
    2.10  						echo -n "$(stat -c "%.16y" /$file)"
    2.11 -					stat -c "|%A|%s|%U|%G" /$file
    2.12 +					echo "|/$file"
    2.13  				done
    2.14  				rm -rf *
    2.15  			done | sed 's|  |  /|'
    2.16 @@ -1134,9 +1134,17 @@
    2.17  			echo ""
    2.18  			echo -e "\033[1mConfiguration files"
    2.19  			echo "================================================================================"
    2.20 -			for i in $INSTALLED/*/volatile.cpio.gz; do 
    2.21 -				zcat $i | cpio -t | grep -v "[0-9]* blocks"
    2.22 -			done | sed 's|^|/|' | sort
    2.23 +			if [ -n "$2" ]; then
    2.24 +				for i in $INSTALLED/$2/volatile.cpio.gz; do 
    2.25 +					[ -f "$i" ] || continue
    2.26 +					zcat $i | cpio -t | grep -v "[0-9]* blocks"
    2.27 +				done | sed 's|^|/|' | sort
    2.28 +			else
    2.29 +				for i in $INSTALLED/*/volatile.cpio.gz; do 
    2.30 +					[ -f "$i" ] || continue
    2.31 +					zcat $i | cpio -t | grep -v "[0-9]* blocks"
    2.32 +				done | sed 's|^|/|' | sort
    2.33 +			fi
    2.34  			echo "================================================================================"
    2.35  			echo ""
    2.36  		fi
     3.1 --- a/tazpkgbox	Tue Jul 29 08:53:01 2008 +0000
     3.2 +++ b/tazpkgbox	Wed Jul 30 09:51:15 2008 +0000
     3.3 @@ -75,10 +75,10 @@
     3.4  export LIST_CONFIG_FILES='
     3.5  <window title="configuration files" icon-name="system-file-manager">
     3.6    <vbox>
     3.7 -	<tree>
     3.8 -		<width>630</width><height>160</height>
     3.9 +	<tree exported_column="5">
    3.10 +		<width>560</width><height>160</height>
    3.11  		<variable>CONF_FILE</variable>
    3.12 -		<label>Name | Update Date | Access | Size | User | Group</label>
    3.13 +		<label>Access | User | Group | Size | Update Date | Name</label>
    3.14  		<input>tazpkg list-config --box</input>
    3.15  		<action>leafpad $CONF_FILE</action>
    3.16  	</tree>
    3.17 @@ -309,7 +309,7 @@
    3.18  
    3.19  	<vbox>
    3.20  		<frame Cache directory>
    3.21 -			<text use-markup="true" width-chars="60">
    3.22 +			<text use-markup="true" width-chars="60" wrap="false">
    3.23  				<label>
    3.24  "The cache directory is used to store downloaded or repacked packages."
    3.25  				</label>
    3.26 @@ -393,8 +393,8 @@
    3.27  	</notebook>
    3.28  
    3.29  	<hbox>
    3.30 -		<text>
    3.31 -			<input>echo "Packages: `ls /var/lib/tazpkg/installed | wc -l` installed, `cat /var/lib/tazpkg/packages.list | wc -l` mirrored, `cat /var/lib/tazpkg/upradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
    3.32 +		<text wrap="false">
    3.33 +			<input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; echo "Packages: $installed installed, $(($mirrored - $installed)) installable, $mirrored mirrored, `cat /var/lib/tazpkg/upradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
    3.34  			<variable>PKG_STATS</variable>
    3.35  		</text>
    3.36  	</hbox>