sup rev 33

Out put text/plain for packages.sql md5sum
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 28 00:01:30 2017 +0100 (2017-02-28)
parents 7f0dd18bdb66
children 090432cab673
files libsup.sh server/sup/sup.cgi sup
line diff
     1.1 --- a/libsup.sh	Mon Feb 27 23:44:02 2017 +0100
     1.2 +++ b/libsup.sh	Tue Feb 28 00:01:30 2017 +0100
     1.3 @@ -15,7 +15,9 @@
     1.4  installed="$supdb/installed"
     1.5  activity="$cache/activity.log"
     1.6  
     1.7 -mirror="http://scn.slitaz.org/content/sup/packages"
     1.8 +host="http://localhost/~pankso/cgi-bin/scn/"
     1.9 +#host="http://scn.slitaz.org/"
    1.10 +mirror="${host}content/sup/packages"
    1.11  pkgsdb="$supdb/packages.sql"
    1.12  
    1.13  wok="$supdb/wok"
     2.1 --- a/server/sup/sup.cgi	Mon Feb 27 23:44:02 2017 +0100
     2.2 +++ b/server/sup/sup.cgi	Tue Feb 28 00:01:30 2017 +0100
     2.3 @@ -261,6 +261,7 @@
     2.4  	
     2.5  	*\ dbsum\ *)
     2.6  		# Used by client to check for newer packages.sql
     2.7 +		header "Content-Type: text/plain"
     2.8  		md5sum ${pkgsdb} | awk '{printf $1}'; exit 0 ;;
     2.9  
    2.10  	*\ admin\ *|*\ db\ *)
     3.1 --- a/sup	Mon Feb 27 23:44:02 2017 +0100
     3.2 +++ b/sup	Tue Feb 28 00:01:30 2017 +0100
     3.3 @@ -238,11 +238,22 @@
     3.4  		separator
     3.5  		
     3.6  		# Skip HTTP/1.1 404 Not Found: 2>/dev/null
     3.7 -		if ! wget --spider -q ${mirror}/packages.sql 2>/dev/null; then
     3.8 +		if ! wget -q -T 5 --spider ${mirror}/packages.sql 2>/dev/null; then
     3.9  			gettext "Mirror is unreachable"; newline
    3.10  		fi
    3.11 +		
    3.12 +		# Newer packages.sql ?
    3.13 +		wget -q "http://localhost/~pankso/cgi-bin/scn/?sup=dbsum" -O -
    3.14 +		
    3.15 +		
    3.16  		rm -f ${pkgsdb}
    3.17 -		wget 
    3.18 +		wget -P ${supdb} ${mirror}/packages.sql
    3.19 +		sqlite3 ${pkgsdb} 'SELECT timestamp FROM info' \
    3.20 +			| awk '{printf "Timestamp : %s %s\n",$1,$2 }'
    3.21 +		
    3.22 +		for pkg in $(ls $wok); do
    3.23 +			echo "$pkg"
    3.24 +		done
    3.25  		
    3.26  		newline ;;
    3.27