summaryrefslogtreecommitdiff
path: root/localmoffycreate
blob: 50fffbe113e0994df93f810247f8ff39a02876a5 (plain)
  1. #!/bin/bash
  2. #
  3. # /usr/local/sbin/localmoffycreate
  4. # Copyright 2001 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localmoffycreate,v 1.2 2002-03-07 16:22:51 jonas Exp $
  7. #
  8. # Create local Moffy website
  9. #
  10. set -e
  11. user="moffy"
  12. passwd="oscerciv"
  13. db="moffy"
  14. mysqladmin -uroot -p create $db
  15. echo "GRANT ALL ON $db.* TO '$user@localhost' IDENTIFIED BY '$passwd' WITH GRANT OPTION;" | mysql -uroot -p
  16. #mysql -u$user -p$passwd $db < $basedir/sql/publish.sql
  17. dbstring="INSERT INTO eZUser_User VALUES (1,'$user',password('$passwd'),'$user@$domain','admin','user','false','',0,0);"
  18. cat $basedir/sql/publish.sql | sed "s/^INSERT INTO eZUser_User VALUES.*\$/$dbstring/" | mysql -u$user -p$passwd $db
  19. su $user -c "zcat $basedir/data.tar.gz | tar -xv -C $basedir"
  20. mysql -u$user -p$passwd $db < $basedir/sql/data.sql
  21. #su $user -c "cd $basedir && ./modfix.sh"
  22. #su $user -c "cd $basedir && ./secure_clearcache.sh"
  23. #su $user -c "echo \"
  24. #RewriteEngine On
  25. #RewriteRule ^/stats/store/(.*).gif\\\$ $basedir/ezstats/user/storestats.php [S=2]
  26. #RewriteRule ^/filemanager/filedownload/([^/]+)/(.*)\\\$ $basedir/ezfilemanager/files/\\\$1 [T=\\\"application/oct-stream\\\",S=1]
  27. #RewriteRule \!\.(gif|css|jpg|png)\\\$ $basedir/index.php
  28. #\" > $basedir/.htaccess"
  29. #su $user -c "echo \"
  30. #RewriteEngine On
  31. #RewriteRule \!\.(gif|css|jpg|png)\\\$ $basedir/index_admin.php
  32. #\" > $adminbasedir/.htaccess"
  33. su $user -c "
  34. cd $basedir
  35. ./modfix.sh
  36. ./secure_modfix.sh $user $group
  37. ./clearcache.sh
  38. ./secure_clearcache.sh
  39. cat site.ini | sed 's/^SiteURL=publish.ez.no\$/SiteURL=$host/' > site.ini.tmp && mv site.ini.tmp site.ini
  40. cat site.ini | sed 's/^Database=publish\$/Database=$db/' > site.ini.tmp && mv site.ini.tmp site.ini
  41. cat site.ini | sed 's/^User=publish\$/User=$user/' > site.ini.tmp && mv site.ini.tmp site.ini
  42. cat site.ini | sed 's/^Password=publish\$/Password=$passwd/' > site.ini.tmp && mv site.ini.tmp site.ini
  43. cat site.ini | sed 's/^Database=publish\$/Database=$db/' > site.ini.tmp && mv site.ini.tmp site.ini
  44. "
  45. echo "
  46. <VirtualHost *>
  47. ServerName $host
  48. ServerAdmin $user@$domain
  49. DocumentRoot $basedir
  50. user $user
  51. group $group
  52. php_flag magic_quotes_gpc off
  53. RewriteEngine On
  54. RewriteRule ^/stats/store/(.*).gif\$ $basedir/ezstats/user/storestats.php [S=2]
  55. RewriteRule ^/filemanager/filedownload/([^/]+)/(.*)\$ $basedir/ezfilemanager/files/\$1 [T="application/oct-stream",S=1]
  56. RewriteRule !\.(gif|css|jpg|png)\$ $basedir/index.php
  57. </VirtualHost>
  58. <VirtualHost *>
  59. ServerName $adminhost
  60. ServerAdmin $user@$domain
  61. DocumentRoot $basedir
  62. user $user
  63. group $group
  64. php_flag magic_quotes_gpc off
  65. RewriteEngine On
  66. RewriteRule !\.(gif|css|jpg|png)\$ $basedir/index_admin.php
  67. </VirtualHost>
  68. " > $webcfg
  69. echo "Remember to reload Apache..."