summaryrefslogtreecommitdiff
path: root/localwebcalcreate
blob: c97b673bb3280ac69e784bc1dc94210f4bd37505 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localwebcalcreate
  4. # Copyright 2001 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localwebcalcreate,v 1.2 2002-03-07 16:22:51 jonas Exp $
  7. #
  8. # Create local WebCAL
  9. #
  10. NAME=webcal
  11. PATH=$PATH:/usr/local/sbin
  12. USER=$2
  13. HOME=/web/$USER
  14. CGI=$HOME/www/cgi-local
  15. NEWNAME=kalender
  16. CAL=$HOME/www/$NEWNAME
  17. test "x$USER" = "x" && $1=""
  18. case "$1" in
  19. add)
  20. test "x$USER" = "x" && exit 1
  21. echo -n "Adding calendar to webserver $USER: "
  22. test -d $CGI || mkdir $CGI
  23. chown $USER.www-data $CGI
  24. cp /usr/local/lib/scripts/darryl/webcal/webcal.pl $CGI/$NEWNAME.cgi
  25. cp /usr/local/lib/scripts/darryl/webcal/webcal.add.pl $CGI/$NEWNAME.cgi
  26. cp /usr/local/lib/scripts/darryl/webcal/webcal.config.pl $CGI/$NEWNAME.cgi
  27. cp /usr/local/lib/scripts/darryl/webcal/webcal.delete.pl $CGI/$NEWNAME.cgi
  28. chown $USER.www-data $CGI/NEWNAME*.cgi
  29. chmod g+x,o= $CGI/$NEWNAME*.cgi
  30. mkdir $HOME/webcal
  31. cp /usr/local/lib/scripts/darryl/webcal/webcal.data $HOME/webcal/
  32. chown -R $USER.www-data $HOME/webcal
  33. chmod g+w $HOME/webcal/webcal.data
  34. mkdir $CAL
  35. chown -R $USER.www-data $CAL
  36. echo "Done!"
  37. ;;
  38. del|delete|remove)
  39. test -d $HOME/webcal || exit 1
  40. echo -n "Deleting calendar from webserver $USER: "
  41. rm -rf $CGI/$NEWNAME*.cgi
  42. rm -rf $HOME/webcal
  43. rm -rf $CAL
  44. echo "Done!"
  45. ;;
  46. *)
  47. echo "Usage: $NAME [ add | delete ] WEBSERVER"
  48. exit 1
  49. ;;
  50. esac
  51. exit 0