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.
9 # authors: Brady Miller <brady.g.miller@gmail.com>
10 # Amalu Obinna <amaluobinna@aol.com>
12 # Debian package pre-installation script steps:
13 # 1) Create log dir/file
14 # 2) Ensure git-OpenEMR web directory was not previously installed.
15 # 3) Create config dir/file
17 # Upgrading is not an option here, since this is for testing/evaluation
18 # of the most current unstable development version of OpenEMR.
21 # /var/log/git-openemr/install
24 # summary of how this script can be called:
25 # * <new-preinst> `install'
26 # * <new-preinst> `install' <old-version>
27 # * <new-preinst> `upgrade' <old-version>
28 # * <old-preinst> `abort-upgrade' <new-version>
29 # for details, see http://www.debian.org/doc/debian-policy/ or
30 # the debian-policy package
32 # Source debconf library.
33 .
/usr
/share
/debconf
/confmodule
36 LOGDIR
=/var
/log
/git-openemr
38 CONFIGDIR
=/etc
/git-openemr
39 CONFIG
=$CONFIGDIR/git-openemr.conf
41 OPENEMR
=$WEB/git-openemr
42 SITEDIR
=$OPENEMR/sites
/default
43 INSTALL_USER
=gitopenemr
44 INSTALL_DATABASE
=gitopenemr
46 #Standardized echo function to send to only log file
47 # requires one parameter (string)
49 echo "`date`: $1" >> $LOG
52 #Standardized exit function to be used when unable to install the openemr package
53 # requires one parameter (string with reason for exiting)
55 echo "`date`: $1" >> $LOG
56 echo "`date`: EXITING.........." >> $LOG
60 #function to prompt for input
61 # 1st param is name, 2nd param is priority, 3rd param is where result gets sent back in
65 db_fset
"$1" seen false
66 db_input
"$2" "$1" || true
69 local input_value
="$RET"
71 db_fset
"$1" seen false
73 eval $__result="'$input_value'"
79 #create the log file directory
82 #Check for /var/www/git-openemr, if exist then exit
83 if [ -d "$OPENEMR" ]; then
84 prompt_input git-openemr
/www_path_already_exists critical ret_result
85 unable_exit
"OpenEMR is already installed ($OPENEMR), so can not install the OpenEMR Package."
88 #Begin the config file string
89 # this is so the postinst script can follow installation
91 # process states whether installation is pending or complete
93 # pass temporarily holds the mysql root password
94 SETTING
="#Optional settings\n\
95 #(currently empty, plan to use in subsequent versions if needed)\n\
97 #Installation settings\n\
98 # (DO NOT EDIT below!!!)\n\
102 #ready to install package, so create the config directory and files
104 echo -e $SETTING > $CONFIG
111 #upgrade is not available with the git-openemr package
113 log_only
"Upgrading is not available with the git-openemr package"
114 log_only
"This package is for testing most recent development (unstable) OpenEMR version"
115 prompt_input git-openemr
/upgrade_not_supported critical ret_result
116 unable_exit
"To upgrade to most recent development version, recommend removing/reinstalling package"
120 echo "preinst asked to do abort-upgrade"
125 echo "preinst called with unknown argument \`$1'" >&2