On Tue Jan 23, 2001 at 02:47:01PM -0600, Paul Cox wrote:
> > I'm having some difficulty figuring this one out. I'm trying to fix
> > the php upgrade scripts because currently if you upgrade php, it
> > removes php support from httpd.conf and comments all of the installed
> > modules in /etc/php.ini.
>
> Yeah... it's very annoying. :)
Tell me about it.
> > %post imap
> > ...
> > $perl -pi -e 's|^;extension=imap.so|extension=imap.so|g' %{_sysconfdir/php.ini
> >
> > %preun imap
> > ...
> > if [ -f %{_sysconfdir}/php.ini ]; then
> > $perl -pi -e 's|^extension=imap.so|;extension=imap.so|g' %{_sysconfdir/php.ini
> > fi
>
> Ok... first question... why change it to begin with? As it was, when
> you did an "ungrade" the %preun of the old package whould have commented
> it out, and then the %post of the new package would've plugged it back
> in. That would've worked just peachy.
Well, it has to be changed because it didn't work. If it worked,
trust me, I would leave it well enough alone... =) Unfortunately, I
don't know how it works... maybe it does the %{pre,post} of the new
package before it does the %{pre,post}un of the old package. Doesn't
make much sense, but that's the only way I can see why it doesn't
work.
> > So I changed it to look like this:
> >
> > %post imap
> > ...
> > if [ $1 = "1" ]; then
> > $perl -pi -e 's|^;extension=imap.so|extension=imap.so|g' %{_sysconfdir/php.ini
> > fi
> >
> > %preun imap
> > ...
> > if [ $1 = "0" ]; then
> > if [ -f %{_sysconfdir}/php.ini ]; then
> > $perl -pi -e 's|^extension=imap.so|;extension=imap.so|g' %{_sysconfdir/php.ini
> > fi
> > fi
> >
> > I'm going by the assumption that in the %post/pre{un} scripts, the
> > value of $1 is 0 during an uninstall, 1 during an install, and 2
> > during an upgrade. Is this accurate? I use this same logic in other
> > rpms and it works fine.
>
> I don't personally know about the 0,1,2 thing, but if that's true, then
> your answer is easy: you don't have a $1="2"...
No... because during an upgrade I want it to do nothing. The logic
here is this:
If this is a new install, then modify php.ini, uncomment the module,
and modify httpd.conf and insert the Include directive. (Thus the
$1=1).
If this is a removal, modify php.ini, comment the module we're
removing, modify httpd.conf and remove the Include directive (thus the
$1=0).
If this is an upgrade, do not modify anything. This makes the
assumption that if you upgrade php-mysql, mysql.so is already
uncommented in php.ini, so why touch it? If php-mysql doesn't exist
and you are doing a -Uvh, the install script (yes, this is an install,
uncomment it), runs. I don't want the scripts to do a thing if this
is an upgrade because an upgrade implies a previous installation where
everything was already setup.
> That's how I fixed mine... I actually did an uninstall with 'rpm -e' (so
> the $1="0" stuff ran), and then I installed them with 'rpm -i' (so the
> $1="1" stuff ran). I guess you didn't list a $1="2", it doesn't bother
> to do anything, but everything was already commented out from the older
> packages. Make sense? :)
>
> Al least that's what I think.
No, doesn't make sense. Because there is no $1=2, it should have done
absolutely nothing. When you did the rpm -e, it commented
everything... when you did the rpm -i, it uncommented everything. The
problem was during the upgrade it uncommented everything. I need it
to do an upgrade and leave everything that is being upgraded
uncommented. If I put a $1=2, it would do absolutely nothing because
I don't want anything done.
Hope that makes some more sense as to what I'm trying to do... =)
--
[EMAIL PROTECTED], OpenPGP key available on www.keyserver.net
1024D/FE6F2AFD 88D8 0D23 8D4B 3407 5BD7 66F9 2043 D0E5 FE6F 2AFD
- Danen Consulting Services www.danen.net, www.freezer-burn.org
- MandrakeSoft, Inc. Security www.linux-mandrake.com
Current Linux uptime: 4 days 9 hours 18 minutes.