Here are some notes for devinfo rpm developers who wish to build rpms for
installation via the Update System panel.  I have found two areas that need
to be addressed:

1) mysql root password
2) restarting httpd

-------------------
mysql root password
-------------------
I believe ??? the server-manager runs under the admin login environment. 
This appears to mean the server-manager's home directory is set for
/home/e-smith:

# cd ~admin
# pwd
/home/e-smith

Anyone using the Update System panel to install an rpm which creates a
mysql database in the %post section of an rpm will fail.  This I believe is
because the mysql root password is stored in /root/.my.cnf which works fine
when you are logged in as root, but not under the admin login environment.

So to make sure your rpm is able to create a mysql database you need to
retrieve the mysql password and populate your mysql command lines with the
password.

The easiest way that I know of to retrieve the password for usage in a
command line is to read the synchronized password from:
/etc/openldap/ldap.pw.

I picked my build of myphpnuke to both update myphpnuke to 1.8.8 and
incorporate and show the needed changes.  If you install the src rpm and
review the spec file you will see what I mean. Available for download here:

http://myezserver.com/downloads/mitel/beta/myphpnuke-1.8.8/

Here is a snippet of the spec file, with bad line wrapping of course for
review:

%post
pw=`/bin/cat /etc/openldap/ldap.pw`
/bin/echo exit | /usr/bin/mysql --password=$pw myphpnuke  2>&1 &>
/dev/null
if [ "$?" = "1" ] ; then
    /bin/echo "Creating database..."
    /usr/bin/mysqladmin --password=$pw create myphpnuke
    /bin/echo "grant all on myphpnuke.* to myphpnuke@localhost identified
by 'myphp!nuke';" | /usr/bin/mysql --password=$pw
    /usr/bin/mysql --password=$pw myphpnuke <
/opt/groupware/myphpnuke/html/sql/myphpnuke.sql
    /usr/bin/mysqladmin --password=$pw reload
fi
/sbin/e-smith/db accounts set mpn reserved
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/etc/e-smith/events/actions/restart-httpd-graceful

%preun

%postun
/sbin/e-smith/db accounts delete mpn
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/etc/e-smith/events/actions/restart-httpd-graceful

Also, this spec file shows that if you need to restart httpd this should be
performed using the restart-httpd-graceful action and not
/etc/rc.d/init.d/httpd restart.  The later will cause the server-manager
Update System panel to be unable to display the log file.  This is a minor
as the rpm will be fully installed however using the graceful restart keeps
httpd fully functional and enables the log file to be displayed.

I do welcome comments from anyone that has taken the time to install and
work with the Update System panel.

This is simply my findings and solution that I chosen to implement.  I feel
that the above changes are more absolute anyhow.  This creates an rpm that
will work from the command-line and the Update System panel both.

Again, if you've worked with the Update System panel and know of a better
solution, please share :-)

Regards,

-- 
Darrell May
DMC Netsourced.com
http://netsourced.com
http://myEZserver.com


--
Please report bugs to [EMAIL PROTECTED]
Please mail [EMAIL PROTECTED] (only) to discuss security issues
Support for registered customers and partners to [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org

Reply via email to