imip-agent

tests/resource_request.sh

1023:8fff9da40e5d
2016-01-29 Paul Boddie Fixed translated message for unshared events.
     1 #!/bin/sh     2      3 THIS_DIR=`dirname $0`     4      5 TEMPLATES="$THIS_DIR/templates"     6 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"     7 SHOWMAIL="$THIS_DIR/../tools/showmail.py"     8 STORE=/tmp/store     9 STATIC=/tmp/static    10 PREFS=/tmp/prefs    11 ARGS="-S $STORE -P $STATIC -p $PREFS -d"    12     13 ERROR=err.tmp    14     15 export N=$1    16 export START=20141126T090000    17 export END=20141126T100000    18 export SENDERADDRESS="person-$N@example.com"    19 export SENDER="mailto:person-$N@example.com"    20     21 # Exit if a previous result indicates acceptance of a request.    22     23    [ -e "outP${N}.tmp" ] \    24 && `grep 'PARTSTAT' "outP${N}.tmp" | grep -q 'ACCEPTED'` \    25 && exit 0    26     27 FBRESULT=$2    28     29 # Find the end of a busy period or use the initial start.    30     31 FBSTART=`grep 'FREEBUSY' "$FBRESULT" | grep -v 'VFREEBUSY' | tail -n 1 | cut -d: -f2 | cut -d/ -f2 | tr -d '\\r'`    32 FBEND=`python "$THIS_DIR/next_time.py" "$FBSTART" 09 16`    33 START=${FBSTART:-$START}    34 END=${FBEND:-$END}    35     36 echo "Try for $N with $START and $END..."    37     38 # Request a resource on behalf of a numbered person identity.    39     40   envsubst < "$TEMPLATES/event-request-group.txt" \    41 | tee "inP${N}.tmp" \    42 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \    43 | "$SHOWMAIL" 2>> $ERROR \    44 > "outP${N}.tmp"