tazpkg rev 130

tazpkgbox: add installable tab, auto install depends checkbox and improve non-free support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 18 14:14:13 2008 +0000 (2008-07-18)
parents 91d2fe8269c9
children f9c8f9d187f6
files lib/tazpkgbox/list lib/tazpkgbox/package_infos tazpkgbox
line diff
     1.1 --- a/lib/tazpkgbox/list	Thu Jul 17 11:29:23 2008 +0000
     1.2 +++ b/lib/tazpkgbox/list	Fri Jul 18 14:14:13 2008 +0000
     1.3 @@ -4,23 +4,37 @@
     1.4  # List mirrored packages using the packages.desc file.
     1.5  #
     1.6  
     1.7 +installable_list()
     1.8 +{
     1.9 +	IFS="|"
    1.10 +	while read PACKAGE VERSION SHORT_DESC; do
    1.11 +		[ -d /var/lib/tazpkg/installed/${PACKAGE%% *} ] && continue
    1.12 +		echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.13 +	done < /var/lib/tazpkg/packages.desc 2> /dev/null
    1.14 +	unset IFS
    1.15 +}
    1.16 +
    1.17 +installed_list()
    1.18 +{
    1.19 +	for pkg in /var/lib/tazpkg/installed/*
    1.20 +	do
    1.21 +		. $pkg/receipt
    1.22 +		if [ "$CAT" == "all" -o "$CATEGORY" == "$CAT" ]; then
    1.23 +			echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.24 +		fi
    1.25 +	done
    1.26 +}
    1.27 +
    1.28  case $1 in
    1.29  	installed)
    1.30  		CAT=`cat /tmp/tazpkgbox/installed-category`
    1.31 +		installed_list $CAT;;
    1.32 +	installable)
    1.33 +		CAT=`cat /tmp/tazpkgbox/installable-category`
    1.34  		if [ "$CAT" == "all" ]; then
    1.35 -			for pkg in /var/lib/tazpkg/installed/*
    1.36 -			do
    1.37 -				. $pkg/receipt
    1.38 -				echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.39 -			done
    1.40 +			installable_list
    1.41  		else
    1.42 -			for pkg in /var/lib/tazpkg/installed/*
    1.43 -			do
    1.44 -				. $pkg/receipt
    1.45 -				if [ "$CATEGORY" == "$CAT" ]; then
    1.46 -					echo "$PACKAGE|$VERSION|$SHORT_DESC"
    1.47 -				fi
    1.48 -			done	
    1.49 +			installable_list | grep "$CAT"
    1.50  		fi ;;
    1.51  	mirrored)
    1.52  		CAT=`cat /tmp/tazpkgbox/mirrored-category`
    1.53 @@ -28,20 +42,9 @@
    1.54  			cat /var/lib/tazpkg/packages.desc
    1.55  		else
    1.56  			grep "$CAT" /var/lib/tazpkg/packages.desc
    1.57 -			#for pkg in `grep "$CAT" /var/lib/tazpkg/packages.desc | cut -d "|" -f 1`
    1.58 -			#do
    1.59 -				#RES=`grep "^$pkg"  /var/lib/tazpkg/packages.desc | head -n 1`
    1.60 -				#CATEGORY=`echo "$RES" | cut -d "|" -f 4`
    1.61 -				##echo "$pkg|$CATEGORY"
    1.62 -				#if [ "$CATEGORY" == "$CAT" ]; then
    1.63 -					#VERSION=`echo $RES | cut -d "|" -f 2`
    1.64 -					#SHORT_DESC=`echo $RES | cut -d "|" -f 3`
    1.65 -					#echo "$pkg | $VERSION | $SHORT_DESC"
    1.66 -				#fi
    1.67 -			#done
    1.68  		fi ;;
    1.69  	*)
    1.70 -		echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|mirrored]" ;;
    1.71 +		echo "Usage: /usr/lib/slitaz/tazpkgbox/list [installed|installable|mirrored]" ;;
    1.72  esac
    1.73  
    1.74  exit 0
     2.1 --- a/lib/tazpkgbox/package_infos	Thu Jul 17 11:29:23 2008 +0000
     2.2 +++ b/lib/tazpkgbox/package_infos	Fri Jul 18 14:14:13 2008 +0000
     2.3 @@ -82,6 +82,14 @@
     2.4  	</tree>
     2.5  
     2.6  	<hbox>"
     2.7 +[ $CATEGORY = non-free -a ! -d /var/lib/tazpkg/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
     2.8 +		<button>
     2.9 +			<label>Install</label>
    2.10 +			<input file icon=\"go-next\"></input>
    2.11 +			<action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
    2.12 +			$PKG; sleep 5\"</action>
    2.13 +			<action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
    2.14 +		</button>"
    2.15  grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
    2.16  		<button>
    2.17  			<label>Reconfigure</label>
    2.18 @@ -163,12 +171,27 @@
    2.19  		<item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
    2.20  	</tree>
    2.21  
    2.22 -	<hbox>
    2.23 +	<hbox>"
    2.24 +	[ $CATEGORY = non-free ] && PACKAGE_INFOS="$PACKAGE_INFOS
    2.25 +		<checkbox>
    2.26 +			<label>Auto exec</label>
    2.27 +			<variable>AUTO_EXEC</variable>
    2.28 +			<default>true</default>
    2.29 +		</checkbox>"
    2.30 +	PACKAGE_INFOS="$PACKAGE_INFOS
    2.31 +		<checkbox>
    2.32 +			<label>Auto install depends</label>
    2.33 +			<variable>AUTO_DEPENDS</variable>
    2.34 +			<default>true</default>
    2.35 +		</checkbox>
    2.36  		<button>
    2.37  			<label>Get-install</label>
    2.38  			<input file icon=\"go-next\"></input>
    2.39  			<action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
    2.40 -			tazpkg get-install $PACKAGE; sleep 2\"</action>
    2.41 +			if [ \$AUTO_DEPENDS != true ]; then tazpkg get-install $PACKAGE;\
    2.42 +			else yes y | tazpkg get-install $PACKAGE; fi; \
    2.43 +			[ \${AUTO_EXEC}$CATEGORY = truenon-free ] && $PACKAGE; \
    2.44 +			sleep 2\"</action>
    2.45  			<action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
    2.46  		</button>
    2.47  		<button>
     3.1 --- a/tazpkgbox	Thu Jul 17 11:29:23 2008 +0000
     3.2 +++ b/tazpkgbox	Fri Jul 18 14:14:13 2008 +0000
     3.3 @@ -23,6 +23,7 @@
     3.4  # list and search files to load less data and have a faster start.
     3.5  mkdir -p /tmp/tazpkgbox
     3.6  echo "all" > /tmp/tazpkgbox/installed-category
     3.7 +echo "all" > /tmp/tazpkgbox/installable-category
     3.8  echo "all" > /tmp/tazpkgbox/mirrored-category
     3.9  echo "" > /tmp/tazpkgbox/search-installed
    3.10  echo "" > /tmp/tazpkgbox/search-mirrored
    3.11 @@ -85,7 +86,7 @@
    3.12  		</pixmap>
    3.13  	</hbox>
    3.14  
    3.15 -	<notebook labels="Installed|Mirrored|Search|Configuration">
    3.16 +	<notebook labels="Installed|Installable|Mirrored|Search|Configuration">
    3.17  
    3.18  	<vbox>
    3.19  		<tree>
    3.20 @@ -129,7 +130,7 @@
    3.21  			<button>
    3.22  				<label>Upgrade all</label>
    3.23  				<input file icon="system-software-update"></input>
    3.24 -				<action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2"</action>
    3.25 +				<action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
    3.26  				<action>refresh:PKG</action>
    3.27  				<action>refresh:PKG_STATS</action>
    3.28  				<action>refresh:CACHE_STATS</action>
    3.29 @@ -140,6 +141,56 @@
    3.30  	<vbox>
    3.31  		<tree>
    3.32  			<width>620</width><height>240</height>
    3.33 +			<variable>GETIT</variable>
    3.34 +			<label>Package name|Version|Description</label>
    3.35 +			<input>/usr/lib/slitaz/tazpkgbox/list installable</input>
    3.36 +			<action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
    3.37 +			<action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
    3.38 +			<action>refresh:PKG</action>
    3.39 +			<action>refresh:GETIT</action>
    3.40 +			<action>refresh:PKG_STATS</action>
    3.41 +			<action>refresh:CACHE_STATS</action>
    3.42 +		</tree>
    3.43 +		<hbox>
    3.44 +			<text>
    3.45 +				<label>"Category:"</label>
    3.46 +			</text>
    3.47 +			<combobox>
    3.48 +				<variable>INSTALLABLE_CAT</variable>
    3.49 +				<item>all</item>
    3.50 +				<item>base-system</item>
    3.51 +				<item>utilities</item>
    3.52 +				<item>network</item>
    3.53 +				<item>graphics</item>
    3.54 +				<item>multimedia</item>
    3.55 +				<item>office</item>
    3.56 +				<item>development</item>
    3.57 +				<item>system-tools</item>
    3.58 +				<item>security</item>
    3.59 +				<item>games</item>
    3.60 +				<item>misc</item>
    3.61 +				<item>meta</item>
    3.62 +				<item>non-free</item>
    3.63 +			</combobox>
    3.64 +			<button>
    3.65 +				<label>List</label>
    3.66 +				<input file icon="reload"></input>
    3.67 +				<action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
    3.68 +				<action>refresh:GETIT</action>
    3.69 +			</button>
    3.70 +			<button>
    3.71 +				<label>Recharge list</label>
    3.72 +				<input file icon="system-software-update"></input>
    3.73 +				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
    3.74 +				<action>refresh:GETIT</action>
    3.75 +				<action>refresh:PKG_STATS</action>
    3.76 +			</button>
    3.77 +		</hbox>
    3.78 +	</vbox>
    3.79 +
    3.80 +	<vbox>
    3.81 +		<tree>
    3.82 +			<width>620</width><height>240</height>
    3.83  			<variable>GET</variable>
    3.84  			<label>Package name|Version|Description</label>
    3.85  			<input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
    3.86 @@ -176,7 +227,7 @@
    3.87  			<button>
    3.88  				<label>Recharge list</label>
    3.89  				<input file icon="system-software-update"></input>
    3.90 -				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2"</action>
    3.91 +				<action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
    3.92  				<action>refresh:GET</action>
    3.93  				<action>refresh:PKG_STATS</action>
    3.94  			</button>
    3.95 @@ -285,12 +336,12 @@
    3.96  				<button>
    3.97  					<label>Quick check</label>
    3.98  					<input file icon="go-next"></input>
    3.99 -					<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check | less "</action>
   3.100 +					<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check | less " 2> /dev/null</action>
   3.101  				</button>
   3.102  				<button>
   3.103  					<label>Full check</label>
   3.104  					<input file icon="go-next"></input>
   3.105 -					<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check --full | less "</action>
   3.106 +					<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check --full | less " 2> /dev/null</action>
   3.107  				</button>
   3.108  			</hbox>
   3.109  		</frame>
   3.110 @@ -300,7 +351,7 @@
   3.111  
   3.112  	<hbox>
   3.113  		<text>
   3.114 -			<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 | wc -l` to upgrade "</input>
   3.115 +			<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.116  			<variable>PKG_STATS</variable>
   3.117  		</text>
   3.118  	</hbox>