Implement new security model in LBF forms.
[openemr.git] / contrib / util / installScripts / cvsDemoInstall
blobeb7ba3de05e574e5df053cca01f1f2d1c9ebecdd
1 #!/bin/sh
2 # Copyright (C) 2010 Brady Miller <brady@sparmy.com>
4 #This program is free software; you can redistribute it and/or modify
5 #it under the terms of the GNU General Public License as published by
6 #the Free Software Foundation; either version 2 of the License, or
7 #(at your option) any later version.
9 #This script is called by the the OpenEMR developer demos and
10 # developer appliance. It configures the Developer Demos and the
11 # Developer Appliance with the most recent git repository.
12 # (Note it first actually grabs the cvs version)
13 # Logs errors.
16 # PATH VARIABLES
17 WEB=/var/www/html
18 OPENEMR=$WEB/openemr
19 LOG=$WEB/log/logSetup.txt
20 CVS=/home/openemr/cvs
21 GITMAIN=/home/openemr/git
22 GIT=$GITMAIN/openemr
23 TMPDIR=/tmp/openemr-tmp
25 # PATH OF INSTALL SCRIPT
26 INST=$OPENEMR/contrib/util/installScripts/InstallerAuto.php
27 INSTTEMP=$OPENEMR/contrib/util/installScripts/InstallerAutoTemp.php
29 # Turn off apache to avoid users messing up while setting up
30 # (start it again below after install/configure openemr
31 service httpd stop
33 # Connect to a new mandriva package repository (official repository no longer supports mandriva 2008)
34 echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes."
35 echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes." >> $LOG
36 urpmi.addmedia main http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/main/release with media_info/hdlist.cz
37 urpmi.addmedia --update main_updates http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/main/updates with media_info/hdlist.cz
38 urpmi.addmedia contrib http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/contrib/release with media_info/hdlist.cz
39 urpmi.addmedia --update contrib_updates http://ftp.ussg.iu.edu/linux/mandrake/official/2008.0/i586/media/contrib/updates with media_info/hdlist.cz
41 # Install php-gd (graphics), php-mbstring (multibyte character support), php-zip, php-xsl and perl-CGI packages
42 # and restart apache (done after below suhosin patch).
43 echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package and git packages..."
44 echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package and git packages..." >> $LOG
45 urpmi --auto php-gd php-mbstring php-zip php-xsl php-curl php-mcrypt perl-CGI patch git-core qgit >> $LOG
47 # COLLECT THE GIT REPO (if it doesn't exist)
48 if ! [ -d $GITMAIN ]; then
49 echo "Downloading the OpenEMR git repository"
50 echo "Downloading the OpenEMR git repository" >> $LOG
51 mkdir -p $GITMAIN
52 cd $GITMAIN
53 git clone git://github.com/openemr/openemr.git
54 else
55 echo "The OpenEMR git repository already exist"
56 echo "The OpenEMR git repository already exist" >> $LOG
59 # COPY THE GIT REPO OPENEMR COPY TO THE WEB DIRECTOY
60 echo "Copy git OpenEMR to web directory"
61 echo "Copy git OpenEMR to web directory" >> $LOG
62 rm -fr $OPENEMR/*
63 rsync --recursive --exclude .git $GIT/* $OPENEMR/
65 #INSTALL AND CONFIGURE OPENEMR
66 echo "Configuring OpenEMR"
67 echo "Configuring OpenEMR" >> $LOG
69 # Set file and directory permissions
70 chmod 666 $OPENEMR/sites/default/sqlconf.php
71 chown -R apache:apache $OPENEMR/sites/default/documents
72 chown -R apache:apache $OPENEMR/sites/default/edi
73 chown -R apache:apache $OPENEMR/sites/default/era
74 chown -R apache:apache $OPENEMR/library/freeb
75 chown -R apache:apache $OPENEMR/sites/default/letter_templates
76 chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/cache
77 chown -R apache:apache $OPENEMR/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
78 chown -R apache:apache $OPENEMR/gacl/admin/templates_c
80 # Run installer class for the demo (note to avoid malicious use, script is activated by removing an exit command,
81 # and the active script is then removed after completion.
82 sed -e 's@^exit;@ @' <$INST >$INSTTEMP
83 php -f $INSTTEMP development_translations=yes >> $LOG
84 rm -f $INSTTEMP
86 # Run the sql_patch.php script. Note that in the main 'master' branch this will do nothing, however in the
87 # branches it will install the new Globals and Database modifications (note need to copy to TEMP file etc.
88 # in order to work around the site variable that is required)
89 cd $OPENEMR
90 echo "<?php \$_GET['site'] = 'default'; ?>" > $OPENEMR/TEMPsql_patch.php
91 cat $OPENEMR/sql_patch.php >> $OPENEMR/TEMPsql_patch.php
92 php -f TEMPsql_patch.php >> $LOG
93 rm -f $OPENEMR/TEMPsql_patch.php
95 #reinstitute file permissions
96 chmod 644 $OPENEMR/sites/default/sqlconf.php
97 echo "Done configuring OpenEMR"
98 echo "Done configuring OpenEMR" >> $LOG
100 #Patch the suhosin bug
101 SUHOSINCONF=/etc/php.d/Z98_suhosin.ini
102 echo "Disabling suhosin patch which is not compatible with OpenEMR"
103 echo "Disabling suhosin patch which is not compatible with OpenEMR" >> $LOG
104 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:"
105 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:" >> $LOG
106 echo " extension = suhosin.so"
107 echo " extension = suhosin.so" >> $LOG
108 echo " Then will restart apache."
109 echo " Then will restart apache." >> $LOG
110 echo ""
111 sed -i 's/^extension = suhosin.so/; extension = suhosin.so/' $SUHOSINCONF
112 service httpd start
113 echo ""
115 #Replace manual with newest version and add the refresh script
116 echo "Configuring appliance"
117 echo "Configuring appliance" >> $LOG
118 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt /home/openemr/docs/manual.txt
119 chown openemr:openemr /home/openemr/docs/manual.txt
120 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt $WEB/manual.txt
121 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/refresh /home/openemr/git/
122 chown openemr:openemr /home/openemr/git/refresh
123 chmod +x /home/openemr/git/refresh
124 echo "Done configuring appliance"
125 echo "Done configuring appliance" >> $LOG
127 #Package the development version into a tarball and zip file to be available thru web browser
128 # This is basically to allow download of most recent cvs version from the cvs Demo appliance
129 # It will also ease transfer/testing openemr on windows systems when using the Developer appliance
130 echo "Creating OpenEMR Development packages"
131 echo "Creating OpenEMR Development packages" >> $LOG
133 # Prepare the development package
134 mkdir -p $TMPDIR/openemr
135 rsync --recursive --exclude .git $GIT/* $TMPDIR/openemr/
136 chmod a+w $TMPDIR/openemr/sites/default/sqlconf.php
137 chmod -R a+w $TMPDIR/openemr/sites/default/documents
138 chmod -R a+w $TMPDIR/openemr/sites/default/edi
139 chmod -R a+w $TMPDIR/openemr/sites/default/era
140 chmod -R a+w $TMPDIR/openemr/library/freeb
141 chmod -R a+w $TMPDIR/openemr/sites/default/letter_templates
142 chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/cache
143 chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
144 chmod -R a+w $TMPDIR/openemr/gacl/admin/templates_c
146 # Create the web file directory
147 mkdir $WEB/files
149 # Save the tar.gz cvs package
150 cd $TMPDIR
151 rm -f $WEB/files/openemr-cvs.tar.gz
152 tar -czf $WEB/files/openemr-cvs.tar.gz openemr
153 cd $WEB/files
154 md5sum openemr-cvs.tar.gz > openemr-linux-md5.txt
156 # Save the .zip cvs package
157 cd $TMPDIR
158 rm -f $WEB/files/openemr-cvs.zip
159 zip -rq $WEB/files/openemr-cvs.zip openemr
160 cd $WEB/files
161 md5sum openemr-cvs.zip > openemr-windows-md5.txt
163 # Create the time stamp
164 date > date-cvs.txt
166 # Clean up
167 rm -fr $TMPDIR
168 echo "Done creating OpenEMR Development packages"
169 echo "Done creating OpenEMR Development packages" >> $LOG