> but I need to know which files
> from SAPDB do I need to install on the target machine to make my
> application work or do I need to have the whole installtion done on
> the target machine as well.

No you don't. However, finding out what you need is not that easy. I can 
only tell it to you from the Linux side, because I made 
stripped-down-RPMs from SAPDB. You can look at the filenames / paths as 
a helper.

However, I don't have any experience with SAP DB on NT.


In the attachment you'll find my RPM specification file. The end of the 
file is more interesting to you.

-- 
MN-Logistik GmbH         http://www.mn-logistik.de
Holger Schurig           Network Administrator
Dieselstr. 18
61191 Rosbach v.d.H�he
Tel: 06003/9141-0        Fax: 06003/9141-49
Name: sapdb
Version: 7.3.0.23
Release: 1
Summary: SAP DB relational database
License: GPL/LGPL
Group: Application/Database
#Requires: els-sapdb

#
# Ok, let's face it: some of the SAP DB binary RPMs are huge. And
# extracting them and making new RPMs really is a hard disk speed
# test. So, while developing this SPEC file I kept most sections
# to "no" to save time.
#
# The perl part of this spec is not yet tested. It may not work.
# The webagent part does NOT work, mod_fastcgi.so crashes.
#
%define SERVER yes
%define XLOAD yes
%define ODBC yes
%define DEVEL yes
%define OLDRUNTIMES yes
%define PERL nottested
%define PYTHON15 no
%define PYTHON21 yes
%define PYTHON22 no

#
# I could have written
#
#Source1: 
ftp://ftp.sap.com/pub/sapdb/bin/linux/sapdb-server-linux-32bit-i386-7_3_0_23.tgz
#Source2: 
ftp://ftp.sap.com/pub/sapdb/bin/linux/sapdb-python-linux-i386-7.3.00.23test.tgz
#
# here ... but that would have made the source RPM quite bit (about 45 Megabytes!)
# So I have just two defines here and you need to get the mentioned files from
# ftp.sap.com by yourself. This reduced the source RPM to 20 kilobyte.
#
%define SAPDB_SOURCE sapdb-server-linux-32bit-i386-7_3_0_23.tgz
%define PYT21_SOURCE sapdb-python-linux-i386-7.3.0.23test.tgz
%define REPM_SOURCE  sapdb-repman-linux-32bit-i386-7.3.1.2.tgz

# Template to be added to /etc/odbcinst.ini at sapdb-odbc installation time
Source20: sapdb-odbcinst.ini
# Pre-compiled binary --- Mandrake still comes with unixODBC 2.0.8 which doesn't
# (yet) include this file. The source for this file is included in newer versions
# of unixodbc.
Source21: libodbcsapdbS.so


%description
SAP DB is a 24x7 hours capable relational database. It comes with
triggers, foreign keys, transaction and basically everything one want
to have from a database.

%if "%{SERVER}" == "yes"
%package server
Summary: SAP DB database server
Group: Application/Database
Requires: sapdb
%if "%{XLOAD}" != "yes"
Requires: sapdb-python15
%endif
%description server
This is the database server for SAP DB.
%endif

%if "%{ODBC}" == "yes"
%package odbc
Summary: SAP DB call interface for ODBC
Group: Application/Database
Requires: sapdb
#Requires: unixODBC >= 2.0.4  (no strict requirement, one can link directly)
%description odbc
This is the odbc library for SAP DB. It can be used with unixODBC --- or
any application can link directly to SAP DB's libsqlod.so instead of to
libodbc.so from UnixODBC.
%endif

%if "%{DEVEL}" == "yes"
%package devel
Summary: various development stuff for SAP DB
Group: Application/Database
Requires: sapdb
%description devel
In this RPM you will find SAP DB's precompiler as well as header files
for ODBC.
%endif

%if "%{PYTHON15}" == "yes"
%package python15
Summary: Python 1.5 support for SAP DB
Group: Application/Database
Requires: sapdb
%description python15
This are support modules for Python 1.5
%endif

%if "%{PYTHON21}" == "yes"
%package python21
Summary: Python 2.1 support for SAP DB
Group: Application/Database
Requires: sapdb
%description python21
This are support modules for Python 2.1
%endif

%if "%{PYTHON22}" == "yes"
%package python22
Summary: Python 2.2 support for SAP DB
Group: Application/Database
Requires: sapdb
%description python22
This are support modules for Python 2.2
%endif

%if "%{OLDRUNTIMES}" == "yes"
%package oldruntimes
Summary: runtimes for older SAP DB versions
Group: Application/Database
Requires: sapdb
%description oldruntimes
This RPM just contains runtimes. Use this if you need to connect to
database servers running older versions of SAP DB.
%endif

%prep
umask 0
rm -rf /var/spool/sql /var/sapdb /usr/sapdb

mkdir -p /{usr,var}/sapdb
test -d /usr/spool || ln -s /var/spool /usr/spool
cd /var/tmp
tar xvzf $RPM_SOURCE_DIR/%{SAPDB_SOURCE}

# Check if user/group sapdb exists
fname=/var/tmp/test.$$
touch $fname
chgrp sapdb $fname 2>/dev/null || groupadd -r sapdb
chown sapdb $fname 2>/dev/null || useradd  -r -g sapdb -m sapdb
rm -f $fname

# Install everything
./SDBINST \
        -b \
        -I /var/sapdb \
        -i /usr/sapdb \
        -d /usr/sapdb/dep \
        -o sapdb \
        -g sapdb
cd /usr/sapdb

#
# We don't need a differentiation between independent and dependent binaries
#
for i in bin etc pgm wrk ; do
  mv -f dep/$i/* $i
done
mv dep/{env,incl,lib,misc,sap} .
mv dep/runtime/7300/lib/* runtime/7300/lib/
mv dep/runtime/jar runtime
rm -rf dep
# Adjust wrong paths
perl -pi -e 's:/usr/sapdb/dep:/usr/sapdb:g' /var/spool/sql/ini/* 
/usr/sapdb/misc/create_demo_db.sh
bin/xregcomp -c /usr/sapdb/lib/dbpinstall

%if "%PYTHON21" == "yes"
tar xvzf $RPM_SOURCE_DIR/%{PYT21_SOURCE}
mv -f python21/*.so misc
%endif

%if "%PYTHON22" == "yes"
tar xvzf $RPM_SOURCE_DIR/%{PYT21_SOURCE}
mv -f python22/*.so misc
%endif

# Install REPMSERV-Update
cd /usr/sapdb/bin
tar xvzf $RPM_SOURCE_DIR/%{REPM_SOURCE}
mv lserversrv ../pgm
cd -

# There is no /usr/spool on Linux
perl -pi -e 's:/usr/spool:/var/spool:g' bin/* lib/* misc/* pgm/* runtime/*/lib/*.so 
sap/*

# We don't execute include files :-)
chmod -x incl/*

# We don't install all old runtimes
perl -pi -e 's:^.*=7.2.5.0,\n::s; s:^.*=7.3.0.0,\n::s' 
/var/spool/sql/ini/SAP_DBTech.ini

# Housecleaning
cd /var/tmp
rm -f INSAPDB SAPDBDEP.TGZ SAPDBIND.TGZ SDBINST

%if "%{SERVER}" == "yes"
# Make some symlinks in order to keep data and programs aport, but the
# database still running.
ln -s /usr/sapdb/bin /var/sapdb/bin
ln -s /usr/sapdb/pgm /var/sapdb/pgm
ln -s /usr/sapdb/env /var/sapdb/env
ln -s /usr/sapdb/lib /var/sapdb/lib
ln -s /var/sapdb/config/Registry1.dcom /var/sapdb/wrk/Registry.dcom
%endif

%if "%{ODBC}" == "yes"
cp $RPM_SOURCE_DIR/sapdb-odbcinst.ini /usr/sapdb/misc/odbcinst.ini
cp $RPM_SOURCE_DIR/libodbcsapdbS.so /usr/sapdb/lib
%endif


%build
%if "%{ODBC}" == "yes"
# Here we make the ODBC thingy access /etc/odbc.ini. The from and to strings
# in the substitute operation must be of exactly the same length. Isn't it
# nice that the swiss army knife "Perl" can even edit binary files?
perl -pi -e 's:/var/spool/sql/config:/etc/\0pool/sql/config:g' 
/usr/sapdb/lib/libsqlod.*
%endif


%install
# Trick to make brp-strip-mandrake work
export RPM_BUILD_ROOT=/usr/sapdb


%pre
# Check if user/group sapdb exists
fname=/var/tmp/test.$$
touch $fname
chgrp sapdb $fname || groupadd -r sapdb
chown sapdb $fname || useradd  -r -g sapdb -m sapdb
rm -f $fname


%post
# Add TCP/IP service names
grep -q ^sql30 /etc/services || echo "sql30           7200/tcp" >>/etc/services
grep -q ^sql6  /etc/services || echo "sql6            7210/tcp" >>/etc/services
# Some #@!$/( SAP DB binaries access /usr/spool instead of /var/spool
test -d /usr/spool || test -L /usr/spool || ln -s /var/spool /usr/spool
#chkconfig --add vserver
grep -q /usr/sapdb/lib /etc/ld.so.conf || {
   echo /usr/sapdb/lib >>/etc/ld.so.conf
   echo /usr/sapdb/misc >>/etc/ld.so.conf
   ldconfig
}


%preun
# This ensures that rpm -e works without error messages
if [ "$1" = 0 ]; then
  #chkconfig --del vserver
  grep -v /usr/sapdb /etc/ld.so.conf >/etc/ld.so.conf.tmp
  mv /etc/ld.so.conf.tmp /etc/ld.so.conf
  ldconfig
  rm -rf /var/sapdb/wrk/*
fi


%postun
# get rid of /usr/spool symlink
test -L /usr/spool && rm /usr/spool


%if "%{SERVER}" == "yes"
%post server
#chkconfig --add sapdb

%preun server
if [ "$1" = 0 ]; then
  #chkconfig --del sapdb
  # This ensures that 'rpm -e' works without error messages
  find /var/sapdb/wrk -! -name wrk -a -type d | xargs rm -rf
  rm -rf /var/spool/sql/{dbspeed,pid,ppid,diag,fifo,ipc}
  rm -f /var/sapdb/config/[A-Z]*
fi
%endif


%if "%{ODBC}" == "yes"
%post odbc
if [ "$1" = 1 ]; then
    # odbcinst comes with unixODBC
    test -x /usr/bin/odbcinst && odbcinst -i -d -f /usr/sapdb/misc/odbcinst.ini 
>/dev/null
fi

%preun odbc
if [ "$1" = 0 ]; then
    test -x /usr/bin/odbcinst && odbcinst -u -d -n SAPDB >/dev/null
fi
%endif


%clean
rm -rf /{usr,var}/sapdb /var/spool/sql /usr/spool /var/tmp/rpm* /usr/include/sapdb


%files
%dir %attr(0755,root,root) /usr/sapdb
%dir %attr(0755,root,root) /usr/sapdb/bin
%attr(0755,root,root) /usr/sapdb/bin/dbmcli
%attr(0755,root,root) /usr/sapdb/bin/repmcli
%attr(0755,root,root) /usr/sapdb/bin/x_server
#
# Shudder. A user-writable (ok, group-writable) directory that contains
# binary and is very likely in the path of other users. So anybody in the
# the group "sapdb" can create arbitrary binaries here. And it happens that
# the SAPDB server are running under group id "sapdb".  So I'm just waiting
# until some script kiddy writes some code that utilizes an array overflow
# to break into a SAP DB system. SECURITY RISK, boys!  Unfortunately SAPDB
# won't work without this directory being writable...
#
%attr(0755,root,root) %dir /usr/sapdb/pgm
%attr(0755,root,root) /usr/sapdb/pgm/sysrc
%attr(0755,root,root) /usr/sapdb/pgm/vserver
%dir %attr(0755,root,root) /usr/sapdb/env
/usr/sapdb/env/general.use
/usr/sapdb/env/vserver.use
%dir /usr/sapdb/env/en
/usr/sapdb/env/en/DBM.en
/usr/sapdb/env/en/SQLM.en
/usr/sapdb/env/en/SQLMESS.en
%dir /usr/sapdb/lib
%dir /usr/sapdb/misc
%dir /usr/sapdb/incl
%dir /var/spool/sql
%dir /var/spool/sql/ini
/var/spool/sql/ini/SAP_DBTech.ini
%dir /var/sapdb
%dir /var/sapdb/wrk
%dir /usr/sapdb/runtime
/usr/sapdb/runtime/7301

%if "%{SERVER}" == "yes"
%files server
#/usr/sapdb/bin/xregcomp
#/usr/sapdb/env/regcomp.use
/usr/sapdb/lib/liboms.so
/usr/sapdb/lib/dbpinstall.so
%attr(0750,root,sapdb) /usr/sapdb/pgm/clr_kernel
%attr(0750,root,sapdb) /usr/sapdb/pgm/dbmsrv
%attr(4750,root,sapdb) /usr/sapdb/pgm/lserver
%attr(0750,root,sapdb) /usr/sapdb/pgm/lserversrv
%attr(0750,root,sapdb) /usr/sapdb/pgm/kernel
%attr(0750,root,sapdb) /usr/sapdb/pgm/console
#%attr(0750,root,sapdb) /usr/sapdb/pgm/slowknl
#%attr(0750,root,sapdb) /usr/sapdb/pgm/quickknl
#%attr(0750,root,sapdb) /usr/sapdb/pgm/regcomp
/usr/sapdb/env/cserv.pcf
%dir /var/sapdb/config
/var/sapdb/config/Registry1.dcom
/var/sapdb/config/_USRSAPD
/var/sapdb/config/_USRSAPD.pah
%dir /var/sapdb/wrk
/var/sapdb/wrk/Registry.dcom
%dir /var/sapdb/wrk/_USRSAPD
%dir /var/spool/sql/config
%dir /var/spool/sql/diag
%dir /var/spool/sql/fifo
%dir /var/spool/sql/ipc
# Symlinks
/var/sapdb/bin
/var/sapdb/pgm
/var/sapdb/env
/var/sapdb/lib


%if "%{XLOAD}" == "yes"
# Table initiasation with xload
%attr(0750,sapdb,sapdb) /usr/sapdb/bin/xload
%attr(0750,root,sapdb) /usr/sapdb/pgm/load
/usr/sapdb/env/SYSDBA.ins
/usr/sapdb/env/INFO.ins
/usr/sapdb/env/SYSSET.ins
/usr/sapdb/env/PRECOM.ins
/usr/sapdb/env/QUERY.ins
/usr/sapdb/env/CNR3TAB.ins
/usr/sapdb/env/ODBC.ins
/usr/sapdb/env/ORADD.ins
/usr/sapdb/env/ORADDV.ins
/usr/sapdb/env/ORADDSYN.ins
/usr/sapdb/env/ORADDCOM.ins
/usr/sapdb/env/AS.ins
/usr/sapdb/env/QP.ins
/usr/sapdb/env/XDD.ins
/usr/sapdb/env/XDDCOM.ins
/usr/sapdb/env/SHOWCMD.ins
/usr/sapdb/env/DBMVIEWS.ins
/usr/sapdb/env/TERMCHAR.ind
/usr/sapdb/env/WA.ins
/usr/sapdb/env/ADATOOLS.ins
/usr/sapdb/env/DBanalyzer.ins
/usr/sapdb/env/lsystab.ins
%else
# Table initialization via Python
/usr/sapdb/env/SYSDBA.py
/usr/sapdb/env/INFO.py
/usr/sapdb/env/SYSSET.py
/usr/sapdb/env/PRECOM.py
/usr/sapdb/env/QUERY.py
/usr/sapdb/env/CNR3TAB.py
/usr/sapdb/env/ODBC.py
/usr/sapdb/env/ORADD.py
/usr/sapdb/env/ORADDV.py
/usr/sapdb/env/ORADDSYN.py
/usr/sapdb/env/ORADDCOM.py
/usr/sapdb/env/AS.py
/usr/sapdb/env/QP.py
/usr/sapdb/env/XDD.py
/usr/sapdb/env/XDDCOM.py
/usr/sapdb/env/SHOWCMD.py
/usr/sapdb/env/DBMVIEWS.py
/usr/sapdb/env/TERMCHAR.py
/usr/sapdb/env/WA.py
/usr/sapdb/env/lsystab.py
/usr/sapdb/env/installib.py
/usr/sapdb/env/*.lng
/usr/sapdb/env/*.ind
/usr/sapdb/env/*.ino
%endif

/usr/sapdb/env/nls.inf
/usr/sapdb/env/en
%endif

%if "%{ODBC}" == "yes"
%files odbc
/usr/sapdb/lib/libsqlod.so
/usr/sapdb/misc/odbcinst.ini
/usr/sapdb/lib/libodbcsapdbS.so
%endif


%if "%{DEVEL}" == "yes"
%files devel
# For ODBC
/usr/sapdb/incl/lcbasetypes.h
/usr/sapdb/incl/sql.h
/usr/sapdb/incl/sqlext.h
/usr/sapdb/incl/sqltypes.h
/usr/sapdb/incl/sqlucode.h
/usr/sapdb/lib/libsqlod.a
# For Precompiler
/usr/sapdb/bin/cpc
/usr/sapdb/bin/cpclnk
/usr/sapdb/bin/sqllist
/usr/sapdb/pgm/pc3
/usr/sapdb/env/precopt.hlf
/usr/sapdb/incl/abaphndl.h
/usr/sapdb/incl/cpc.h
/usr/sapdb/incl/lcstream.h
/usr/sapdb/incl/livecachetypes.h
/usr/sapdb/incl/sqlca.h
/usr/sapdb/lib/libpcrl.a
/usr/sapdb/lib/libsqlca.a
%endif


%if "%{PYTHON15}" == "yes"
%files python15
/usr/sapdb/lib/python1.5
/usr/sapdb/bin/x_python
/usr/sapdb/pgm/python
%dir /usr/sapdb/misc
/usr/sapdb/misc/sapdbmodule.so
/usr/sapdb/misc/repmanmodule.so
/usr/sapdb/misc/dbmmodule.so
%endif

%if "%{PYTHON21}" == "yes"
%files python21
%dir /usr/sapdb/misc
/usr/sapdb/misc/sapdbmodule.so
/usr/sapdb/misc/repmanmodule.so
/usr/sapdb/misc/dbmmodule.so
%endif


%if "%{PYTHON22}" == "yes"
%files python22
%dir /usr/sapdb/misc
/usr/sapdb/misc/sapdbmodule.so
/usr/sapdb/misc/repmanmodule.so
/usr/sapdb/misc/dbmmodule.so
%endif


%if "%{OLDRUNTIMES}" == "yes"
%files oldruntimes
/usr/sapdb/runtime/7240
%endif

Reply via email to