[linux] Re: Vreemd probleem met rpmbuild

asmuth asmuth op bakunin.xs4all.nl
Di Jan 13 09:29:20 CET 2009


On Mon, Jan 12, 2009 at 11:12:29PM +0100, Hugo van der Kooij wrote:
> 
> asmuth wrote:
> > 
> > Ik heb een vreemd probleem met rpmbuild (tooltje om RPM packages te bouwen)
> > onder RHEL 3.0
> > 
> > In de %files sectie worden enkele files expliciet genoemd die onder de 
> > hoofd installatie directory staan, wat een warning veroorzaakt als je de RPM
> > probeert te bouwen. Nu sluit ik de %install sectie van de SPEC file af met:
> > 
> > : Please disregard messages 'warning: File listed twice'.
> > 
> > Als ik nu de RPM opnieuw bouw verschijnt in de output de regel:
> > + : Please disregard messages 'warning: File listed twice.'
> > 
> > Dat was ongeveer wat ik had beoogd, maar kan iemand me vertellen waarom de
> > punt aan het eind van de zin van plaats is verschoven???
> 
> Laat de spec file eens zien. Het is nu gissen. En ook je rpm macros zijn
>  ook relevant.
> 
Je vroeg er zelf om... Merk op dat dubbele quotes in de SPEC file in de 
output ook enkele aanhalingstekens worden... De regel in kwestie staat 
vlak voor %clean


Daniel

--


Summary: Supporting tools for the Symantec Provisioning Manager
Name: ngp-optools
Version: @@rpm_ver@@
Release: @@rpm_rel@@
Group: Unified Deployment
Vendor: Acision B.V.
License: proprietary
Packager: Acision CCP - Platform Innovation 
Requires: curl >= 7.10.6-4.1, mod_ssl >= 2.0.46-38, ud-opforce, httpd, php
Obsoletes: lcmg-optools, optools
#Synergy: optools.spec %version: 23 % %date_created: Thu Jan  8 16:38:05 2009 %  %created_by: asmuthd %

BuildRoot: /var/tmp
AutoReqProv: no

%ifnos linux
echo "Arch not supported"
exit 1
%endif

%description
Acision Next Generation Platform - Unified Deployment Framework tools
Supporting tools for the Symantec Provisioning Manager

# The rpm command will pass one argument, $1, to pre- and post-scripts, which
# holds a count of the number of versions of the package that are installed.
#
#       +-------------------------------+------------+
#       |Action                         |Count       |
#       +-------------------------------+------------+
#       |Install the first time         |1           |
#       |Upgrade                        |2 or higher |
#       |Remove last version of package |0           |
#       +-------------------------------+------------+
#

%define target %{name}-%{version}-%{release}
# %define javadir /usr/java/j2sdk1.4.2_13
%define installbase /var/www/html
%define installbase2 /opt/veritas/opforce/tomcat/webapps/ROOT

%prep

cd $RPM_BUILD_DIR

# Get sources
mkdir -p ${RPM_BUILD_DIR}/source
cp -rL ${SRCDIR}/* ${RPM_BUILD_DIR}/source
rm -rf ${RPM_BUILD_DIR}/source/packages
rm -rf ${RPM_BUILD_DIR}/source/.project
rm -rf ${RPM_BUILD_DIR}/source/.classpath
rm -rf ${RPM_BUILD_DIR}/source/.settings

%build

cd ${RPM_BUILD_DIR}/source
ant

%install

rm -rf $RPM_BUILD_ROOT/*
cd $RPM_BUILD_ROOT

mkdir -p opt/ngp/optools/scripts
mkdir -p opt/ngp/optools/contrib/copymodels
mkdir -p opt/ngp/optools/lib
mkdir -p opt/ngp/optools/etc
mkdir -p opt/veritas/opforce/tomcat/conf
mkdir -p opt/veritas/opforce/tomcat/webapps/ROOT/WEB-INF
mkdir -p opt/veritas/opforce/tomcat/webapps/ROOT/WEB-INF/lib
mkdir -p opt/veritas/opforce/tomcat/webapps/ROOT/WEB-INF/classes/html
mkdir -p $RPM_BUILD_ROOT%{installbase}

cp $RPM_BUILD_DIR/source/web/index.html $RPM_BUILD_ROOT%{installbase}
cp $RPM_BUILD_DIR/source/web/logo_acision.gif $RPM_BUILD_ROOT%{installbase}

cp $RPM_BUILD_DIR/source/scripts/op_run $RPM_BUILD_ROOT/opt/ngp/optools/scripts/
cp $RPM_BUILD_DIR/source/scripts/ip_plan_tool.sh $RPM_BUILD_ROOT/opt/ngp/optools/scripts/
cp $RPM_BUILD_DIR/source/scripts/mk-nodeinfo $RPM_BUILD_ROOT/opt/ngp/optools/scripts/

cp -r $RPM_BUILD_DIR/source/contrib/* $RPM_BUILD_ROOT/opt/ngp/optools/contrib/
cp -r $RPM_BUILD_DIR/source/lib/* $RPM_BUILD_ROOT/opt/ngp/optools/lib/
cp -r $RPM_BUILD_DIR/source/etc/* $RPM_BUILD_ROOT/opt/ngp/optools/etc/

cp $RPM_BUILD_DIR/source/lib/opwrapper.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/opservlet.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/log4j.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/SNMP4J.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/wildcard.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/poi-2.5.1.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/freemarker.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.
cp $RPM_BUILD_DIR/source/lib/servlet.jar $RPM_BUILD_ROOT%{installbase2}/WEB-INF/lib/.

cp $RPM_BUILD_DIR/source/web/index.jsp $RPM_BUILD_ROOT%{installbase2}/.
cp $RPM_BUILD_DIR/source/web/logo_acision.gif $RPM_BUILD_ROOT%{installbase2}/.
cp $RPM_BUILD_DIR/source/opservlet/html/* $RPM_BUILD_ROOT%{installbase2}/WEB-INF/classes/html/.
cp $RPM_BUILD_DIR/source/opservlet/web.xml $RPM_BUILD_ROOT/opt/veritas/opforce/tomcat/conf/.

cat $RPM_BUILD_ROOT%{installbase}/index.html \
| sed -i "s/\@\@VERSION\@\@/%{target}/" $RPM_BUILD_ROOT%{installbase}/index.html
cat $RPM_BUILD_ROOT%{installbase2}/index.jsp \
| sed -i "s/\@\@VERSION\@\@/%{target}/" $RPM_BUILD_ROOT%{installbase2}/index.jsp
: Please disregard messages "warning: File listed twice".
exit 0


%clean

cd /
rm -rf $RPM_BUILD_DIR
rm -rf $RPM_BUILD_ROOT

%pre
# WARNING: The pre-install script is also executed in case of an upgrade
# IPR051482: Create ngpadmin account with default password (needed by CMA)
if ! grep -q ngpadmin /etc/passwd
then
    if /usr/sbin/useradd -d /home/ngpadmin -s /bin/bash \
            -c "NGP Admin Account" \
            -p `openssl passwd -1 system` ngpadmin
    then
        if ! /usr/sbin/usermod -G ngpadmin,udfile -a admin
        then
            echo "Failed to update admin user account"
        fi
        /usr/sbin/usermod -G udfile -a ngpadmin
        # chgrp --quiet ngpadmin /opt/veritas/opforce/jdk/bin/java
        # chmod g+s /opt/veritas/opforce/jdk/bin/java
    else
        echo "Failed to add ngpadmin user"
    fi
fi


%post

# WARNING: The post-install script is also executed in case of an upgrade
#PR046827: move mount point of Customer Documentation from /opt/logicacmg to /opt/ngp
if [ ! -L /opt/logicacmg/doc ]
then
  if [ -d /opt/logicacmg/doc -a ! -d /opt/ngp/doc ]
  then
    mv /opt/logicacmg/doc /opt/ngp
    ln -s /opt/ngp/doc /opt/logicacmg/doc
  fi
fi

if [ ! -d /opt/ngp/doc ]
then
  mkdir -p /opt/ngp/doc
  chmod 755 /opt/ngp/doc
  chown -R apache:apache /opt/ngp/doc
fi
if [ ! -d /opt/ngp/autofs ]; then mkdir -p /opt/ngp/autofs; fi
if [ ! -L /opt/logicacmg/autofs -a -d /opt/logicacmg/autofs ]
then
  service autofs stop
  sleep 2
  rmdir /opt/logicacmg/autofs
  ln -s /opt/ngp/autofs /opt/logicacmg/autofs
  if grep \/opt\/logicacmg\/autofs /etc/auto.master | grep -vq ^[[:space:]]*\#
  then
    sed -i "s/^[[:space:]]*\/opt\/logicacmg\/autofs/\/opt\/ngp\/autofs/g" /etc/auto.master
  fi
  service autofs start
  sleep 2
fi

if [ -L /var/www/html/doc ]; then rm -f /var/www/html/doc; fi
if [ ! -e /var/www/html/doc ]; then ln -s /opt/ngp/doc /var/www/html/doc; fi

if [ -f /root/.bash_profile ]
then
  if grep -q op_run /root/.bash_profile
  then
    sed -i "s/.*op_run.*/alias op_run=\"\/opt\/ngp\/optools\/scripts\/op_run localhost\"/g" /root/.bash_profile
  else
    echo "alias op_run=\"/opt/ngp/optools/scripts/op_run localhost\"" >> /root/.bash_profile
  fi
fi

# Modification to syslog-configuration.
if [[ ! `grep "/var/log/UD/messages" /etc/syslog.conf | grep news` ]]
then
    echo "# OpTools Logging setup - begin" >> /etc/syslog.conf
    echo "news.*                      /var/log/UD/messages" >> /etc/syslog.conf
    echo "news.crit                   /var/log/UD/critical" >> /etc/syslog.conf
    echo "# OpTools Logging setup - end" >> /etc/syslog.conf
    mkdir -p /var/log/UD
    touch /var/log/UD/messages /var/log/UD/critical
    echo "Syslog-configuration has been modified; Restarting syslog-daemon."
    /etc/init.d/syslog restart
fi


%preun

# Only execute the pre-uninstall on a 'rpm -e' command, so check argument

if [ $1 -ne 0 ]
then
  # called during upgrade, do not execute script
  echo "Uninstalling %{name} version %{version}-%{release}"
  exit
fi

if [ -f /root/.bash_profile ]
then
  sed -i "/.*alias op_run=\"\/opt\/ngp\/optools\/scripts\/op_run localhost\".*/d" /root/.bash_profile
fi
%postun

# Only execute the post-uninstall on a 'rpm -e' command, so check argument

if [ $1 -ne 0 ]
then
  # called during upgrade, do not execute script
  exit
fi

%files
%defattr(-,root,ngpadmin)
/opt/ngp/optools
%defattr(-,root,ngpadmin)
/opt/veritas/opforce/tomcat/

# In the section below already defined (default) attributes are overwritten
# Therefore ignore "warning: File listed twice"

%attr(750,root,ngpadmin) /opt/ngp/optools/scripts/op_run
%attr(700,root,ngpadmin) /opt/ngp/optools/scripts/mk-nodeinfo
%attr(750,root,ngpadmin) /opt/ngp/optools/scripts/ip_plan_tool.sh
%dir %attr(110,root,ngpadmin) /opt/ngp/optools/etc
%config(noreplace) %attr(660,root,ngpadmin) /opt/ngp/optools/etc/optools.ini
%attr(644,apache,apache) /var/www/html/*
%dir %attr(755,apache,apache) /var/www/html



More information about the Linux mailing list