Hi all,
I need to create a rpm to install a couple of init scripts. I have my
spec file working and my services start correctly (almost).
My problem is in creating a soft link.
Motivation: The link target is an executable whose name seems to be too
long to be a service. I cannot change this name. When starting the
service the OS truncates the name causing failure. To correct this, I
create a link with a shorter name.
Problem details: The path to the link varies on different installation
machines. It may be determined by an env var. When I create the rpm
using the spec file, the env var gets substituted then. I need them
to be substituted when the rpm is installed.
Is there a way to accomplish this?
Thanks,
-d
My spec file:
#
# Spec file for HDS services RPM
#
Summary: HDS applications installed as services.
Name: hds_services
Version: 0.1
Release: 1
License: Scientific Solutions, Inc.
Group: System Environment/Daemons
Source: hds_services_0.1.tar.gz
URL: http://scisol.com
Distribution: HDS Linux
Vendor: Scientific Solutions, Inc.
Packager: David Ohlemacher <dohlemacher@scisol.com>
%description
blah blah...
%prep
HDS_SERV_TAR_FILE=hds_services_0.1.tar.gz
rm -rf /hdsServices/
tar xvfz /
%build
# There is nothing to build.
%install
topDir=hdsServices
cp -f //init.d/* /etc/rc.d/init.d
cp -f //ld.so.conf.d/* /etc/ld.so.conf.d
echo "installing TENA scripts in /" >&2
cp -f //tenaScripts/run_nns.sh
//scripts
cp -f //tenaScripts/run_em.sh
//scripts
chmod 744 /etc/rc.d/init.d/hdsNetNameServ
chmod 744 /etc/rc.d/init.d/hdsExecManServ
chmod 644 //scripts/run_nns.sh
chmod 644 //scripts/run_em.sh
# Configure dynamic linker run time bindings
ldconfig
# The initscripts fail with excessively long app names (truncated). We
create short links to allow them to work.
ln -f -s
//bin//networkNamingService
//bin//hds_nns
ln -f -s //bin//executionManager
//bin//hds_em
# Configure the services to start at the desired runlevel(s).
chkconfig --level 3 hdsNetNameServ on
chkconfig --level 3 hdsExecManServ on
%files
%config %attr(644, root, root) /etc/rc.d/init.d/hdsServiceConfiguration
%attr(744, root, root) /etc/rc.d/init.d/hdsExecManServ
%attr(744, root, root) /etc/rc.d/init.d/hdsNetNameServ
%attr(744, root, root) /etc/ld.so.conf.d/hds.conf
%attr(644, ops, ops) /home/ops/TENA/5.2.1/scripts/run_nns.sh
%attr(644, ops, ops) /home/ops/TENA/5.2.1/scripts/run_em.sh
%post
ldconfig
# The initscripts fail with excessively long app names (truncated). We
create links to allow them to work.
ln -f -s
//bin//networkNamingService
//bin//hds_nns
ln -f -s //bin//executionManager
//bin//hds_em
# Configure the services to start at the desired runlevel(s).
chkconfig --level 3 hdsNetNameServ on
chkconfig --level 3 hdsExecManServ on
%preun
if [ "" = "0" ] ; then # last uninstall
/sbin/service hdsNetNameServ stop
/sbin/service hdsNetNameServ stop
/sbin/chkconfig --del hdsNetNameServ
/sbin/chkconfig --del hdsExecManServ
#rm -f /etc/rc.d/init.d/hdsServiceConfiguration
#rm -f /etc/rc.d/init.d/hdsExecManServ
#rm -f /etc/rc.d/init.d/hdsNetNameServ
#rm -f /etc/ld.so.conf.d/hds.conf
#rm -f //scripts/run_nns.sh
#rm -f //scripts/run_em.sh
#rm -f //bin//hds_nns
#rm -f //bin//hds_em
fi
%verifyscript
# The script sends info and error messages to stdout, and error
messages only to stderr. Normally RPM will only display stderr from a
verification script; the output sent to stdout is only displayed when
the verification is run in verbose mode.
p=/etc/rc.d/init.d/
for n in hdsServiceConfiguration hdsExecManServ hdsNetNameServ; do
echo -n "Looking for in ... "
if ! ls | grep "^$" > /dev/null; then
echo "missing"
echo " missing from " >&2
else
echo "found"
fi
done
p=/etc/ld.so.conf.d/
for n in hds.conf; do
echo -n "Looking for in ... "
if ! ls | grep "^$" > /dev/null; then
echo "missing"
echo " missing from " >&2
else
echo "found"
fi
done
p=//scripts/
for n in run_nns.sh run_em.sh; do
echo -n "Looking for in ... "
if ! ls | grep "^$" > /dev/null; then
echo "missing"
echo " missing from " >&2
else
echo "found"
fi
done
p=//bin//
for n in hds_nns hds_em; do
echo -n "Looking for in ... "
if ! ls | grep "^$" > /dev/null; then
echo "missing"
echo " missing from " >&2
else
echo "found"
fi
done
--
That which is common to the greatest number has the least care bestowed upon it.
Aristotle
Received on Tue Dec 11 18:33:00 2007