bug fix for cvs packaging
[openemr.git] / contrib / util / installScripts / cvsDemoInstall
blob644b744cc28616d9cfcb53358e5bf1a8aa265181
1 #!/bin/sh
3 #This program is free software; you can redistribute it and/or modify
4 #it under the terms of the GNU General Public License as published by
5 #the Free Software Foundation; either version 2 of the License, or
6 #(at your option) any later version.
8 # author Brady Miller
9 # email brady@sparmy.com
10 # date 02/20/09
13 #This script is called by the the OpenEMR CVS demo and developer appliance.
14 # It configures the CVS Demo and the Developer Appliance
15 # It will configure OpenEMR (bypassing setup.php).
16 # Logs errors
19 # PATH VARIABLES
20 WEB=/var/www/html
21 OPENEMR=$WEB/openemr
22 LOG=$WEB/log/logSetup.txt
23 CVS=/home/openemr/cvs
25 # OTHER VARIABLES
26 setHost="localhost" #mysql server (if not different from php, then localhost)
27 setLoginhost="localhost" #php/apache server (if not different from mysql, then localhost)
28 setPort="3306" #MySQL port
29 setDbname="openemr" #MySQL openemr database name
30 setLogin="openemr" #username to MySQL openemr database
31 setPass="openemr" #password to MySQL openemr database
32 setRoot="root" #MySQL server root username
33 setRootpass="" #MySQL server root password
34 setIuser="admin" #initial user login name
35 setIuname="Administrator" #initial user full name
36 setIgroup="Default" #practice group name
37 setOpenemrWebPath=/openemr #path on browser to openemr
38 setInst="1" #CONSTANT, don't set
40 #FIRST DEAL WITH STUFF SPECIFIC TO THE CVS DEMO AND DEVELOPER APPLIANCE
41 #Replace manual with newest version from cvs
42 echo "Configuring appliance"
43 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt /home/openemr/docs/manual.txt
44 chown openemr:openemr /home/openemr/docs/manual.txt
45 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt $WEB/manual.txt
46 echo "Done configuring appliance"
47 #Package the cvs version into a tarball and zip file to be available thru web browser
48 # This is basically to allow download of most recent cvs version from the cvs Demo appliance
49 # It will also ease transfer/testing openemr on windows systems when using the Developer appliance
50 echo "Creating OpenEMR CVS packages"
51 mkdir $WEB/files
52 cd $CVS
53 tar -czf $WEB/files/openemr-CVS.tar.gz openemr
54 cd $WEB/files
55 md5sum openemr-CVS.tar.gz > openemr-linux-MD5.txt
56 cd $CVS
57 zip -rq $WEB/files/openemr-CVS.zip openemr
58 cd $WEB/files
59 md5sum openemr-CVS.zip > openemr-windows-MD5.txt
60 date > date-CVS.txt
61 echo "Done creating OpenEMR CVS packages"
63 #INSTALL AND CONFIGURE OPENEMR
64 echo "Configuring OpenEMR"
65 # Set file and directory permissions
66 chmod 666 $OPENEMR/library/sqlconf.php
67 chmod 666 $OPENEMR/gacl/gacl.ini.php
68 chmod 666 $OPENEMR/gacl/gacl.class.php
69 chmod 666 $OPENEMR/interface/globals.php
70 chown -R apache:apache $OPENEMR/documents
71 chown -R apache:apache $OPENEMR/edi
72 chown -R apache:apache $OPENEMR/era
73 chown -R apache:apache $OPENEMR/custom/letter_templates
74 chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/cache
75 chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
76 chown -R apache:apache $OPENEMR/gacl/admin/templates_c
78 # CONVERT setup.php file to script, then run it
80 cp $OPENEMR/setup.php $OPENEMR/TEMPsetup.php
81 # Set the path variable in setup.php
82 sed -e 's@\$manualPath = \"\"\;@\$manualPath = \"'$OPENEMR'\/\"\;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
83 mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
84 # Set the variables in setup.php
85 sed -e 's@\/\/END POST VARIABLES@\
86 $host = '\'''$setHost''\'';\
87 $server = '\'''$setHost''\'';\
88 $port = '$setPort';\
89 $dbname = '\'''$setDbname''\'';\
90 $root = '\'''$setRoot''\'';\
91 $login = '\'''$setLogin''\'';\
92 $pass = '\'''$setPass''\'';\
93 $loginhost = '\'''$setLoginhost''\'';\
94 $rootpass = '\'''$setRootpass''\'';\
95 $iuser = '\'''$setIuser''\'';\
96 $iuname = '\'''$setIuname''\'';\
97 $igroup = '\'''$setIgroup''\'';\
98 $openemrBasePath = '\'''$OPENEMR''\'';\
99 $openemrWebPath = '\'''$setOpenemrWebPath''\'';\
100 $inst = 1;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
101 mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
102 # Remove form functionality
103 sed -e 's@<INPUT TYPE='\''SUBMIT'\'' VALUE='\''Continue'\''>@ @' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
104 mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
105 #prepare gacl/setup.php script
106 cp $OPENEMR/gacl/setup.php $OPENEMR/gacl/TEMP2setup.php
107 sed -e 's@.\/gacl\/gacl.ini.php@'$OPENEMR'\/gacl\/gacl.ini.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
108 mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
109 sed -e 's@.\/gacl\/admin\/gacl_admin.inc.php@'$OPENEMR'\/gacl\/admin\/gacl_admin.inc.php@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
110 mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
111 sed -e 's@.\/gacl\/schema.xml@'$OPENEMR'\/gacl\/schema.xml@' <$OPENEMR/gacl/setup.php >$OPENEMR/gacl/TEMPsetup.php
112 mv -f $OPENEMR/gacl/TEMPsetup.php $OPENEMR/gacl/setup.php
113 #prepare library/acl.inc script
114 cp $OPENEMR/library/acl.inc $OPENEMR/library/TEMP2acl.inc
115 sed -e 's@\$phpgacl_location = \"gacl\";@\$phpgacl_location = \"'$OPENEMR'\/gacl\";@' <$OPENEMR/library/acl.inc >$OPENEMR/library/TEMPacl.inc
116 mv -f $OPENEMR/library/TEMPacl.inc $OPENEMR/library/acl.inc
117 # (step 3) Set up OpenEMR and MySQL
118 sed -e 's@$state = $_POST\["state"\];@$state = 3;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
119 mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
120 php -f $OPENEMR/TEMPsetup.php >> $LOG
121 # (step 4) Configure sqlconf.php file
122 sed -e 's@$state = 3;@$state = 4;@' <$OPENEMR/TEMPsetup.php >$OPENEMR/TEMP2setup.php
123 mv -f $OPENEMR/TEMP2setup.php $OPENEMR/TEMPsetup.php
124 php -f $OPENEMR/TEMPsetup.php >> $LOG
125 rm -f $OPENEMR/TEMPsetup.php
126 #reinstitute file permissions
127 chmod 644 $OPENEMR/library/sqlconf.php
128 chmod 644 $OPENEMR/gacl/gacl.ini.php
129 chmod 644 $OPENEMR/gacl/gacl.class.php
130 chmod 644 $OPENEMR/interface/globals.php
131 #replace original acl.inc and gacl/setup.php script
132 mv $OPENEMR/library/TEMP2acl.inc $OPENEMR/library/acl.inc
133 mv $OPENEMR/gacl/TEMP2setup.php $OPENEMR/gacl/setup.php
134 echo "Done configuring OpenEMR"