diff options
Diffstat (limited to 'bind-cal.sh')
-rwxr-xr-x | bind-cal.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bind-cal.sh b/bind-cal.sh new file mode 100755 index 0000000..555560f --- /dev/null +++ b/bind-cal.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +BASE="$1" +USER="$2" +RESOURCE="$3" +NAME="${4:-${3##*/}}" + +URL="$BASE/caldav.php/$USER/" + +RESSOURCE=$(echo "$RESSOURCE" | php -e '<?php echo file_get_contents("php://stdin")') + + +REQUEST=`cat <<EOF +<?xml version="1.0" encoding="utf-8"?> +<bind xmlns="DAV:"> + <segment>$NAME</segment> + <href>$RESOURCE</href> +</bind> +EOF` + +echo $REQUEST + +echo $REQUEST | curl -k -d @- -X BIND -u $USER -H "content-type: text/xml;charset=\"UTF-8\"" -H "user-agent: bind-script" $URL |