InterBase 6.0 .rpm Build/Installation Scripts

Description

Below are the SuperServer and Classic scripts used to install InterBase 6.0 as a .rpm package. If you want to create your own build/installation routine using a .rpm script, here's how its done.

SuperServer

Summary: Relational Database Server and Client tools by InterBase.
Name: InterBaseSS_LI Version: V6.0
Release: 1
Copyright: Distributable
Group: Applications/Databases
Source: InterBaseSS_LI-V6.0Source.tgz
Vendor: InterBase
Prefix: /opt
AutoReqProv: no

%description
InterBase is a powerful, high-performance relational database designed to be embedded into
applications on multiple platforms such as Cobalt, Microsoft Windows, NetWare, Linux, and other
UNIX systems. Since 1985, InterBase has continually provided superior relational database
solutions to meet the business-critical embedded database needs of VARs and application
developers. InterBase continues to be the preferred solution for embedded database requirements
because of its superior engine technology, advanced development features, small footprint, and
unequalled ease of use, management, maintenance and installation.

%prep
cd /usr/src/redhat/BUILD
rm -fr InterBase
cvs co InterBase
STATUS=$? if [ $STATUS -ne 0 ]; then
echo "Can't check out the CVS tree"
exit $STATUS
fi
chmod -R 777 .
cd InterBase
setup_dirs LINUX PROD
cp /usr/include/iberror.h interbase/include/
cp /opt/interbase/bin/gpre interbase/bin/
cp /opt/interbase/bin/gds_drop interbase/bin/
cp /opt/interbase/isc4.gdb interbase/
cp /usr/lib/libgds.so interbase/lib/gds.so
cd jrd
make codes
codes
cd ..
mkdir interbase/doc

tar cvfz /usr/src/redhat/SOURCES/InterBaseSS_LI-V6.0Source.tgz InterBase

%build
LINK=0
if [ -d /usr/interbase -o -L /usr/interbase ]
then
mv /usr/interbase /usr/interbase.orig
ln -s /usr/src/redhat/BUILD/InterBase/interbase /usr/interbase
LINK=1
fi
cd InterBase
build_kit builds SUPER
if [ $LINK -ne 0 ]; then
rm /usr/interbase
mv /usr/interbase.orig /usr/interbase
fi

%install
cd InterBase
if [ -d /opt/interbase ]
then
rm -fr /opt/interbase
fi
mkdir /opt/interbase
mkdir /opt/interbase/bin
mkdir /opt/interbase/examples
mkdir /opt/interbase/help
mkdir /opt/interbase/include
mkdir /opt/interbase/intl
mkdir /opt/interbase/lib
mkdir /opt/interbase/doc
mkdir /opt/interbase/UDF

cp interbase/bin/gbak /opt/interbase/bin/gbak
cp interbase/bin/gdef /opt/interbase/bin/gdef
cp interbase/bin/gds_lock_print /opt/interbase/bin/gds_lock_print
cp interbase/bin/gfix /opt/interbase/bin/gfix
cp interbase/bin/gpre /opt/interbase/bin/gpre
cp interbase/bin/gsec /opt/interbase/bin/gsec
cp interbase/bin/gsplit /opt/interbase/bin/gsplit
cp interbase/bin/gstat /opt/interbase/bin/gstat
cp interbase/bin/isc4.gbak /opt/interbase/bin/isc4.gbak
cp interbase/bin/isql /opt/interbase/bin/isql
cp interbase/bin/qli /opt/interbase/bin/qli
cp interbase/bin/ibmgr.bin /opt/interbase/bin/ibmgr.bin
#cp interbase/bin/ibmgr /opt/interbase/bin/ibmgr
cp interbase/bin/ibserver /opt/interbase/bin/ibserver
cp interbase/bin/ibguard /opt/interbase/bin/ibguard

cp interbase/examples/v5/*.[ceh] /opt/interbase/examples
cp interbase/examples/v5/*.sql /opt/interbase/examples
cp interbase/examples/v5/*.gbk /opt/interbase/examples
cp interbase/examples/v5/*.gdb /opt/interbase/examples
cp interbase/examples/v5/makefile /opt/interbase/examples
cp interbase/help/help.gbak /opt/interbase/help
cp interbase/help/help.gdb /opt/interbase/help
#cp -r interbase/doc /opt/interbase
cp interbase/interbase.msg /opt/interbase/interbase.msg
cp interbase/isc4.gdb /opt/interbase/isc4.gdb
cp interbase/isc_config /opt/interbase/isc_config

cp -f interbase/include/gds.h /usr/include/gds.h
cp -f interbase/include/iberror.h /usr/include/iberror.h
cp -f interbase/include/ibase.h /usr/include/ibase.h

cp interbase/include/gds.f /opt/interbase/include
cp interbase/include/gds.hxx /opt/interbase/include
cp interbase/include/*.h /opt/interbase/include

cp -f interbase/lib/gds.so.1 /usr/lib/libgds.so.0
cp -f interbase/lib/ib_util /usr/lib/libib_util.so
cp -f interbase/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a

cp interbase/intl/gdsintl /opt/interbase/intl/gdsintl
cp interbase/UDF/ib_udf /opt/interbase/UDF/ib_udf

cp interbase/services.isc /opt/interbase/services.isc
#cp interbase/license.txt /opt/interbase/license.txt
#cp interbase/license.html /opt/interbase/license.html
#cp interbase/ReleaseNotes.pdf /opt/interbase/ReleaseNotes.pdf

# June 23 2000, 6:00AM
TIMESTAMP="200006230600.00"
cd /opt/interbase/
touch -t $TIMESTAMP find . -print

%files
%dir /opt/interbase
%dir /opt/interbase/bin
%dir /opt/interbase/lib
%dir /opt/interbase/UDF
%dir /opt/interbase/intl
%dir /opt/interbase/help
/opt/interbase/bin/gbak
/opt/interbase/bin/gdef
/opt/interbase/bin/gds_lock_print
/opt/interbase/bin/gfix
/opt/interbase/bin/gpre
/opt/interbase/bin/gsec
/opt/interbase/bin/gsplit
/opt/interbase/bin/gstat
/opt/interbase/bin/isc4.gbak
/opt/interbase/bin/isql
/opt/interbase/bin/qli
/opt/interbase/bin/ibmgr.bin
/opt/interbase/bin/ibserver
/opt/interbase/bin/ibguard
/opt/interbase/examples
/opt/interbase/help/help.gbak
%attr(666, -, -)
/opt/interbase/help/help.gdb
/opt/interbase/include
/usr/include/gds.h
/usr/include/iberror.h
/usr/include/ibase.h
/opt/interbase/doc
/opt/interbase/interbase.msg
%attr(666, -, -)
/opt/interbase/isc4.gdb
/opt/interbase/isc_config
/usr/lib/libgds.so.0
/usr/lib/libib_util.so
/usr/lib/libgds_pyxis.a
/opt/interbase/intl/gdsintl
/opt/interbase/UDF/ib_udf
/opt/interbase/services.isc

%pre
# Boring Stuff. Rename any previous files.
# Check for previous installations
rpm -q interbase
STATUS=$?
if [ $STATUS -eq 0 ]; then
echo "Previous version of InterBase is detected on your system."
echo "Please unistall the previous version (rpm -q interbase) and then proceed."
exit $STATUS
fi
rpm -q InterBase
STATUS=$?
if [ $STATUS -eq 0 ]; then
echo "Previous version of InterBase is detected on your system."
echo "Please unistall the previous version (rpm -q InterBase) and then proceed."
exit $STATUS
fi

for file in /usr/interbase /opt/interbase
do
if [ -L $file -o -f $file -o -d $file ]
then
echo -e "tFound a previous InterBase link ($file)."
echo -e "tRenaming it to $file.prev.lnk"
mv $file $file.prev.lnk
fi
done

for file in /usr/include/gds.h /usr/include/ibase.h /usr/include/iberror.h /usr/lib/libgds.so.0 | /usr/lib/libgds.so /usr/lib/libgds.a /usr/lib/libib_util*
do
if [ -L $file -o -f $file ]
then
echo -e "tFound a previous version of $file"
echo -e "tRenaming it to $file.prev.lnk ".
mv $file $file.prev.lnk
fi
done

%preun
if ps -ef | egrep -e '(gds_lock_mgr|gds_inet_server|gds_pipe)' | grep -v grep> /dev/null
then
echo "An instance of the InterBase server seems to be running."
echo "Please quit all interbase applications and then proceed."
exit 1
fi
if ps -ef | egrep -e '(ibserver|ibguard)' | grep -v grep> /dev/null
then
echo "An instance of the InterBase Super server seems to be running."
echo "Please quit all interbase applications and then proceed."
exit 1
fi
if [ -f /opt/interbase/isc4.gdb ]
then
cp /opt/interbase/isc4.gdb /tmp
echo "Saved a copy of isc4.gdb in /tmp"
fi
rm -f /opt/interbase/isc_init1* /opt/interbase/isc_event1* /opt/interbase/isc_lock1* /opt/interbase/isc_guard* /opt/interbase/interbase.log

%post
# Make sure the links are in place
if [ ! -L /opt/interbase -a ! -d /opt/interbase ]
then
# Main link and...
ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase
fi

# Create link for shared library
ln -s libgds.so.0 /usr/lib/libgds.so

# Add entry in /etc/services
if grep "^gds_db" /etc/services > /dev/null
then
grep -v "^gds_db" /etc/services > /etc/services.tmp
echo "gds_db 3050/tcp # InterBase Database Remote Protocol" >> /etc/services.tmp
mv /etc/services.tmp /etc/services
else
echo "gds_db 3050/tcp # InterBase Database Remote Protocol" >> /etc/services
fi

# Delete entry from /etc/inetd.conf
if grep "^gds_db" /etc/inetd.conf > /dev/null
then
grep -v "^gds_db" /etc/inetd.conf > /etc/inetd.conf.tmp
mv -f /etc/inetd.conf.tmp /etc/inetd.conf
# Poke inetd
if [ -f /var/run/inetd.pid ]
then
kill -HUP cat /var/run/inetd.pid
fi
fi

touch /opt/interbase/isc_lock1.`hostname`
chmod 666 /opt/interbase/isc_lock1.`hostname`
touch /opt/interbase/isc_init1.`hostname`
chmod 666 /opt/interbase/isc_init1.`hostname`
touch /opt/interbase/isc_event1.`hostname`
chmod 666 /opt/interbase/isc_event1.`hostname`
touch /opt/interbase/isc_guard1.`hostname`
chmod 666 /opt/interbase/isc_guard1.`hostname`
touch /opt/interbase/interbase.log
chmod 666 /opt/interbase/interbase.log
chmod 666 /opt/interbase/examples/*.gdb

%postun
if [ -L /usr/lib/libgds.so ]
then
rm /usr/lib/libgds.so
fi

if [ "$1"=0 ]
then
# Lose the gds_db line from /etc/services
if
grep "^gds_db" /etc/services > /dev/null
then
grep -v "^gds_db" /etc/services > /etc/services.tmp
mv -f /etc/services.tmp /etc/services
fi
fi
Classic

Summary: Relational Database Server and Client tools by InterBase.
Name: InterBaseCS_LI
Version: V6.0
Release: 1
Copyright: Distributable
Group: Applications/Databases
Source: InterBaseCS_LI-V6.0Source.tgz
Vendor: InterBase
Prefix: /opt
AutoReqProv: no

%description
InterBase is a powerful, high-performance relational database designed to be embedded into
applications on multiple platforms such as Cobalt, Microsoft Windows, NetWare, Linux, and other
UNIX systems. Since 1985, InterBase has continually provided superior relational database
solutions to meet the business-critical embedded database needs of VARs and application
developers. InterBase continues to be the preferred solution for embedded database requirements
because of its superior engine technology, advanced development features, small footprint, and
unequalled ease of use, management, maintenance and installation.

%prep
cd /usr/src/redhat/BUILD
rm -fr InterBase
cvs co InterBase
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "Can't check out the CVS tree"
exit $STATUS
fi
chmod -R 777
. cd InterBase
setup_dirs LINUX PROD
cp /usr/include/iberror.h interbase/include/
cp /opt/interbase/bin/gpre interbase/bin/
cp /opt/interbase/bin/gds_lock_mgr interbase/bin/
cp /opt/interbase/bin/gds_drop interbase/bin/
cp /opt/interbase/isc4.gdb interbase/
cp /usr/lib/libgds.so interbase/lib/gds.so
cd jrd
make codes
codes
cd .. mkdir interbase/doc

tar cvfz /usr/src/redhat/SOURCES/InterBaseCS_LI-V6.0Source.tgz InterBase

%build
LINK=0
if [ -d /usr/interbase -o -L /usr/interbase ]
then
mv /usr/interbase /usr/interbase.orig
ln -s /usr/src/redhat/BUILD/InterBase/interbase /usr/interbase
LINK=1
fi
cd InterBase build_kit builds CLASSIC
if [ $LINK -ne 0 ]; then
rm /usr/interbase
mv /usr/interbase.orig /usr/interbase
fi

%install
cd InterBase
if [ -d /opt/interbase ]
then
rm -fr /opt/interbase
fi mkdir /opt/interbase
mkdir /opt/interbase/bin
mkdir /opt/interbase/examples
mkdir /opt/interbase/help
mkdir /opt/interbase/include
mkdir /opt/interbase/intl
mkdir /opt/interbase/lib
mkdir /opt/interbase/doc
mkdir /opt/interbase/UDF

if [ ! -L /usr/local/sbin -a ! -d /usr/local/sbin ]
then
# Create directory...
mkdir -p /usr/local/sbin
fi
cp -f interbase/bin/gds_inet_server /usr/local/sbin/gds_inet_server

cp interbase/bin/gbak /opt/interbase/bin/gbak
cp interbase/bin/gdef /opt/interbase/bin/gdef
cp interbase/bin/gds_lock_print /opt/interbase/bin/gds_lock_print
cp interbase/bin/gds_drop /opt/interbase/bin/gds_drop
cp interbase/bin/gds_lock_mgr /opt/interbase/bin/gds_lock_mgr
cp interbase/bin/gds_pipe /opt/interbase/bin/gds_pipe
cp interbase/bin/gfix /opt/interbase/bin/gfix
cp interbase/bin/gpre /opt/interbase/bin/gpre
cp interbase/bin/gsec /opt/interbase/bin/gsec
cp interbase/bin/gsplit /opt/interbase/bin/gsplit
cp interbase/bin/gstat /opt/interbase/bin/gstat
cp interbase/bin/isc4.gbak /opt/interbase/bin/isc4.gbak cp interbase/bin/isql /opt/interbase/bin/isql
cp interbase/bin/qli /opt/interbase/bin/qli
cp interbase/examples/v5/*.[ceh] /opt/interbase/examples
cp interbase/examples/v5/*.sql /opt/interbase/examples
cp interbase/examples/v5/*.gbk /opt/interbase/examples
cp interbase/examples/v5/*.gdb /opt/interbase/examples
cp interbase/examples/v5/makefile /opt/interbase/examples
cp interbase/help/help.gbak /opt/interbase/help
cp interbase/help/help.gdb /opt/interbase/help
cp -r interbase/doc /opt/interbase
cp interbase/interbase.msg /opt/interbase/interbase.msg
cp interbase/isc4.gdb /opt/interbase/isc4.gdb
cp interbase/isc_config /opt/interbase/isc_config

cp -f interbase/include/gds.h /usr/include/gds.h
cp -f interbase/include/iberror.h /usr/include/iberror.h
cp -f interbase/include/ibase.h /usr/include/ibase.h

cp interbase/include/gds.f /opt/interbase/include
cp interbase/include/gds.hxx /opt/interbase/include
cp interbase/include/*.h /opt/interbase/include

cp -f interbase/lib/gds.so /usr/lib/libgds.so.0
cp -f interbase/lib/gds.a /usr/lib/libgds.a
cp -f interbase/lib/ib_util /usr/lib/libib_util.so
cp -f interbase/lib/gds_pyxis.a /usr/lib/libgds_pyxis.a

cp interbase/intl/gdsintl /opt/interbase/intl/gdsintl
cp interbase/UDF/ib_udf /opt/interbase/UDF/ib_udf

cp interbase/services.isc /opt/interbase/services.isc

# June 23 2000, 6:00AM
TIMESTAMP="200006230600.00"
cd /opt/interbase/
touch -t $TIMESTAMP find . -print

%files
%dir /opt/interbase
%dir /opt/interbase/bin
%dir /opt/interbase/lib
%dir /opt/interbase/UDF
%dir /opt/interbase/intl
%dir /opt/interbase/help
/usr/local/sbin/gds_inet_server
/opt/interbase/bin/gbak
/opt/interbase/bin/gdef
/opt/interbase/bin/gds_lock_print
/opt/interbase/bin/gds_lock_mgr
/opt/interbase/bin/gds_pipe
/opt/interbase/bin/gds_drop
/opt/interbase/bin/gfix
/opt/interbase/bin/gpre
/opt/interbase/bin/gsec
/opt/interbase/bin/gsplit
/opt/interbase/bin/gstat
/opt/interbase/bin/isc4.gbak
/opt/interbase/bin/isql
/opt/interbase/bin/qli
/opt/interbase/examples
/opt/interbase/help/help.gbak
%attr(666, -, -) /opt/interbase/help/help.gdb
/opt/interbase/include
/usr/include/gds.h
/usr/include/iberror.h
/usr/include/ibase.h
/opt/interbase/doc
/opt/interbase/interbase.msg
%attr(666, -, -) /opt/interbase/isc4.gdb
/opt/interbase/isc_config
/usr/lib/libgds.so.0
/usr/lib/libib_util.so
/usr/lib/libgds_pyxis.a
/usr/lib/libgds.a
/opt/interbase/intl/gdsintl
/opt/interbase/UDF/ib_udf
/opt/interbase/services.isc

%pre
# Boring Stuff. Rename any previous files.
# Check for previous installations
rpm -q interbase
STATUS=$?
if [ $STATUS -eq 0 ]; then
echo "Previous version of InterBase is detected on your system."
echo "Please unistall the previous version (rpm -q interbase) and then proceed."
exit $STATUS
fi

for file in /usr/interbase /opt/interbase
do
if [ -L $file -o -f $file -o -d $file ]
then
echo -e "tFound a previous InterBase link ($file)."
echo -e "tRenaming it to $file.prev.lnk"
mv $file $file.prev.lnk
fi
done

for file in /usr/include/gds.h /usr/include/ibase.h /usr/include/iberror.h /usr/lib/libgds.so.0 /usr/lib/libgds.so /usr/lib/libgds.a /usr/lib/libib_util*
do
if [ -L $file -o -f $file ]
then
echo -e "tFound a previous version of $file"
echo -e "tRenaming it to $file.prev.lnk ".
mv $file $file.prev.lnk
fi
done

%preun
if ps -ef | egrep -e '(gds_lock_mgr|gds_inet_server|gds_pipe)' | grep -v grep> /dev/null
then
echo "An instance of the InterBase server seems to be running."
echo "Please quit all interbase applications and then proceed."
exit 1
fi
if [ -f /opt/interbase/isc4.gdb ]
then
cp /opt/interbase/isc4.gdb /tmp
echo "Saved a copy of isc4.gdb in /tmp"
fi
rm -f /opt/interbase/isc_init1* /opt/interbase/isc_event1* /opt/interbase/isc_lock1* /opt/interbase/interbase.log

%post
# Make sure the links are in place
if [ ! -L /opt/interbase -a ! -d /opt/interbase ]
then
# Main link and...
ln -s $RPM_INSTALL_PREFIX/interbase /opt/interbase
fi

# Create link for shared library
ln -s libgds.so.0 /usr/lib/libgds.so

# Add entry in /etc/services
if grep "^gds_db" /etc/services > /dev/null
then
grep -v "^gds_db" /etc/services > /etc/services.tmp
echo "gds_db 3050/tcp # InterBase Database Remote Protocol" >> /etc/services.tmp
mv /etc/services.tmp /etc/services
else
echo "gds_db 3050/tcp # InterBase Database Remote Protocol" >> /etc/services
fi

# Add entry in /etc/inetd.conf
if grep "^gds_db" /etc/inetd.conf > /dev/null
then
grep -v "^gds_db" /etc/inetd.conf > /etc/inetd.conf.tmp echo "gds_db stream tcp nowait.30000 root /usr/local/sbin/gds_inet_server gds_inet_server # InterBase Database Remote Server" >> /etc/inetd.conf.tmp
mv -f /etc/inetd.conf.tmp /etc/inetd.conf
else
echo "gds_db stream tcp nowait.30000 root /usr/local/sbin/gds_inet_server gds_inet_server # InterBase Database Remote Server" >> /etc/inetd.conf
fi
# Poke inetd
if [ -f /var/run/inetd.pid ]
then kill -HUP cat /var/run/inetd.pid
fi

touch /opt/interbase/isc_lock1.`hostname`
chmod 666 /opt/interbase/isc_lock1.`hostname`
touch /opt/interbase/isc_init1.`hostname`
chmod 666 /opt/interbase/isc_init1.`hostname`
touch /opt/interbase/isc_event1.`hostname`
chmod 666 /opt/interbase/isc_event1.`hostname`
touch /opt/interbase/interbase.log
chmod 666 /opt/interbase/interbase.log
chmod 666 /opt/interbase/examples/*.gdb

%postun
if [ -L /usr/lib/libgds.so ]
then
rm /usr/lib/libgds.so
fi

if [ "$1"=0 ]
then
# Lose the gds_db line from /etc/services
if grep "^gds_db" /etc/services > /dev/null then grep -v "^gds_db" /etc/services > /etc/services.tmp
mv -f /etc/services.tmp /etc/services
fi

# Next, lose the gds_db line from /etc/inetd.conf
if grep "^gds_db" /etc/inetd.conf > /dev/null
then
grep -v "^gds_db" /etc/inetd.conf > /etc/inetd.conf.tmp
mv -f /etc/inetd.conf.tmp /etc/inetd.conf
# Poke inetd
if [ -f /var/run/inetd.pid ]
then
kill -HUP cat /var/run/inetd.pid
fi
fi
fi