PDA

View Full Version : Upgrade causes the removal of /root/ispconfig due to compile failure


lawrenceong
18th April 2007, 13:46
Recently, i upgraded my Debian version from Sarge to Etch. As i was trying to upgrade the isp_config version from ISPConfig-2.2.11.tar.gz to ISPConfig-2.2.12.tar.gz, it basically removed everything in /root/ispconfig and .. nothing else, all due to a compilation failure.

The compilation error happened because the system was missing a new -dev package for mysql. Even though it is a compilation failure, it would be better if it did not remove /root/ispconfig and the install_ispconfig directory. This is equivalent to running rm -rf /root/ispconfig without a backup! :eek:

So how did this happen?

The setup2 script contains the following snippet of code:

if [ "$install_art" == "upgrade" ]; then
cp -f /home/admispconfig/ispconfig/lib/config.inc.php ./
caselog "saved /home/admispconfig/ispconfig/lib/config.inc.php" "could not save /home/admispconfig/ispconfig/lib/config.inc.php"
cp -f /home/admispconfig/ispconfig/users ./
caselog "saved /home/admispconfig/ispconfig/users" "could not save /home/admispconfig/ispconfig/users"
cp -f /home/admispconfig/ispconfig/adminmail.txt ./
caselog "saved /home/admispconfig/ispconfig/adminmail.txt" "could not save /home/admispconfig/ispconfig/adminmail.txt"

tar -pczf root_ispconfig.tar.gz /root/ispconfig/ &> /dev/null
chmod 600 root_ispconfig.tar.gz &> /dev/null
caselog "created backup of directory /root/ispconfig/" "could not create backup of directory /root/ispconfig/"
tar -pczf home_admispconfig.tar.gz /home/admispconfig/ &> /dev/null
chmod 600 home_admispconfig.tar.gz &> /dev/null
caselog "created backup of directory /home/admispconfig/" "could not create backup of directory /home/admispconfig/"

rm -fr /root/ispconfig
caselog "deleted directory /root/ispconfig/" "could not delete directory /root/ispconfig/"
fi

cd compile_aps/
chmod 700 compile
./compile || (cd `pwd`/../.. && rm -fr install_ispconfig && exit 1)
cd ..


The text highlighted in red basically says:


If you do an upgrade, i would backup your /root/ispconfig to the current directory (usually where you run setup from (aka: the install_ispconfig directory)) and then remove the /root/ispconfig directory

On compile failure, remove the install_ispconfig directory

Well, the problem here is that if there is a compile failure, the /root/ispconfig directory and the backup file are both removed.... leaving you with a system with a broken ispconfig :)

Can we please have the feature where a compile failure does not rm -rf /root/ispconfig on upgrade?

Thanks,
Lawrence

till
18th April 2007, 14:37
The directory must be removed, otherwise the next installation or update attempt will fail.

Your problem is easily solved, run:

mkdir /root/ispconfig

and then unpack and run the setup script again. By the way, the backup of /root/ispconfig is not removed, it is in your /tmp directory.

lawrenceong
18th April 2007, 16:29
The directory must be removed, otherwise the next installation or update attempt will fail.

Your problem is easily solved, run:

mkdir /root/ispconfig

and then unpack and run the setup script again.

I will try this out.

By the way, the backup of /root/ispconfig is not removed, it is in your /tmp directory.

I've checked /tmp and it's not there. This is the reason why. Check out the setup2 script.

Line 840 removed the install_ispconfig directory, before a copy of the backup was made to /tmp by install.php. This means there's nothing in /tmp.

840 ./compile || (cd `pwd`/../.. && rm -fr install_ispconfig && exit 1)

install.php runs at line 876, so it never made that backup to /tmp.

876 chmod 700 ./install.php

Excerpt from install.php

caselog("mv -f root_ispconfig.tar.gz /tmp/root_ispconfig_".date("m_d_Y__H_i_s", $

lawrenceong
24th April 2007, 14:25
Creating the directory /root/ispconfig will make the setup think that it is an upgrade and not touch any of your configuration files.

However, you would have lost all the custom configuration that you placed in the /root/ispconfig/isp/conf directory.