slitaz-dev-tools rev 105

tazwikiss: fix backup
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jun 01 16:48:41 2011 +0200 (2011-06-01)
parents 3645c9a48242
children 1510776d23ee
files tazwikiss/rootfs/var/www/wiki/plugins/wkp_ListPlugins.sh
line diff
     1.1 --- a/tazwikiss/rootfs/var/www/wiki/plugins/wkp_ListPlugins.sh	Wed Jun 01 16:09:47 2011 +0200
     1.2 +++ b/tazwikiss/rootfs/var/www/wiki/plugins/wkp_ListPlugins.sh	Wed Jun 01 16:48:41 2011 +0200
     1.3 @@ -6,23 +6,23 @@
     1.4  {
     1.5  	case "$1" in
     1.6  	list|config);;
     1.7 -	backup)	if [ -n "$(POST save)" ]; then
     1.8 +	backup)	if [ -z "$(FILE file tmpname)" ]; then
     1.9  			file=$(mktemp -p /tmp)
    1.10  			find */ | cpio -o -H newc | gzip -9 > $file
    1.11 -			cat <<EOT
    1.12 +			cat - $file <<EOT
    1.13  Content-Type: application/octet-stream
    1.14  Content-Length: $(stat -c %s $file)
    1.15  Content-Disposition: attachment; filename=wiki-$(date '+%Y%m%d%H%M').cpio.gz
    1.16  
    1.17  EOT
    1.18 -			cat $file
    1.19 +			rm -f $file
    1.20 +			exit 0
    1.21  		else
    1.22  			file=$(FILE file tmpname)
    1.23  			zcat $file | cpio -idmu $(echo */ | sed 's|/||g')
    1.24 +			rm -rf $(dirname $file)
    1.25  			return 1
    1.26  		fi
    1.27 -		rm -f $file
    1.28 -		exit 0
    1.29  		;;
    1.30  	*) return 1
    1.31  	esac