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)
17 #flag for the isntance to serve as the developer translation set server
23 LOG
=$WEB/log
/logSetup.txt
25 GITMAIN
=/home
/openemr
/git
27 TMPDIR
=/tmp
/openemr-tmp
28 TRANSSERVEDIR
=$WEB/translations
29 GITTRANS
=$GITMAIN/translations_development_openemr
31 # PATH OF INSTALL SCRIPT
32 INST
=$OPENEMR/contrib
/util
/installScripts
/InstallerAuto.php
33 INSTTEMP
=$OPENEMR/contrib
/util
/installScripts
/InstallerAutoTemp.php
35 # Turn off apache to avoid users messing up while setting up
36 # (start it again below after install/configure openemr
39 # Connect to a new mandriva package repository (official repository no longer supports mandriva 2008)
40 echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes."
41 echo "Updating new Mandriva Package repository. This is a 100MB download, so may take several minutes." >> $LOG
42 urpmi.addmedia main http
://ftp.ussg.iu.edu
/linux
/mandrake
/official
/2008.0/i586
/media
/main
/release with media_info
/hdlist.cz
43 urpmi.addmedia
--update main_updates http
://ftp.ussg.iu.edu
/linux
/mandrake
/official
/2008.0/i586
/media
/main
/updates with media_info
/hdlist.cz
44 urpmi.addmedia contrib http
://ftp.ussg.iu.edu
/linux
/mandrake
/official
/2008.0/i586
/media
/contrib
/release with media_info
/hdlist.cz
45 urpmi.addmedia
--update contrib_updates http
://ftp.ussg.iu.edu
/linux
/mandrake
/official
/2008.0/i586
/media
/contrib
/updates with media_info
/hdlist.cz
47 # Install php-gd (graphics), php-mbstring (multibyte character support), php-zip, php-xsl and perl-CGI packages
48 # and restart apache (done after below suhosin patch).
49 echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package and git packages..."
50 echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package and git packages..." >> $LOG
51 urpmi
--auto php-gd php-mbstring php-zip php-xsl php-curl php-mcrypt perl-CGI
patch git-core qgit
>> $LOG
53 #Patch the suhosin bug
54 SUHOSINCONF
=/etc
/php.d
/Z98_suhosin.ini
55 echo "Disabling suhosin patch which is not compatible with OpenEMR"
56 echo "Disabling suhosin patch which is not compatible with OpenEMR" >> $LOG
57 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:"
58 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:" >> $LOG
59 echo " extension = suhosin.so"
60 echo " extension = suhosin.so" >> $LOG
61 echo " Then will restart apache."
62 echo " Then will restart apache." >> $LOG
64 sed -i 's/^extension = suhosin.so/; extension = suhosin.so/' $SUHOSINCONF
68 # COLLECT THE GIT REPO (if it doesn't exist)
69 if ! [ -d $GITMAIN ]; then
70 echo "Downloading the OpenEMR git repository"
71 echo "Downloading the OpenEMR git repository" >> $LOG
74 git clone git
://github.com
/openemr
/openemr.git
75 if $translationServe ; then
76 # download the translations git repo and place the set sql file for serving
77 git clone git
://github.com
/openemr
/translations_development_openemr.git
78 mkdir
-p $TRANSSERVEDIR
79 cp $GITTRANS/languageTranslations_utf8.sql
$TRANSSERVEDIR/
82 echo "The OpenEMR git repository already exist"
83 echo "The OpenEMR git repository already exist" >> $LOG
86 # COPY THE GIT REPO OPENEMR COPY TO THE WEB DIRECTOY
87 echo "Copy git OpenEMR to web directory"
88 echo "Copy git OpenEMR to web directory" >> $LOG
90 rsync
--recursive --exclude .git
$GIT/* $OPENEMR/
92 #INSTALL AND CONFIGURE OPENEMR
93 echo "Configuring OpenEMR"
94 echo "Configuring OpenEMR" >> $LOG
96 # Set file and directory permissions
97 chmod 666 $OPENEMR/sites
/default
/sqlconf.php
98 chown
-R apache
:apache
$OPENEMR/sites
/default
/documents
99 chown
-R apache
:apache
$OPENEMR/sites
/default
/edi
100 chown
-R apache
:apache
$OPENEMR/sites
/default
/era
101 chown
-R apache
:apache
$OPENEMR/library
/freeb
102 chown
-R apache
:apache
$OPENEMR/sites
/default
/letter_templates
103 chown
-R apache
:apache
$OPENEMR/interface
/main
/calendar
/modules
/PostCalendar
/pntemplates
/cache
104 chown
-R apache
:apache
$OPENEMR/interface
/main
/calendar
/modules
/PostCalendar
/pntemplates
/compiled
105 chown
-R apache
:apache
$OPENEMR/gacl
/admin
/templates_c
107 # Run installer class for the demo (note to avoid malicious use, script is activated by removing an exit command,
108 # and the active script is then removed after completion.
109 sed -e 's@^exit;@ @' <$INST >$INSTTEMP
110 php
-f $INSTTEMP development_translations
=yes >> $LOG
113 # Run the sql_patch.php script. Note that in the main 'master' branch this will do nothing, however in the
114 # branches it will install the new Globals and Database modifications (note need to copy to TEMP file etc.
115 # in order to work around the site variable that is required)
117 echo "<?php \$_GET['site'] = 'default'; ?>" > $OPENEMR/TEMPsql_patch.php
118 cat $OPENEMR/sql_patch.php
>> $OPENEMR/TEMPsql_patch.php
119 php
-f TEMPsql_patch.php
>> $LOG
120 rm -f $OPENEMR/TEMPsql_patch.php
122 #reinstitute file permissions
123 chmod 644 $OPENEMR/sites
/default
/sqlconf.php
124 echo "Done configuring OpenEMR"
125 echo "Done configuring OpenEMR" >> $LOG
127 #Replace manual with newest version and add the refresh script
128 echo "Configuring appliance"
129 echo "Configuring appliance" >> $LOG
130 cp -f $OPENEMR/contrib
/util
/installScripts
/cvsDemoMisc
/developerApplianceManual.txt
/home
/openemr
/docs
/manual.txt
131 chown openemr
:openemr
/home
/openemr
/docs
/manual.txt
132 cp -f $OPENEMR/contrib
/util
/installScripts
/cvsDemoMisc
/developerApplianceManual.txt
$WEB/manual.txt
133 cp -f $OPENEMR/contrib
/util
/installScripts
/cvsDemoMisc
/refresh
/home
/openemr
/git
/
134 chown openemr
:openemr
/home
/openemr
/git
/refresh
135 chmod +x
/home
/openemr
/git
/refresh
136 echo "Done configuring appliance"
137 echo "Done configuring appliance" >> $LOG
139 #Package the development version into a tarball and zip file to be available thru web browser
140 # This is basically to allow download of most recent cvs version from the cvs Demo appliance
141 # It will also ease transfer/testing openemr on windows systems when using the Developer appliance
142 echo "Creating OpenEMR Development packages"
143 echo "Creating OpenEMR Development packages" >> $LOG
145 # Prepare the development package
146 mkdir
-p $TMPDIR/openemr
147 rsync
--recursive --exclude .git
$GIT/* $TMPDIR/openemr
/
148 chmod a
+w
$TMPDIR/openemr
/sites
/default
/sqlconf.php
149 chmod -R a
+w
$TMPDIR/openemr
/sites
/default
/documents
150 chmod -R a
+w
$TMPDIR/openemr
/sites
/default
/edi
151 chmod -R a
+w
$TMPDIR/openemr
/sites
/default
/era
152 chmod -R a
+w
$TMPDIR/openemr
/library
/freeb
153 chmod -R a
+w
$TMPDIR/openemr
/sites
/default
/letter_templates
154 chmod -R a
+w
$TMPDIR/openemr
/interface
/main
/calendar
/modules
/PostCalendar
/pntemplates
/cache
155 chmod -R a
+w
$TMPDIR/openemr
/interface
/main
/calendar
/modules
/PostCalendar
/pntemplates
/compiled
156 chmod -R a
+w
$TMPDIR/openemr
/gacl
/admin
/templates_c
158 # Create the web file directory
161 # Save the tar.gz cvs package
163 rm -f $WEB/files
/openemr-cvs.
tar.gz
164 tar -czf $WEB/files
/openemr-cvs.
tar.gz openemr
166 md5sum openemr-cvs.
tar.gz
> openemr-linux-md5.txt
168 # Save the .zip cvs package
170 rm -f $WEB/files
/openemr-cvs.
zip
171 zip -rq $WEB/files
/openemr-cvs.
zip openemr
173 md5sum openemr-cvs.
zip > openemr-windows-md5.txt
175 # Create the time stamp
180 echo "Done creating OpenEMR Development packages"
181 echo "Done creating OpenEMR Development packages" >> $LOG