[med-svn] [openemr] 01/01: Latest fix attempts for integrating with watch file (correct version managle), reducing clutter in maintainer scripts, integration with Apache2 helper scripts, and attempt to use Debian shipped phpmyadmin (still BROKEN) but closer.

Ian Wallace iankarlwallace-guest at moszumanska.debian.org
Thu Aug 21 08:16:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

iankarlwallace-guest pushed a commit to branch master
in repository openemr.

commit 6b83237193077823ab6ba43536295dde1bae4387
Author: Ian Wallace <iankarlwallace at gmail.com>
Date:   Thu Aug 21 01:15:46 2014 -0700

    Latest fix attempts for integrating with watch file (correct version managle), reducing clutter in maintainer scripts, integration with Apache2 helper scripts, and attempt to use Debian shipped phpmyadmin (still BROKEN) but closer.
---
 debian/control                       |  49 ++++----
 debian/install                       |   2 +-
 debian/openemr.apache2               |   1 +
 debian/{apache.conf => openemr.conf} |  35 +++++-
 debian/openemr.config.inc.php        |  53 ++++++++
 debian/openemr.links                 |   1 -
 debian/postinst                      | 226 ++++++-----------------------------
 debian/postrm                        |   2 +-
 debian/preinst                       |   2 +-
 debian/prerm                         |  26 ++--
 debian/rules                         |   2 +-
 debian/watch                         |   4 +-
 12 files changed, 169 insertions(+), 234 deletions(-)

diff --git a/debian/control b/debian/control
index 5639e8c..4e2fe6e 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,8 @@ Uploaders: Andreas Tille <tille at debian.org>,
 Section: science
 Priority: optional
 Build-Depends: debhelper (>= 9),
-	 po-debconf
+	 po-debconf,
+     dh-apache2
 Standards-Version: 3.9.5
 Vcs-Browser: https://alioth.debian.org/anonscm/git/debian-med/openemr.git
 Vcs-Git: https://alioth.debian.org/anonscm/git/debian-med/openemr.git
@@ -14,34 +15,36 @@ Homepage: http://www.open-emr.org/
 
 Package: openemr
 Architecture: all
-Pre-Depends: debconf
 Depends: ${misc:Depends},
+     ${perl:Depends},
 	 dbconfig-common,
 	 mysql-client,
-         mysql-server,
-         apache2-mpm-prefork,
-         makepasswd,
-         libapache2-mod-php5,
-         libdate-calc-perl,
-         libdbd-mysql-perl,
-         libdbi-perl,
-         libhtml-parser-perl,
-         libtiff-tools,
-         libwww-mechanize-perl,
-         libxml-parser-perl,
-         php5,
-         php5-mysql,
-         php5-cli,
-         php5-gd,
-         php5-xsl,
-         php5-curl,
-         php5-mcrypt,
-         php5-json,
-         php-soap,
+     mysql-server,
+     phpmyadmin,
+     apache2-mpm-prefork,
+     makepasswd,
+     libapache2-mod-php5,
+     libdate-calc-perl,
+     libdbd-mysql-perl,
+     libdbi-perl,
+     libhtml-parser-perl,
+     libtiff-tools,
+     libwww-mechanize-perl,
+     libxml-parser-perl,
+     php5,
+     php5-mysql,
+     php5-cli,
+     php5-gd,
+     php5-xsl,
+     php5-curl,
+     php5-mcrypt,
+     php5-json,
+     php-soap,
 	 libjs-jquery,
 	 libjs-jquery-cookie,
 	 smarty3,
-         imagemagick
+     imagemagick
+Recommends: ${misc:Recommends}
 Description: Comprehensive medical practice management
  OpenEMR is a free medical practice management, electronic medical
  records, prescription writing, and medical billing application. These
diff --git a/debian/install b/debian/install
index 17a8324..926916f 100644
--- a/debian/install
+++ b/debian/install
@@ -32,4 +32,4 @@ version.php										usr/share/openemr
 
 sites													var/lib/openemr
 
-debian/apache.conf						etc/openemr
+debian/openemr.config.inc.php        etc/phpmyadmin/conf.d
diff --git a/debian/openemr.apache2 b/debian/openemr.apache2
new file mode 100644
index 0000000..2587e2b
--- /dev/null
+++ b/debian/openemr.apache2
@@ -0,0 +1 @@
+conf debian/openemr.conf
diff --git a/debian/apache.conf b/debian/openemr.conf
similarity index 55%
rename from debian/apache.conf
rename to debian/openemr.conf
index b8bc14b..8d9a582 100644
--- a/debian/apache.conf
+++ b/debian/openemr.conf
@@ -1,7 +1,40 @@
 # OpenEMR default Apache configuration
 
-Alias /openemr /usr/share/openemr
+Alias /openemr/phpmyadmin /usr/share/phpmyadmin
+<Directory /usr/share/phpmyadmin>
+    Options FollowSymLinks
+    DirectoryIndex index.php
+
+    <IfModule mod_php5.c>
+        <IfModule mod_mime.c>
+            AddType application/x-httpd-php .php
+        </IfModule>
+        <FilesMatch ".+\.php$">
+            SetHandler application/x-httpd-php
+        </FilesMatch>
 
+        php_flag magic_quotes_gpc Off
+        php_flag track_vars On
+        php_flag register_globals Off
+        php_admin_flag allow_url_fopen Off
+        php_value include_path .
+        php_admin_value upload_tmp_dir /var/lib/openemr/tmp
+        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/
+    </IfModule>
+</Directory>
+
+# Disallow web access to directories that don't need it
+<Directory /usr/share/phpmyadmin/setup>
+    Require all denied
+</Directory>
+<Directory /usr/share/phpmyadmin/libraries>
+    Require all denied
+</Directory>
+<Directory /usr/share/phpmyadmin/setup/lib>
+    Require all denied
+</Directory>
+
+Alias /openemr /usr/share/openemr
 <Directory /usr/share/openemr>
 	Options Indexes FollowSymLinks MultiViews
 	DirectoryIndex index.php
diff --git a/debian/openemr.config.inc.php b/debian/openemr.config.inc.php
new file mode 100644
index 0000000..a28d239
--- /dev/null
+++ b/debian/openemr.config.inc.php
@@ -0,0 +1,53 @@
+<?php
+/*
+* OpenEMR Embedded phyMyAdmin
+*/
+
+// Access control is dealt with by the ACL check
+$ignoreAuth = true;
+require_once("/usr/share/openemr/interface/globals.php");
+
+# If request is coming from OpenEMR URI then perform checks and reconfigure server
+$pattern="/^\".$web_root."\/phpmyadmin\/*/";
+if ( preg_match("$pattern",$_SERVER['REQUEST_URI']) === 1 ) {
+    error_log("oer: URI [".$_SERVER['REQUEST_URI']."] matched [".$pattern."], reconfigure phpmyadmin.");
+
+    error_log("oer: Check GLOBALS is set and not disabled.");
+    if ( (!isset($GLOBALS['disable_phpmyadmin_link'])) || $GLOBALS['disable_phpmyadmin_link'] == TRUE ) {
+        error_log("oer: GLOBALS[disable_phpmyadmin_link] is not set or disabled.  Denie access.");
+        echo "<html><head><title>phpMyAdmin Disabled</title></head><body><h2>phpMyAdmin Access has been disabled in OpenEMR</h2></body></html>";
+        exit(1);
+    }
+
+    error_log("oer: Checking ACL access allowed.");
+    require_once("/usr/share/openemr/library/acl.inc");
+    if ( acl_check('admin','database') != 1 ) {
+        echo "<html><head><title>Access Failed</title></head><body><h2>You are not allowed to access phpmyadmin.</h2></body></html>";
+        exit(1);
+    }
+
+    ob_start;
+    var_dump($sqlconf);
+    $result = ob_get_clean();
+    error_log("oer: sqlconf contains [".$result."]");
+
+    /* Server (config:openemr) [1] */
+    $i=1;
+    /* For standard OpenEMR database access */
+    $cfg['Servers'][$i]['auth_type'] = 'config';
+    $cfg['Servers'][$i]['host'] = $sqlconf['host'];
+    $cfg['Servers'][$i]['port'] = $sqlconf['port'];
+    $cfg['Servers'][$i]['user'] = $sqlconf['login'];
+    $cfg['Servers'][$i]['password'] = $sqlconf['pass'];
+    $cfg['Servers'][$i]['only_db'] = $sqlconf['dbase'];
+    /* Other mods for OpenEMR */
+    $cfg['AllowThirdPartyFraming'] = TRUE;
+    $cfg['ShowCreateDb'] = false;
+    $cfg['ShowPhpInfo'] = TRUE;
+
+    
+} else {
+    error_log("oer: Bypassing configuration.  URI [".$_SERVER['REQUEST_URI']."] doesn't match [".$pattern."]");
+}
+
+?>
diff --git a/debian/openemr.links b/debian/openemr.links
index f6f2775..9c7a8d1 100644
--- a/debian/openemr.links
+++ b/debian/openemr.links
@@ -1,4 +1,3 @@
-/etc/openemr/apache.conf /etc/apache2/conf-available/openemr.conf
 /var/lib/openemr/sites /usr/share/openemr/sites
 /var/lib/openemr/gacl/admin/templates_c /usr/share/openemr/gacl/admin/templates_c
 /var/lib/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled /usr/share/openemr/interface/main/calendar/modules/PostCalendar/pntemplates/compiled
diff --git a/debian/postinst b/debian/postinst
index 825c40b..8a35606 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -xe
 #
 #This program is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ case "$1" in
       CONFIGDIR=/etc/openemr
       CONFIG=$CONFIGDIR/openemr.conf
       TMPDIR=`mktemp -d`
-      WEB=/usr/share/
+      WEB=/usr/share
       OPENEMR=$WEB/openemr
       SITEDIR=$OPENEMR/sites
       #hardcoded mysql user and database for install (not pertinent for upgrading)
@@ -178,13 +178,14 @@ case "$1" in
 
             #upgrade the sql database
             CONC_VERSION=$(echo $OLD_VERSION | cut -d \- -f 1)
-            echo "<?php \$_GET['site'] = '$SITENAME'; ?>" > $TMPDIR/TEMPsql_upgrade.php
-            cat $OPENEMR/sql_upgrade.php >> $TMPDIR/TEMPsql_upgrade.php
-            sed -i "/input type='submit'/d" $TMPDIR/TEMPsql_upgrade.php
-            sed -i "s/!empty(\$_POST\['form_submit'\])/empty(\$_POST\['form_submit'\])/" $TMPDIR/TEMPsql_upgrade.php
-            sed -i "s/^[   ]*\$form_old_version[   =].*$/\$form_old_version = \"$CONC_VERSION\";/" $TMPDIR/TEMPsql_upgrade.php
-            php -f $TMPDIR/TEMPsql_upgrade.php >> $LOG 2>&1
-            rm -f $TMPDIR/TEMPsql_upgrade.php
+            TMPSQLUPGRADE=`mktemp --tmpdir $TMPDIR TEMPsql_upgrade-XXXX.php`
+            echo "<?php \$_GET['site'] = '$SITENAME'; ?>" > $TMPSQLUPGRADE
+            cat $OPENEMR/sql_upgrade.php >> $TMPSQLUPGRADE
+            sed -i "/input type='submit'/d" $TMPSQLUPGRADE
+            sed -i "s/!empty(\$_POST\['form_submit'\])/empty(\$_POST\['form_submit'\])/" $TMPSQLUPGRADE
+            sed -i "s/^[   ]*\$form_old_version[   =].*$/\$form_old_version = \"$CONC_VERSION\";/" $TMPSQLUPGRADE
+            php -f $TMPSQLUPGRADE >> $LOG 2>&1
+            rm -f $TMPSQLUPGRADE
 
 #WARNING:: In the original scripts OpenEMR would keep a copy of the config.php
 #The only site that would probably be effected in the current package would be default since that ships with a config.php and a sqlconf.php
@@ -338,10 +339,6 @@ case "$1" in
       #go to openemr directory
       cd $OPENEMR
 
-      #secure openemr
-			# this is already done in the package for Debian
-      # chown -Rf root:root $OPENEMR
-
       #INSTALL/CONFIGURE OPENEMR
       # Install openemr
       if $configure_flag; then
@@ -351,7 +348,7 @@ case "$1" in
       fi
 
       # Set file and directory permissions (note use default site directory for new install)
-			chown $WEB_GROUP.$WEB_USER $SITEDIR/default/sqlconf.php
+	  chown $WEB_GROUP.$WEB_USER $SITEDIR/default/sqlconf.php
       chmod 640 $SITEDIR/default/sqlconf.php
       chown -R $WEB_GROUP.$WEB_USER $SITEDIR/default/documents
       chown -R $WEB_GROUP.$WEB_USER $SITEDIR/default/edi
@@ -394,180 +391,23 @@ case "$1" in
 
          log_only "Done configuring OpenEMR"
       fi
+      
+      # Apache configuration is stored in separate file and installed in package installation
+      # Only will need to enable configuration and then restart apache
+      CONF="openemr"
+      COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+      if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+          . /usr/share/apache2/apache2-maintscript-helper
+          apache2_invoke enconf $CONF || exit $?
+      elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+          if [ -d /etc/apache2/conf.d/ -a ! -L /etc/apache2/conf.d/$CONF.conf ]; then
+              ln -s ../conf-available/$CONF.conf /etc/apache2/conf.d/$CONF.conf
+          fi
+      fi
 
-      #This section configures Apache for OpenEMR
-      #log_only "Configuring Apache for OpenEMR"
-
-      #Check to ensure the apache configuration files exists
-      #if [ -f $APACHE ]; then
-
-         # First, backup the httpd.conf file before modifying
-      #   cp -f $APACHE $APACHE.BAK
-
-         # Second, append information to secure selected directories in OpenEMR
-      #   echo "#This is the start of the Apache configuration for OpenEMR." >> $APACHE
-      #   echo "#Below will secure directories with patient information." >> $APACHE
-      #   echo "<Directory \"$SITEDIR/*/documents\">" >> $APACHE
-      #   echo " order deny,allow" >> $APACHE
-      #   echo " Deny from all" >> $APACHE
-      #   echo "</Directory>" >> $APACHE
-      #   echo "<Directory \"$SITEDIR/*/edi\">" >> $APACHE
-      #   echo " order deny,allow" >> $APACHE
-      #   echo " Deny from all" >> $APACHE
-      #   echo "</Directory>" >> $APACHE
-      #   echo "<Directory \"$SITEDIR/*/era\">" >> $APACHE
-      #   echo " order deny,allow" >> $APACHE
-      #   echo " Deny from all" >> $APACHE
-      #   echo "</Directory>" >> $APACHE
-      #   echo "#This is the end of the Apache configuration for OpenEMR." >> $APACHE
-
-         #let user know the plan
-      #   prompt_input openemr/apache_configure high ret_result
-      #   log_only "Added entries to apache configuration to secure directories with patient information."
-      #   log_only "Placed backup of your original apache configuration file to $APACHE.BAK"
-
-      #else
-         #can't find apache config file, so just echo instructions
-      #   log_only "We recommend placing below lines into your apache configuration file:"
-      #   log_only "#This is the start of the Apache configuration for OpenEMR."
-      #   log_only "#Below will secure directories with patient information."
-      #   log_only "<Directory \"$SITEDIR/*/documents\">"
-      #   log_only " order deny,allow"
-      #   log_only " Deny from all"
-      #   log_only "</Directory>"
-      #   log_only "<Directory \"$SITEDIR/*/edi\">"
-      #   log_only " order deny,allow"
-      #   log_only " Deny from all"
-      #   log_only "</Directory>"
-      #   log_only "<Directory \"$SITEDIR/*/era\">"
-      #   log_only " order deny,allow"
-      #   log_only " Deny from all"
-      #   log_only "</Directory>"
-      #   log_only "#This is the end of the Apache configuration for OpenEMR."
-      #fi
-
-      #log_only "Done configuring Apache"
-
-      #This Section edits the php.ini file to accomodate the proper functioning of OpenEMR using php
-      #log_only "Configuring PHP for OpenEMR"
-
-      #check to ensure the php configuration file exists
-      #if [ -f $PHP ]; then
-      #   # First, collect php variables
-      #   collect_php () {
-      #      echo `grep -i "^[[:space:]]*$1[[:space:]=]" $PHP | cut -d \= -f 2 | cut -d \; -f 1 | sed 's/[ 	M]//gi'`
-      #   }
-      #   TAG_TEXT="short_open_tag"
-      #   TAG=$(collect_php "$TAG_TEXT")
-      #   EXEC_TEXT="max_execution_time"
-      #   EXEC=$(collect_php "$EXEC_TEXT")
-      #   INPUT_TEXT="max_input_time"
-      #   INPUT=$(collect_php "$INPUT_TEXT")
-      #   MEM_TEXT="memory_limit"
-      #   MEM=$(collect_php "$MEM_TEXT")
-      #   DISP_TEXT="display_errors"
-      #   DISP=$(collect_php "$DISP_TEXT")
-      #   LOGG_TEXT="log_errors"
-      #   LOGG=$(collect_php "$LOGG_TEXT")
-      #   GLOB_TEXT="register_globals"
-      #   GLOB=$(collect_php "$GLOB_TEXT")
-      #   POST_TEXT="post_max_size"
-      #   POST=$(collect_php "$POST_TEXT")
-      #   UPLOAD_TEXT="file_uploads"
-      #   UPLOAD=$(collect_php "$UPLOAD_TEXT")
-      #   FILESIZE_TEXT="upload_max_filesize"
-      #   FILESIZE=$(collect_php "$FILESIZE_TEXT")
-      #   MAXINPUTVARS_TEXT="max_input_vars"
-      #   MAXINPUTVARS=$(collect_php "$MAXINPUTVARS_TEXT")
-#
-         # Second, backup the php.ini file before modifying
-#         cp $PHP $PHP.BAK
-
-         # Third, edit the required entries
-         #  Do this in a for loop.
-         #   First iteration will discover the recommended changes
-         #   Second iteration will make the changes (if user request this)
-#         FLAG_ON=0
-#         process_php () {
-#            if [ "$3" -eq "1" ]; then
-#               # make rec to php.ini
-#               if [ "$FLAG_ON" -eq "0" ]; then
-#                  log_only "We changed the following setting(s) in your php configuration file at $PHP :"
-#               fi      
-#               FLAG_ON=1
-#            else
-#               # modify php.ini
-#               sed -i "s/^[ 	]*$1[ 	=].*$/$1 = $2/" $PHP
-#               log_only "Successfully set $1 = $2"  
-#            fi
-#         }
-#         for i in `seq 1 2`; do
-#            if [ "$TAG" != "On" ]; then
-#               process_php "$TAG_TEXT" "On" $i
-#            fi
-#            if [ "$EXEC" -lt "60" ]; then
-#               process_php "$EXEC_TEXT" "60" $i
-#            fi
-#            if [ "$INPUT" -lt "90" ]; then
-#               process_php "$INPUT_TEXT" "90" $i
-#            fi
-#            if [ "$MEM" -lt "128" ]; then
-#               process_php "$MEM_TEXT" "128M" $i
-#            fi
-#            if [ "$DISP" != "Off" ]; then
-#               process_php "$DISP_TEXT" "Off" $i
-#            fi
-#            if [ "$LOGG" != "On" ]; then
-#               process_php "$LOGG_TEXT" "On" $i
-#            fi
-#            if [ "$GLOB" != "Off" ]; then
-#               process_php "$GLOB_TEXT" "Off" $i
-#            fi
-#            if [ "$POST" -lt "30" ]; then
-#               process_php "$POST_TEXT" "30M" $i
-#            fi
-#            if [ "$UPLOAD" != "On" ]; then
-#               process_php "$UPLOAD_TEXT" "On" $i
-#            fi
-#            if [ "$FILESIZE" -lt "30" ]; then
-#               process_php "$FILESIZE_TEXT" "30M" $i
-#            fi
-#            if [ "$MAXINPUTVARS" -lt "3000" ]; then
-#               process_php "$MAXINPUTVARS_TEXT" "3000" $i
-#            fi
-#            if [ "$FLAG_ON" -eq "0" ]; then
-#              log_only "Your PHP configuration is perfect for OpenEMR."
-#              break
-#            else
-#              if [ "$i" -eq "1" ]; then
-#                prompt_input openemr/php_configure high ret_result
-#              fi
-#            fi
-#            if [ "$i" -eq "1" ]; then
-#               log_only "(We have placed a backup of your php configuration at $PHP.BAK)"
-#            fi
-#         done
-#      else
-#         #can't find php config file, so just echo instructions
-#         log_only "We recommend ensuring you have below settings in your php configuration file:"
-#         log_only "short_open_tag = On"
-#         log_only "max_execution_time = 60"
-#         log_only "max_input_time = 90"
-#         log_only "memory_limit = 128M"
-#         log_only "display_errors = Off"
-#         log_only "log_errors = On"
-#         log_only "register_globals = Off"
-#         log_only "post_max_size = 30M"
-#         log_only "file_uploads = On"
-#         log_only "upload_max_filesize = 30M"
-#         log_only "max_input_vars = 3000"
-#         log_only "(note max_input_vars setting only exists since php 5.3.9)"
-#      fi
-
-#      log_only "Done configuring PHP"
-
-      log_only "Restarting Apache service"
-      invoke-rc.d apache2 restart >> $LOG 2>&1
+      # PHP Modifications are included in the apache configuration.  If you run lots of CLI scripts that need
+      # configuration you should update the php.ini or CLI interface settings.
 
       if $configure_flag; then
          prompt_input openemr/success_install_config high ret_result
@@ -585,16 +425,18 @@ case "$1" in
       fi
 
       #update config file, change process to complete and remove plan and pass
-      sed -i "s/^[ 	]*process[ 	=].*$/process=complete/" $CONFIG
-      sed -i "/^[ 	]*plan[ 	=].*$/d" $CONFIG
+      if [ -f $CONFIG ]; then
+        sed -i "s/^[ 	]*process[ 	=].*$/process=complete/" $CONFIG
+        sed -i "/^[ 	]*plan[ 	=].*$/d" $CONFIG
+      fi
 
       #stop db
       db_stop
 
       # Can't understand what the /etc/openemr/openemr configuration is asking to do.
-      else
-         unable_exit "Error reading plan variable in configuration file."
-      fi      
+  else
+     unable_exit "Error reading plan variable in configuration file."
+  fi      
    ;;
    abort-upgrade|abort-remove|abort-deconfigure)
    
diff --git a/debian/postrm b/debian/postrm
index d879084..460f1d6 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -xe
 #
 #This program is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
diff --git a/debian/preinst b/debian/preinst
index 9777feb..6ef5371 100644
--- a/debian/preinst
+++ b/debian/preinst
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -xe
 #
 #This program is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
diff --git a/debian/prerm b/debian/prerm
index 50f85bd..5394e1a 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -xe
 #
 #This program is free software; you can redistribute it and/or modify
 #it under the terms of the GNU General Public License as published by
@@ -42,10 +42,9 @@ case "$1" in
       LOG=$LOGDIR/install
       CONFIGDIR=/etc/openemr
       CONFIG=$CONFIGDIR/openemr.conf
-      TMPDIR=`mktemp -d`
       WEB=/usr/share
       OPENEMR=$WEB/openemr
-      SITEDIR=$OPENEMR/sites
+      SITEDIR=/var/lib/openemr/sites
 
       #Standardized echo function to send to only log file
       #  requires one parameter (string)
@@ -167,16 +166,12 @@ case "$1" in
       log_only "Removed OpenEMR etc directory"
 
       #remove rest of web directory
-      rm -rf $OPENEMR
-      log_only "Finished removing OpenEMR web directory"
-
-      #remove tmp directory
-      rm -fr $TMPDIR
-      log_only "Removed OpenEMR tmp directory"
+      # rm -rf $OPENEMR
+      # log_only "Finished removing OpenEMR web directory"
 
       #removes the configuration section for OpenEMR in Apache config file
-      sed -i '/#This is the start of the Apache configuration for OpenEMR./,/#This is the end of the Apache configuration for OpenEMR./d' /etc/apache2/httpd.conf
-      log_only "Removed OpenEMR Apache configuration"
+      # sed -i '/#This is the start of the Apache configuration for OpenEMR./,/#This is the end of the Apache configuration for OpenEMR./d' /etc/apache2/httpd.conf
+      # log_only "Removed OpenEMR Apache configuration"
 
       #stop db
       db_stop
@@ -188,6 +183,15 @@ case "$1" in
 
    deconfigure)
       echo "prerm asked to do deconfigure"
+      CONF="openemr"
+      COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+      if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+          . /usr/share/apache2/apache2-maintscript-helper
+          apache2_invoke disconf $CONF || exit $?
+      elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+          [ ! -L /etc/apache2/conf.d/$CONF.conf ] || rm /etc/apache2/conf.d/$CONF.conf
+      fi
    ;;
 
    failed-upgrade)
diff --git a/debian/rules b/debian/rules
index 9e7ad0a..5f4e753 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,7 @@ DH_OPTIONS := -v
 # a similar manner are welcome.
 
 %:
-	dh $@
+	dh $@ --with apache2
 
 override_dh_link:
 	# Remove the directories that we will symlink into /var/lib
diff --git a/debian/watch b/debian/watch
index a5a0eec..d1fd1b0 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,3 @@
 version=3
-opts="uversionmangle=s/$/+dfsg/ \
-   http://sf.net/openemr/openemr-(\d[\d\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+opts=dversionmangle=s/\+dfsg// \
+    http://sf.net/openemr/openemr-(\d[\d\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/openemr.git



More information about the debian-med-commit mailing list