File orarun.spec of Package orarun.6271

# spec file for package orarun
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           orarun
BuildRequires:  psmisc
BuildRequires:  pwdutils
Version:        2.0
Release:        0
Summary:        An Environment for Running Oracle Products
License:        GPL-2.0+
Group:          Productivity/Databases/Tools
Source:         orarun.tar.bz2
#Source1:        libInternalSymbols.tar.bz2
Requires:       binutils
Requires:       gcc
Requires:       glibc-devel
Requires:       glibc-locale
Requires:       libXtst6
Requires:       libXtst6-32bit
Requires:       libaio
Requires:       libaio-devel
Requires:       libcap-ng-utils
Requires:       libcap-ng0-32bit
Requires:       libcap-progs
Requires:       libcap1
Requires:       libcap1-32bit
Requires:       libstdc++-devel
Requires:       make
Requires:       mksh
Requires:       sysstat
Requires:       xorg-x11-libs
PreReq:         /usr/sbin/groupadd /usr/sbin/useradd %insserv_prereq  %fillup_prereq /bin/mkdir /bin/cat
#Obsoletes:      orarun8i orarun9i
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 ia64 s390 s390x x86_64

This package creates the user and the groups for Oracle, sets the
Oracle environment variables, sets kernel parameters to values
recommended by Oracle, and provides for automated start and stop of
Oracle components at system start and stop time. It also includes
dependencies for other software packages needed to install and use
Oracle, so that when you select this package the other packages are
included automatically (when you install via YaST2) or that you are at
least reminded to install them (when installing via the rpm command).
This package is not required for running Oracle but it simplifies
things significantly.

You can edit all settings via YaST2.


%setup -b 0


install -d -m 755 ${RPM_BUILD_ROOT}{/usr/share/doc/packages,/etc/init.d,/etc/profile.d,/usr/sbin,/var/adm/fillup-templates,/sbin,/usr/bin,/usr/lib}
install -m 744 oracle ${RPM_BUILD_ROOT}/etc/init.d/oracle
install -m 644 ${RPM_BUILD_ROOT}/etc/profile.d/
install -m 644 oracle.csh ${RPM_BUILD_ROOT}/etc/profile.d/oracle.csh
ln -sf ../../etc/init.d/oracle ${RPM_BUILD_ROOT}/usr/sbin/rcoracle
install -m 644 ${RPM_BUILD_ROOT}/var/adm/fillup-templates/
#ln -sf ../../bin/sh ${RPM_BUILD_ROOT}/usr/bin/sh
ln -sf ../bin/fuser ${RPM_BUILD_ROOT}/sbin/fuser
ln -sf ../../bin/fuser ${RPM_BUILD_ROOT}/usr/bin/fuser

if [ ! -d /etc/sysconfig/ ] ; then
	echo "No directory /etc/sysconfig/ - this package is for SuSE Linux 8.0 and higher"
	echo "and for United Linux 1.0 and higher ONLY."
	exit 1
grep -qs ^oinstall: /etc/group || /usr/sbin/groupadd -r oinstall
grep -qs ^dba: /etc/group      || /usr/sbin/groupadd -r dba
grep -qs ^oracle: /etc/passwd  || /usr/sbin/useradd -r -c "Oracle user" -g oinstall -G dba -d /opt/oracle oracle
test -d /opt/oracle            || install -m 755 -o oracle -g oinstall -d /opt/oracle
test -d /var/opt/oracle        || install -m 750 -o oracle -g oinstall -d /var/opt/oracle

exit 0

/sbin/insserv raw >& /dev/null
#/sbin/chkconfig boot.sysctl on >& /dev/null
# Update limits.conf only when no existing oracle parameters (bnc#597757)
if [ $(grep -c oracle /etc/security/limits.conf) = "0" ] ; then
	mv /etc/security/limits.conf /etc/security/ 
	sed -e "s/# End of file/## added by orarun ##\noracle\tsoft\tnproc\t2047\noracle\thard\tnproc\t16384\noracle\tsoft\tnofile\t1024\noracle\thard\tnofile\t65536\noracle\tsoft\tstack\t10240\noracle\thard\tstack\t32768\n# End of file/" /etc/security/ > /etc/security/limits.conf

grep -qs "^session.*required.*" /etc/pam.d/login || (cp /etc/pam.d/login /etc/pam.d/ && echo "session     required   # added by orarun" >> /etc/pam.d/login)
%{fillup_and_insserv -n oracle -i}
%{insserv_force_if_yast oracle}
test -f /etc/sysconfig/oracle || cp /var/adm/fillup-templates/ /etc/sysconfig/oracle
exit 0


rm -rf ${RPM_BUILD_ROOT}

%doc GPL_v2
%attr(0644,root,root) %config(noreplace) /etc/profile.d/
%attr(0644,root,root) %config(noreplace) /etc/profile.d/oracle.csh
%attr(0744,root,root) %config /etc/init.d/oracle