1
Hi Folks,
Out of necesity I have started to package XOOPS in a debian .deb package. As I am new to xoops, I don't really know what to expect wrt to upgrading XOOPS without intervention. I have not started from scratch but used the source from Erick Castellanos' package for XOOPS 2.0.9.2-3 and tried updating it to 2.2.3afinal.
Before you rush out and direct to the manual update procedure for windows user deploying on hosting service: hold your horses, this is more comparable to a local installation on a linux distro(in fact it is how it should be done, installing from a tar.gz file is bad)
If you do not know how package management(apt-get, yum) works, here is a quick lineout:
(if you are familiar with it, skip down two paragraphs)
A package only contains its own software. If it needs other software or libraries those dependencies are mentioned in a special file in the package. The package will not install before those dependencies are fullfilled. To make sure all needed software gets installed when you want a certain package, you use apt-get (or yum) that knows what software is available for install and can (try to) solve the dependencies of a package.
So what happens when you install a .deb package?(or .rpm on other distro's): the package manager will fist make sure all dependencies are met. next it will run any scripts that come with the package that need to be run before installing. Then it will unpack all the files to their destination. the last step is to run the post-installation script. Every script can ask the user to answer certain questions (only on debian), like what should the password for the new database be, but those questions should be kept to the absolute minimum. On redhat no questions can be asked, so that upgrades can be scheduled without needing root's attention. similar script are run when the package is removed or purged from the system.
When you don't install a new package, but upgrade to a newer version, the old version is passed on to the package, so the scripts can do the right thing with upgrading.
So most things that need to be done during a manual installation of XOOPS or that are done by the 'installer' can be done from the scripts that come with the package, but the requirement is that these should be complete. A package that needs the user to go call a certain upgrade script or XOOPS won't work correctly, is considered broken.
All that introduction was to ask you the following question: what do you think the post-install script of the package needs to do in case of a new install and in case of a upgrade from a specified (but unknown when building the package) version?
Here is what I have so far (most of it was already written by Erick Castellanos who wrote the previous package)
in case of a new install:
# Get the info (name, email, password) for the XOOPS admin.
# Create the XOOPS databse with the name 'xoops' with user 'xoops' and a random password.
# load the structure of the db
# load some initial data in the db
# write the random password in mainfile.php
# set the permission of mainfile.php to read-only.
# create & set the owner to the apache user for uploads, cache and template_c.
# link the apache configuration script into the apache conf.d dir and restart apache.
esac
But for the case of an upgrade I don't have any code yet. what should be done in that case? All the code from the full download is included in the package, but is that enough or do I need stuff from the 'upgrade' downloads too? I had a quick look at an upgrade php script I could find, but I noticed that it required a valid an authorized login. Is there a way around that? Does it cover all possible upgrade cases?9ok that is a moot point, few other XOOPS debian packages have been made) It should be possible in theory, as the postinst script gets run with root permission.
Any suggestions?