orarun/orarun.spec

190 lines
7.0 KiB
RPMSpec
Raw Normal View History

#
# 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 http://bugs.opensuse.org/
#
Name: orarun
#BuildRequires: psmisc
BuildRequires: pwdutils
BuildRequires: systemd-rpm-macros
Version: 2.1
Release: 0
Url: http://www.suse.com/oracle/
Summary: An Environment for Running Oracle Products
License: GPL-2.0+
Group: Productivity/Databases/Tools
Source: orarun.tar.bz2
Patch0: bsc1217288-fix-checking-of-ORACLE_HOME.patch
Patch1: bsc1219103-fix-checking-running-agent.patch
#Source1: libInternalSymbols.tar.bz2
Requires: binutils
Requires: gcc
Requires: gcc-c++
Requires: glibc-devel
%ifarch %ix86 x86_64
Requires: compat-libpthread-nonshared
%endif
Requires: glibc-locale
Requires: libaio
Requires: libaio-devel
#Requires: libstdc++-devel
Requires: make
Requires: mksh
Requires: sysstat
Requires: systemd
Requires: xorg-x11-libs
Requires: libXtst6
Requires: libcap-progs
Requires: libcap-ng-utils
Requires: nfs-kernel-server
PreReq: /usr/sbin/groupadd /usr/sbin/useradd %fillup_prereq /bin/mkdir /bin/cat
#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
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%description
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.
http://www.suse.com/oracle/
Authors:
--------
aksingh
%prep
%setup -b 0
%patch0 -p1
%patch1 -p1
%build
%install
install -d -m 755 ${RPM_BUILD_ROOT}{/usr/share/doc/packages,/etc/init.d,/etc/profile.d,/usr/sbin,%{_fillupdir},/sbin,/usr/bin,/usr/lib}
#install -m 744 oracle ${RPM_BUILD_ROOT}/etc/init.d/oracle
install -d -m 0755 ${RPM_BUILD_ROOT}/opt/oracle
install -d -m 0755 ${RPM_BUILD_ROOT}/opt/oraInventory
#install -d -m 0755 ${RPM_BUILD_ROOT}/var/opt/oracle
# systemd
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/orarun
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/systemd/system
install -m 755 oracle ${RPM_BUILD_ROOT}/usr/lib/orarun/oracle
install -m 444 oracle.service ${RPM_BUILD_ROOT}%{_unitdir}/oracle.service
install -m 755 oracle-setup ${RPM_BUILD_ROOT}/usr/lib/orarun/oracle-setup
install -m 444 oracle-setup.service ${RPM_BUILD_ROOT}%{_unitdir}/oracle-setup.service
install -m 644 common.sh ${RPM_BUILD_ROOT}/usr/lib/orarun/common.sh
install -m 644 oracle.sh ${RPM_BUILD_ROOT}/etc/profile.d/oracle.sh
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
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcoracle
install -m 644 sysconfig.oracle ${RPM_BUILD_ROOT}%{_fillupdir}/sysconfig.oracle
#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
%pre
# not needed
#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
#fi
#Oracle Install requirement
# If not created already, Create User : oracle and group: oinstall, dba
#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
getent group oinstall >/dev/null || /usr/sbin/groupadd -r oinstall
getent group dba >/dev/null || /usr/sbin/groupadd -r dba
getent passwd oracle >/dev/null || /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
%{service_add_pre oracle.service oracle-setup.service}
exit 0
%post
#/sbin/insserv raw >& /dev/null
#/sbin/chkconfig boot.sysctl on >& /dev/null
#
# Moved this to oracle-setup
# 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/limits.conf.save
# Added stack option
# 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/limits.conf.save > /etc/security/limits.conf
#fi
grep -qs "^session.*required.*pam_limits.so" /etc/pam.d/login || (cp /etc/pam.d/login /etc/pam.d/login.save && echo "session required pam_limits.so # added by orarun" >> /etc/pam.d/login)
#
%{service_add_post oracle.service oracle-setup.service}
test -f /etc/sysconfig/oracle || cp %{_fillupdir}/sysconfig.oracle /etc/sysconfig/oracle
# This is handled via systemd-presets-branding-SLE
#/usr/bin/systemctl enable oracle.service || echo "Call systemctl enable oracle to enable the service"
exit 0
%preun
%{service_del_preun oracle.service oracle-setup.service}
%postun
%{service_del_postun oracle.service oracle-setup.service}
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-,root,root)
%doc README
%doc GPL_v2
%attr(0644,root,root) %config(noreplace) /etc/profile.d/oracle.sh
%attr(0644,root,root) %config(noreplace) /etc/profile.d/oracle.csh
#%attr(0744,root,root) %config /etc/init.d/oracle
%dir %attr(755, oracle, oinstall) /opt/oracle
%dir %attr(755, oracle, oinstall) /opt/oraInventory
#%dir %attr(755, oracle, oinstall) /var/opt/oracle
/usr/sbin/rcoracle
/usr/lib/orarun
%{_unitdir}/*.service
#/sbin/fuser
#/usr/bin/fuser
%{_fillupdir}/sysconfig.oracle
%changelog