wok-6.x rev 13153

zerobin: add purge.sh (for crontab)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jul 16 10:19:42 2012 +0200 (2012-07-16)
parents f4bd64ad2a4e
children a6697022a666
files busybox/stuff/busybox-1.20.config-static zerobin/receipt zerobin/stuff/purge.sh
line diff
     1.1 --- a/busybox/stuff/busybox-1.20.config-static	Fri Jul 13 13:58:26 2012 +0200
     1.2 +++ b/busybox/stuff/busybox-1.20.config-static	Mon Jul 16 10:19:42 2012 +0200
     1.3 @@ -282,7 +282,7 @@
     1.4  # CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
     1.5  # CONFIG_TRUE is not set
     1.6  # CONFIG_TTY is not set
     1.7 -CONFIG_UNAME=y
     1.8 +# CONFIG_UNAME is not set
     1.9  # CONFIG_UNEXPAND is not set
    1.10  # CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
    1.11  # CONFIG_UNIQ is not set
    1.12 @@ -412,7 +412,7 @@
    1.13  CONFIG_FEATURE_GREP_EGREP_ALIAS=y
    1.14  # CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
    1.15  # CONFIG_FEATURE_GREP_CONTEXT is not set
    1.16 -CONFIG_XARGS=y
    1.17 +# CONFIG_XARGS is not set
    1.18  # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
    1.19  # CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
    1.20  # CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
     2.1 --- a/zerobin/receipt	Fri Jul 13 13:58:26 2012 +0200
     2.2 +++ b/zerobin/receipt	Mon Jul 16 10:19:42 2012 +0200
     2.3 @@ -24,8 +24,12 @@
     2.4  genpkg_rules()                                      
     2.5  {
     2.6  	mkdir -p $fs/usr/share/zerobin
     2.7 +	mkdir -p $fs/var/lib/zerobin/data $fs/var/lib/zerobin/tmp
     2.8  	cp -a $src/* $fs/usr/share/zerobin
     2.9 -	chown -R www.www $fs/usr/share/zerobin
    2.10 +	cp $stuff/purge.sh $fs/var/lib/zerobin/data
    2.11 +	ln -s /var/lib/zerobin/data $fs/usr/share/zerobin/data
    2.12 +	ln -s /var/lib/zerobin/tmp $fs/usr/share/zerobin/tmp
    2.13 +	chown -R www.www $fs/usr/share/zerobin $fs/var/lib/zerobin/*
    2.14  }
    2.15  
    2.16  # Post and pre install commands
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/zerobin/stuff/purge.sh	Mon Jul 16 10:19:42 2012 +0200
     3.3 @@ -0,0 +1,15 @@
     3.4 +#!/bin/sh
     3.5 +
     3.6 +cd $(dirname $0)
     3.7 +for i in ?? ; do
     3.8 +	for j in $i/?? ; do
     3.9 +		for k in $j/* ; do
    3.10 +			[ -f $k ] || continue
    3.11 +			grep -qs '"expire_date":' $k || continue
    3.12 +			[ $(sed 's/.*"expire_date":\([0-9]*\).*/\1/' $k) -lt \
    3.13 +			  $(date +%s) ] && rm -rf $k*
    3.14 +		done
    3.15 +		rmdir $j 2> /dev/null
    3.16 +	done
    3.17 +	rmdir $i 2> /dev/null
    3.18 +done