Package oracle-preinstall: Specfile

%define		swowner		oracle
%define		orainventory	oinstall
%define		osdba		dba
%define		osoper		oper
%define		oracle_base	/opt/oracle
%define		inventory	%oracle_base/%swowner/oraInventory
%define		invloc		%_sysconfdir/oraInst.loc
%define		oratab		%_sysconfdir/oratab

Name:		oracle-preinstall
Version:	0.4
Release:	alt7.qa1

Summary:	Oracle pre-installation scripts
License:	GPL
Group:		Databases
Packager:	Igor Muratov (ALT Linux Team) <migor@altlinux.org>
#Url:		http://www.lrn.ru/~migor/

BuildArch:	noarch

# Environment set
Source1:	oracle.sh
Source5:	oracle.menu
Source6:	oracle.sysconfig
# Scripts
Source11:	oracle-db
Source12:	oracle-lsnr
# Documentation
Source20:	README
Source21:	Oracle10g_ALT40.patch

Obsoletes: oracle8-tuning oracle9-tuning oracle10-tuning

Requires: binutils make gcc findutils gawk pdksh
Requires: glibc glibc-devel libaio libaio-devel libstdc++3.3
Requires: xorg-x11-libs xorg-x11-locales xorg-x11-xauth
Requires: fonts-type1-xorg
# ssh needs if you install RAC
Requires: openssh-clients


%description
Common scripts to install and maintenance Oracle(TM) database server
and it services. May be used with Oracle9i and later.


%package client
Summary: Oracle Client preinstall package
Group: Databases
Requires: %name

%description client
Common scripts to install and maintenance Oracle(TM) database server
and it services. May be used with Oracle9i and later.


%prep


%build


%install
%__install -dD $RPM_BUILD_ROOT%_initdir
%__install -m755 -D %SOURCE11 %SOURCE12 $RPM_BUILD_ROOT%_initdir/

%__install -dD $RPM_BUILD_ROOT%_sysconfdir/{profile.d,sysconfig}
%__install -m755 -D %SOURCE1 $RPM_BUILD_ROOT%_sysconfdir/profile.d/
%__install -m755 -D %SOURCE6 $RPM_BUILD_ROOT%_sysconfdir/sysconfig/oracle

%__install -m644 -D %SOURCE20 $RPM_BUILD_ROOT%_docdir/%name-%version/README
%__install -m644 -D %SOURCE21 $RPM_BUILD_ROOT%_docdir/%name-%version/Oracle10g_ALT40.patch

%__install -m644 -D %SOURCE5 $RPM_BUILD_ROOT%_menudir/%name

# Optimal Flexible Architecture Directory Structure
%__install -m0775 -dD $RPM_BUILD_ROOT%oracle_base/{admin,product,crs,doc,local,oradata}
%__install -m0770 -dD $RPM_BUILD_ROOT%oracle_base/{oraInventory,flash_recovery_area}

%pre
/usr/sbin/groupadd -r -f %orainventory >/dev/null 2>&1 ||:
/usr/sbin/groupadd -r -f %osdba >/dev/null 2>&1 ||:
/usr/sbin/groupadd -r -f %osoper >/dev/null 2>&1 ||:
/usr/sbin/useradd -g %orainventory -G %osdba,%osoper \
	-c "Oracle database server" -n %swowner >/dev/null 2>&1 ||:
/bin/su - oracle -c "ssh-keygen -t dsa -b 2048 -C 'Autogenerated key' -f ~/.ssh/id_dsa -N '' -q" ||:
if [ ! -f %invloc ]
then
	echo "inventory_loc=%oracle_base/oraInventory" > %invloc
	echo "inst_group=%orainventory" >> %invloc
	chown %swowner:%orainventory %invloc
	echo "File %invloc created."
fi
if [ ! -f %oratab ]
then
	echo "# Oracle instances" >> %oratab
	chown %swowner:%orainventory %oratab
	echo "File %oratab created."
fi

%preun
%preun_service oracle-lsnr
%preun_service oracle-db

%files
%defattr(-, root, root)
%config(noreplace) %_initdir/*
%config(noreplace) %_sysconfdir/sysconfig/*
%attr(-, %swowner, %orainventory) %oracle_base
%_docdir/%name-%version

%files client
%config(noreplace) %_sysconfdir/profile.d/*
%_menudir/*


%changelog
* Wed Dec 02 2009 Repocop Q. A. Robot <repocop@altlinux.org> 0.4-alt7.qa1
- NMU (by repocop): the following fixes applied:
  * update_menus for oracle-preinstall-client
  * postclean-05-filetriggers for spec file

* Thu Aug 20 2007 Igor Muratov <migor at altlinux dot org> 0.4-alt7
- fix init scripts

* Thu Aug  2 2007 Igor Muratov <migor at altlinux dot org> 0.4-alt6
- update patch
- update documentation
- update requirements

* Fri Jul 27 2007 Igor Muratov <migor at altlinux dot org> 0.4-alt5
- update requirements

* Mon Jan 12 2007 Igor Muratov <migor at altlinux dot org> 0.4-alt4
- update dependencies to xorg

* Fri Dec 15 2006 Igor Muratov <migor at altlinux dot org> 0.4-alt3
- Change oracle user groups membership
- add ssh require
- add OFA directory structure
- move Oracle menu to separate package
- remove oratab and oraInst.loc from package
- update startup scripts

* Tue Oct 03 2006 Igor Muratov <migor at altlinux dot org> 0.4-alt2
- Add requirement for xorg-x11-locales

* Mon Jun 27 2006 Igor Muratov <migor at altlinux dot org> 0.4-alt1
- Remove *-tuning packages
- Keep initscripts for oracle-db and oracle-lsnr only
- Update scripts (!)
- Add menu
- Remove locale fix for oracle user
- User oracle is regular user now

* Mon Oct 17 2005 Igor Muratov <migor at altlinux dot org> 0.3-alt3
- Spec clanup

* Fri Jul 29 2005 Igor Muratov <migor at altlinux dot org> 0.3-alt2
- Fix for bug #7498

* Mon Jul  19 2004 Yury Shramko <yshr at altlinux dot ru> 0.3-alt1
- Add support for 10g 

* Fri Aug  8 2003 Igor Muratov <migor at altlinux dot ru> 0.2-alt6
- Fix useradd options in package preinstall script

* Thu Apr 10 2003 Igor Muratov <migor at altlinux dot ru> 0.2-alt5
- Add limits (by Michael Shigorin) at %post
- Add requirements for pdksh and libstdc++2.96 (by Michael Shigorin)
- Change oracle users's locale to en_EN

* Fri Dec 27 2002 Igor Muratov <migor at altlinux dot ru> 0.2-alt4
- Summary string at spec file fix
- Initscripts fix
- Initscript for CManager was removed

* Mon Nov 11 2002 Stanislav Ievlev <inger at altlinux dot ru> 0.2-alt3
- rebuild

* Mon May 27 2002 Igor Muratov <migor at altlinux dot ru> 0.2-alt2
- New script for Oracle Intellegent Agent
- New script for Oracle CManager
- Split to common and version depend packages
- Code cleanup

* Sat May 18 2002 Igor Muratov <migor at altlinux dot ru> 0.2-alt1
- New script for Apache http-server provided by Oracle
- Bugfix in oracledb

* Sun May  5 2002 Igor Muratov <migor at altlinux dot ru> 0.1-alt2
- Bugfix in README

* Sat May  4 2002 Igor Muratov <migor at altlinux dot ru> 0.1-alt1
- Initial spec file.