Added php-curl package installation to developer appliance and cvs demo scripts.
[openemr.git] / contrib / util / installScripts / cvsDemoInstall
blob71f35f295ed09f60fb6e9c8e70ab965601a58628
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..."
44 echo "Installing gd(graphics) and mbstring(multibyte support) and zip php packages and xsl php package and perl-CGI package..." >> $LOG
45 urpmi --auto php-gd php-mbstring php-zip php-xsl php-curl perl-CGI patch git-core >> $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 >> $LOG
84 rm -f $INSTTEMP
86 #reinstitute file permissions
87 chmod 644 $OPENEMR/sites/default/sqlconf.php
88 echo "Done configuring OpenEMR"
89 echo "Done configuring OpenEMR" >> $LOG
91 #Patch the suhosin bug
92 SUHOSINCONF=/etc/php.d/Z98_suhosin.ini
93 echo "Disabling suhosin patch which is not compatible with OpenEMR"
94 echo "Disabling suhosin patch which is not compatible with OpenEMR" >> $LOG
95 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:"
96 echo " In /etc/php.d/Z98_suhosin.ini file commenting out:" >> $LOG
97 echo " extension = suhosin.so"
98 echo " extension = suhosin.so" >> $LOG
99 echo " Then will restart apache."
100 echo " Then will restart apache." >> $LOG
101 echo ""
102 sed -i 's/^extension = suhosin.so/; extension = suhosin.so/' $SUHOSINCONF
103 service httpd start
104 echo ""
106 #Replace manual with newest version and add the refresh script
107 echo "Configuring appliance"
108 echo "Configuring appliance" >> $LOG
109 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt /home/openemr/docs/manual.txt
110 chown openemr:openemr /home/openemr/docs/manual.txt
111 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/developerApplianceManual.txt $WEB/manual.txt
112 cp -f $OPENEMR/contrib/util/installScripts/cvsDemoMisc/refresh /home/openemr/git/
113 chown openemr:openemr /home/openemr/git/refresh
114 chmod +x /home/openemr/git/refresh
115 echo "Done configuring appliance"
116 echo "Done configuring appliance" >> $LOG
118 #Package the development version into a tarball and zip file to be available thru web browser
119 # This is basically to allow download of most recent cvs version from the cvs Demo appliance
120 # It will also ease transfer/testing openemr on windows systems when using the Developer appliance
121 echo "Creating OpenEMR Development packages"
122 echo "Creating OpenEMR Development packages" >> $LOG
124 # Prepare the development package
125 mkdir -p $TMPDIR/openemr
126 rsync --recursive --exclude .git $GIT/* $TMPDIR/openemr/
127 chmod a+w $TMPDIR/openemr/sites/default/sqlconf.php
128 chmod -R a+w $TMPDIR/openemr/sites/default/documents
129 chmod -R a+w $TMPDIR/openemr/sites/default/edi
130 chmod -R a+w $TMPDIR/openemr/sites/default/era
131 chmod -R a+w $TMPDIR/openemr/library/freeb
132 chmod -R a+w $TMPDIR/openemr/sites/default/letter_templates
133 chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/cache
134 chmod -R a+w $TMPDIR/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
135 chmod -R a+w $TMPDIR/openemr/gacl/admin/templates_c
137 # Create the web file directory
138 mkdir $WEB/files
140 # Save the tar.gz cvs package
141 cd $TMPDIR
142 tar -czf $WEB/files/openemr-cvs.tar.gz openemr
143 cd $WEB/files
144 md5sum openemr-cvs.tar.gz > openemr-linux-md5.txt
146 # Save the .zip cvs package
147 cd $TMPDIR
148 zip -rq $WEB/files/openemr-cvs.zip openemr
149 cd $WEB/files
150 md5sum openemr-cvs.zip > openemr-windows-md5.txt
152 # Create the time stamp
153 date > date-cvs.txt
155 # Clean up
156 rm -fr $TMPDIR
157 echo "Done creating OpenEMR Development packages"
158 echo "Done creating OpenEMR Development packages" >> $LOG