1

Topic: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

This is more of a simple request, could you add a command line argument so that if I run the command as such:

bash upgrade_iredadmin.sh /opt

or

bash upgrade_iredadmin.sh /opt/iredadmin

(the variable saved in this reference should still be `/opt`)
it'll use /opt/iredadmin instead of /usr/share/apache/iredadmin [Ubuntu]
Its a trivial few lines of code for you that save your users having to edit the update script if they have moved the location of iredadmin, if you'd like me to write some code to save you having to do this then just let me know.

Thanks,
Michael

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

Update, something like this:

if [ $# -gt 0 ]; then
    if [ -d ${1%/iredadmin} ]; then
        export HTTPD_SERVERROOT=${1%/iredadmin}
    fi
fi

##Your current existing code as a marker, has to be added before this obviously##
# iRedAdmin directory and config file.
export IRA_ROOT_DIR="${HTTPD_SERVERROOT}/iredadmin"
export IRA_CONF_PY="${IRA_ROOT_DIR}/settings.py"
export IRA_CONF_INI="${IRA_ROOT_DIR}/settings.ini"

3

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

I wonder why we need this additional argument?

upgrade_iredadmin.sh detects which Linux/BSD distribution you're running, and find correct directory for you. Does it work for you?

4

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

I removed /usr/share/apache2 as hated having it while not having apache2 installed so I moved it into the same directory as iRedApd, /opt/ and it works fine there, except the update script obviously. I doubt I'm the only one who has iRedAdmin in the non-default location, if you do not want to do this then I'll drop a symlink /usr/share/apache2/iredadmin => /opt/ireadmin

5

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

I think you're right. maybe we should move iRedAdmin to /opt since we have plan to drop Apache support in the future, no reason to place files under /usr/share/apache2/.

I merged your patch with a fix to set correct HTTPD_SERVERROOT (no '/iredadmin'):

diff -r c5e12596d3ea tools/upgrade_iredadmin.sh
--- a/tools/upgrade_iredadmin.sh    Tue Feb 10 23:52:31 2015 +0800
+++ b/tools/upgrade_iredadmin.sh    Fri Feb 13 00:46:12 2015 +0800
@@ -62,7 +62,15 @@
     exit 255
 fi
 
+# Optional argument to set the directory which stores iRedAdmin.
+if [ $# -gt 0 ]; then
+    if [ -d ${1} ]; then
+        export HTTPD_SERVERROOT="${1}"
+    fi
+fi
+
 echo "* Detected Linux/BSD distribution: ${DISTRO}"
+echo "* HTTP server root: ${HTTPD_SERVERROOT}"
 
 restart_web_service()
 {

6

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

Great, thanks

7

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

UPDATE patch to make sure no '/iredadmin' in directory name:

diff -r c5e12596d3ea tools/upgrade_iredadmin.sh
--- a/tools/upgrade_iredadmin.sh    Tue Feb 10 23:52:31 2015 +0800
+++ b/tools/upgrade_iredadmin.sh    Fri Feb 13 00:57:50 2015 +0800
@@ -62,7 +62,19 @@
     exit 255
 fi
 
+# Optional argument to set the directory which stores iRedAdmin.
+if [ $# -gt 0 ]; then
+    if [ -d ${1} ]; then
+        export HTTPD_SERVERROOT="${1}"
+    fi
+
+    if echo ${HTTPD_SERVERROOT} | grep '/iredadmin$' > /dev/null; then
+        export HTTPD_SERVERROOT="$(dirname ${HTTPD_SERVERROOT})"
+    fi
+fi
+
 echo "* Detected Linux/BSD distribution: ${DISTRO}"
+echo "* HTTP server root: ${HTTPD_SERVERROOT}"
 
 restart_web_service()
 {

8

Re: `upgrade_iredadmin.sh` + Custom iRedAdmin Location = File Editing

the %/iredadmin did the same thing tongue