Tardiba - The Tasmanian Devil Database Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.7 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: target/tardiba/99-final/sitebuilder.sh
  6. # Copyright (C) 2007 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. SITE_ROOT="$1"
  16. SITE_DB="$2"
  17. DB_IP="$3"
  18. DB_PORT="$4"
  19. lighttpd_config="/etc/opt/lighttpd/lighttpd.conf"
  20. DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'`
  21. TEMPLATE="/usr/share/sitebuilder/index.php"
  22. if [ "$SITE_ROOT" ]; then
  23. if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then
  24. mkdir -p $DOC_ROOT/$SITE_ROOT/pages
  25. cd $DOC_ROOT/$SITE_ROOT/pages
  26. cp -av $TEMPLATE .
  27. db_to_replace=`grep '^\$srv_dbname' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
  28. sed -e "s,$db_to_replace,$SITE_DB,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
  29. ip_to_replace=`grep '^\$srv_host' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
  30. sed -e "s,$ip_to_replace,$DB_IP,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
  31. port_to_replace=`grep '^\$srv_port' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g`
  32. sed -e "s,$port_to_replace,$DB_PORT,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php
  33. else
  34. exit 1;
  35. fi
  36. fi
  37. exit 0;