OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src openpkg-web          Date:   07-Feb-2003 17:11:10
  Branch: HEAD                             Handle: 2003020716110702

  Modified files:
    openpkg-src/oracle      oracle.spec rc.oracle
    openpkg-web             news.txt

  Log:
    Yeah, I always wanted to fully blind package a commercial software.
    Now done once and the last time in my life for ORACLE RDBMS. Let's see
    how all of my guessing and testing works in practice... Yes, you read
    correctly: I've no ORACLE installation at hand and so all this stuff was
    done on the green meadow.

  Summary:
    Revision    Changes     Path
    1.2         +164 -14    openpkg-src/oracle/oracle.spec
    1.2         +12 -3      openpkg-src/oracle/rc.oracle
    1.3227      +1  -0      openpkg-web/news.txt
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/oracle/oracle.spec
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 oracle.spec
  --- openpkg-src/oracle/oracle.spec    7 Feb 2003 13:55:47 -0000       1.1
  +++ openpkg-src/oracle/oracle.spec    7 Feb 2003 16:11:09 -0000       1.2
  @@ -36,8 +36,11 @@
   Release:      20030207
   
   #   package options
  -%option       with_oracle_base  /opt/oracle
  -%option       with_oracle_home  /opt/oracle/product/oracle
  +%option       with_oracle_owner   none
  +%option       with_oracle_base    none
  +%option       with_oracle_home    none
  +%option       with_oracle_incdir  none
  +%option       with_oracle_libdir  none
   
   #   list of sources
   Source0:      rc.oracle
  @@ -61,20 +64,164 @@
   %install
       rm -rf $RPM_BUILD_ROOT
   
  -    #   check paths to ORACLE
  +    #   determine ORACLE_OWNER
  +    l_oracle_owner="%{with_oracle_owner}"
  +    if [ ".$l_oracle_owner" = .none ]; then
  +        for user in oracle ora; do
  +            pw=`(cat /etc/passwd; ypcat passwd) 2>/dev/null | grep "^$user:" | head 
-1`
  +            if [ ".$pw" != . ]; then
  +                l_oracle_owner="$user"
  +                break
  +            fi
  +        done
  +    fi
  +
  +    #   determine ORACLE base directory ($ORACLE_BASE)
       l_oracle_base="%{with_oracle_base}"
  +    owner_dir="/oracle"
  +    if [ ".$l_oracle_owner" != .none ]; then
  +        dir=`(cat /etc/passwd; ypcat passwd) 2>/dev/null | grep "^$l_oracle_owner:" 
|\
  +             head -1 | sed -e 's;^.*:\([^:][^:]*\):[^:]*$;\1;' | sed -e 
's;^[^/].*$;;'`
  +        if [ ".$dir" != . ]; then
  +            owner_dir="$dir"
  +        fi
  +    fi
  +    if [ ".$l_oracle_base" = .none ]; then
  +        for dir in \
  +            $owner_dir \
  +            /oracle \
  +            /home/oracle \
  +            /export/oracle \
  +            /usr/oracle \
  +            /usr/local/oracle \
  +            /opt/oracle \
  +            /opt/local/oracle \
  +            /app/oracle \
  +            /u01/app/oracle \
  +            /u02/app/oracle \
  +            /u03/app/oracle \
  +            /u04/app/oracle \
  +        do
  +            if [ -d "$dir/product" ]; then
  +                l_oracle_base="$dir"
  +                break
  +            fi
  +        done
  +        if [ ".$l_oracle_base" = .none ]; then
  +           ( echo "ORACLE_BASE directory not found on system."
  +             echo "Please provide correct path with option with_oracle_base."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    else
  +        if [ ! -d "$l_oracle_base" ]; then
  +           ( echo "ORACLE_BASE directory \"$l_oracle_base\" not existing."
  +             echo "Please provide correct path with option with_oracle_base."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +        if [ ! -d "$l_oracle_base/product" ]; then
  +           ( echo "ORACLE_BASE directory \"$l_oracle_base\" does not contain 
\"product\ subdirectory."
  +             echo "Please provide correct path with option with_oracle_base."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    fi
  +
  +    #   determine ORACLE home directory ($ORACLE_HOME)
       l_oracle_home="%{with_oracle_home}"
  -    if [ ! -d "$l_oracle_base" ]; then
  -       ( echo "ORACLE_BASE directory $l_oracle_base not found."
  -         echo "Please provide correct path with RPM option with_oracle_base"
  -       ) | %{l_rpmtool} msg -b -t error
  -       exit 1
  -    fi
  -    if [ ! -d "$l_oracle_home" ]; then
  -       ( echo "ORACLE_HOME directory $l_oracle_home not found."
  -         echo "Please provide correct path with RPM option with_oracle_home"
  -       ) | %{l_rpmtool} msg -b -t error
  -       exit 1
  +    if [ ".$l_oracle_home" = .none ]; then
  +        for dir in $l_oracle_base/product/[0-9]*; do
  +            if [ -d "$dir/rdbms" ]; then
  +                l_oracle_home="$dir"
  +                break
  +            fi
  +        done
  +        if [ ".$l_oracle_home" = .none ]; then
  +           ( echo "ORACLE_HOME directory not found on system."
  +             echo "Please provide correct path with option with_oracle_home."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    else
  +        if [ ! -d "$l_oracle_home" ]; then
  +           ( echo "ORACLE_HOME directory \"$l_oracle_base\" not existing."
  +             echo "Please provide correct path with option with_oracle_home."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +        if [ ! -d "$l_oracle_home/rdbms" ]; then
  +           ( echo "ORACLE_HOME directory \"$l_oracle_home\" does not contain 
\"rdbms\ subdirectory."
  +             echo "Please provide correct path with option with_oracle_home."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    fi
  +
  +    #   determine ORACLE C header directory
  +    l_oracle_incdir="%{with_oracle_incdir}"
  +    if [ ".$l_oracle_incdir" = .none ]; then
  +        for dir in $l_oracle_home/rdbms $l_oracle_home; do
  +            file=`find $dir -type f -name "oratypes.h" -print 2>/dev/null | head -1`
  +            if [ ".$file" != . ]; then
  +                if [ -f "$file" ]; then
  +                    l_oracle_incdir=`echo $file | sed -e 's;/oratypes\.h$;;'`
  +                    break
  +                fi
  +            fi
  +        done
  +        if [ ".$l_oracle_incdir" = .none ]; then
  +           ( echo "ORACLE C include directory not found on system."
  +             echo "Please provide correct path with option with_oracle_incdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    else
  +        if [ ! -d "$l_oracle_incdir" ]; then
  +           ( echo "ORACLE C include directory \"$l_oracle_incdir\" not existing."
  +             echo "Please provide correct path with option with_oracle_incdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +        if [ ! -f "$l_oracle_incdir/oratypes.h" ]; then
  +           ( echo "ORACLE C include directory \"$l_oracle_incdir\" does not contain 
\"oratypes.h\ header."
  +             echo "Please provide correct path with option with_oracle_incdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    fi
  +
  +    #   determine ORACLE C library directory
  +    l_oracle_libdir="%{with_oracle_libdir}"
  +    if [ ".$l_oracle_libdir" = .none ]; then
  +        for dir in $l_oracle_home/lib $l_oracle_home/*/lib; do
  +            file=`find $dir -type f -name "liboci.a" -print 2>/dev/null | head -1`
  +            if [ ".$file" != . ]; then
  +                if [ -f "$file" ]; then
  +                    l_oracle_libdir=`echo $file | sed -e 's;/liboci.a$;;'`
  +                    break
  +                fi
  +            fi
  +        done
  +        if [ ".$l_oracle_libdir" = .none ]; then
  +           ( echo "ORACLE C library directory not found on system."
  +             echo "Please provide correct path with option with_oracle_libdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +    else
  +        if [ ! -d "$l_oracle_libdir" ]; then
  +           ( echo "ORACLE C library directory \"$l_oracle_libdir\" not existing."
  +             echo "Please provide correct path with option with_oracle_libdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
  +        if [ ! -f "$l_oracle_libdir/liboci.a" ]; then
  +           ( echo "ORACLE C library directory \"$l_oracle_libdir\" does not contain 
\"liboci.a\ header."
  +             echo "Please provide correct path with option with_oracle_libdir."
  +           ) | %{l_rpmtool} msg -b -t error
  +           exit 1
  +        fi
       fi
   
       #   install rc file
  @@ -82,8 +229,11 @@
           $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
       %{l_shtool} install -c -m 755 \
           -e 's;@l_prefix@;%{l_prefix};g' \
  +        -e "s;@l_oracle_owner@;${l_oracle_owner};g" \
           -e "s;@l_oracle_base@;${l_oracle_base};g" \
           -e "s;@l_oracle_home@;${l_oracle_home};g" \
  +        -e "s;@l_oracle_incdir@;${l_oracle_incdir};g" \
  +        -e "s;@l_oracle_libdir@;${l_oracle_libdir};g" \
           %{SOURCE rc.oracle} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   
       %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/oracle/rc.oracle
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 rc.oracle
  --- openpkg-src/oracle/rc.oracle      7 Feb 2003 13:55:47 -0000       1.1
  +++ openpkg-src/oracle/rc.oracle      7 Feb 2003 16:11:09 -0000       1.2
  @@ -5,18 +5,27 @@
   
   %config
       oracle_enable="no"
  +    oracle_owner="@l_oracle_owner@"
       oracle_base="@l_oracle_base@"
       oracle_home="@l_oracle_home@"
  +    oracle_incdir="@l_oracle_incdir@"
  +    oracle_libdir="@l_oracle_libdir@"
   
   %info
  -    echo "Oracle Enable: ${oracle_enable}"
  -    echo "Oracle Base:   ${oracle_base}"
  -    echo "Oracle Home:   ${oracle_home}"
  +    echo "Oracle Enable:      ${oracle_enable}"
  +    echo "Oracle Owner:       ${oracle_owner}"
  +    echo "Oracle Base:        ${oracle_base}"
  +    echo "Oracle Home:        ${oracle_home}"
  +    echo "Oracle C Includes:  ${oracle_incdir}"
  +    echo "Oracle C Libraries: ${oracle_libdir}"
   
   %env
       if opServiceEnabled oracle; then 
  +        ORACLE_OWNER="${l_oracle_owner}"
  +        export ORACLE_OWNER
           ORACLE_BASE="${l_oracle_base}"
           export ORACLE_BASE
           ORACLE_HOME="${l_oracle_home}"
           export ORACLE_HOME
       fi
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-web/news.txt
  ============================================================================
  $ cvs diff -u -r1.3226 -r1.3227 news.txt
  --- openpkg-web/news.txt      7 Feb 2003 13:55:45 -0000       1.3226
  +++ openpkg-web/news.txt      7 Feb 2003 16:11:07 -0000       1.3227
  @@ -1,3 +1,4 @@
  +07-Feb-2003: Upgraded package: P<oracle-20030207-20030207>
   07-Feb-2003: New package: P<oracle-20030207-20030207>
   07-Feb-2003: Upgraded package: P<openpkg-tool-20030207-20030207>
   07-Feb-2003: Upgraded package: P<samba-2.2.7a-20030207>
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to