rpm.xe.scritplets.log

$ rpm -q --scripts oracle-xe-11.2.0-1.0 

preinstall scriptlet (using /bin/sh):

# Do not execute %pre section during upgrade

if [ "$1" != "1" -o -n "$2" ]
then
    exit 0
fi

# User must be root

if [ $(id -u) != "0" ]
then
    echo "You must be the root user to install the software" >&2
    exit 1
fi

# ORACLE_BASE must be unset
if `env | grep -q ORACLE_BASE`
then
        unset ORACLE_BASE
fi

if [ -f /etc/oratab ]
then
        if `grep -q ^XE: /etc/oratab`
        then
                echo "The install cannot proceed because a database instance named 'XE' is
        configured on the system.  Delete the instance, remove the entry corresponding
        to this instance from the oratab file (/etc/oratab), and retry the installation."
                exit 1
        fi
fi

# Check and disallow installation of 11.2XE, if /u01/app/oracle/product/11.2.0/xe directory
# exists and is not empty

if  [ -d /u01/app/oracle/product/11.2.0/xe ]
then
        if [ X"`ls -A /u01/app/oracle/product/11.2.0/xe`" != "X" ]
        then
        echo "The install cannot proceed because the directory \"/u01/app/oracle/product/11.2.0/xe\"
is not empty. Remove its contents and retry the installation."
        echo
        exit 1
        fi
fi

# Check and disallow if ORACLE_BASE directory /u01/app/oracle exists and not owned by oracle:dba

if [ -d /u01/app/oracle ]
then
        if [ "`ls -ld /u01/app/oracle | grep ^d | awk '{ print $3}'`" != "oracle" ]
        then
        echo
        echo "The install cannot proceed because ORACLE_BASE directory (/u01/app/oracle)
is not owned by \"oracle\" user. You must change the ownership of ORACLE_BASE
directory to \"oracle\" user and retry the installation."
        echo
        exit 1
        fi
fi

if [ -d /u01/app/oracle ]
then
        if [ "`ls -ld /u01/app/oracle | grep ^d | awk '{ print $4}'`" != "dba" ]
        then
        echo
        echo "The install cannot proceed because ORACLE_BASE directory (/u01/app/oracle)
is not owned by \"dba\" group. You must change the ownership of
ORACLE_BASE directory to \"dba\" group and retry the installation."
        echo
        exit 1
        fi
fi

# Check and change /u01,/u01/app,/u01/app/oracle,/u01/app/oracle/product,/u01/app/oracle/product/11.2.0
# and /u01/app/oracle/product/11.2.0/xe directory permissions to 755 if it is less.

if [ -d /u01  ]
then
        if test `stat -c "%a" /u01` -lt 755
        then
                chmod 755 /u01
        fi
fi

if [ -d /u01/app ]
then
        if test `stat -c "%a" /u01/app` -lt 755
        then
                chmod 755 /u01/app
        fi
fi

if [ -d /u01/app/oracle ]
then
        if test `stat -c "%a" /u01/app/oracle` -lt 755
        then
                chmod 755 /u01/app/oracle
        fi
fi

if [ -d /u01/app/oracle/product ]
then
        if test `stat -c "%a" /u01/app/oracle/product` -lt 755
        then
                chmod 755 /u01/app/oracle/product
        fi
fi

if [ -d /u01/app/oracle/product/11.2.0 ]
then
        if test `stat -c "%a" /u01/app/oracle/product/11.2.0` -lt 755
        then
                chmod 755 /u01/app/oracle/product/11.2.0
        fi
fi

if [ -d /u01/app/oracle/product/11.2.0/xe ]
then
        if test `stat -c "%a" /u01/app/oracle/product/11.2.0/xe` -lt 755
        then
                chmod 755 /u01/app/oracle/product/11.2.0/xe
        fi
fi

# Check and disallow for 1.5GB diskspace is not present on the system
if [ -d /u01/app/oracle ]
then
        diskspace=`df -k /u01/app/oracle | grep % | tr -s " " | cut -d" " -f4 | tail -1`
        diskspace=`expr $diskspace / 1024`
        if [ $diskspace -lt 1536 ]
        then
        echo "You have insufficient diskspace in the destination directory (/u01/app/oracle)
to install Oracle Database 11g Express Edition.  The installation requires at
least 1.5 GB free on this disk."
        exit 1
        fi
elif [ -d /u01/app ]
then
        diskspace=`df -k /u01/app | grep % | tr -s " " | cut -d" " -f4 | tail -1`
        diskspace=`expr $diskspace / 1024`
        if [ $diskspace -lt 1536 ]
        then
        echo "You have insufficient diskspace in the destination directory (/u01/app) to
install Oracle Database 11g Express Edition.  The installation requires at
least 1.5 GB free on this disk."
        exit 1
        fi
elif [ -d /u01 ]
then
        diskspace=`df -k /u01 | grep % | tr -s " " | cut -d" " -f4 | tail -1`
        diskspace=`expr $diskspace / 1024`
        if [ $diskspace -lt 1536 ]
        then
        echo "You have insufficient diskspace in the destination directory (/u01) to
install Oracle Database 11g Express Edition.  The installation requires at
least 1.5 GB free on this disk."
        exit 1
        fi
else
        diskspace=`df -k / | grep % | tr -s " " | cut -d" " -f4 | tail -1`
        diskspace=`expr $diskspace / 1024`
        if [ $diskspace -lt 1536 ]
        then
        echo "You have insufficient diskspace to install Oracle Database 11g Express Edition.
 The installation requires at least 1.5 GB free diskspace."
        exit 1
        fi
fi

# Check and disallow install, if RAM is less than 256 MB
space=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'`
PhyMem=`expr $space / 1024`
swapspace=`free -m | grep Swap | awk '{print $4}'`

if [ $PhyMem -lt 256 ]
then
        echo "Oracle Database 11g Express Edition requires a minimum of 256 MB of physical
memory (RAM).  This system has $PhyMem MB of RAM and does not meet minimum
requirements."
        echo
        exit 1
fi

reqswapspace=`echo 2 \* $PhyMem | bc`

min() {
    echo "$@" | tr '[[:space:]]' '\n' \
     | grep -Ee '^-?[[:digit:],]*(.[[:digit:]]+)?$' \
     | sort -n | sed 1q
}

requiredswapspace=`min 2047 $reqswapspace`

# check and disallow install, if swap space is less than Min( 2047, 2 * RAM)
if [ $swapspace -lt $requiredswapspace ]
then
        if [ "$requiredswapspace" = "2047" ];
        then
                requiredswapspace=2048
        fi
        echo
        echo "This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, Oracle Database 11g
Express Edition requires $requiredswapspace MB of swap space. This system has $swapspace MB
of swap space.  Configure more swap space on the system and retry the
installation."
        echo
        exit 1
fi

# Check and Update Kernel parameters
semmsl=`cat /proc/sys/kernel/sem | awk '{print $1}'`
semmns=`cat /proc/sys/kernel/sem | awk '{print $2}'`
semopm=`cat /proc/sys/kernel/sem | awk '{print $3}'`
semmni=`cat /proc/sys/kernel/sem | awk '{print $4}'`
shmmax=`cat /proc/sys/kernel/shmmax`
shmmni=`cat /proc/sys/kernel/shmmni`
shmall=`cat /proc/sys/kernel/shmall`
filemax=`cat /proc/sys/fs/file-max`
ip_local_port_range_lb=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $1}'`
ip_local_port_range_ub=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $2}'`

change=no
if [ $semmsl -lt 250 ]
then
        semmsl=250
        change=yes
fi

if [ $semmns -lt 32000 ]
then
        semmns=32000
        change=yes
fi

if [ $semopm -lt 100 ]
then
        semopm=100
        change=yes
fi
if [ $semmni -lt 128 ]
then
        semmni=128
        change=yes
fi

if [ "$change" != "no" ]
then
        echo "###########" >> /etc/sysctl.conf
        echo "# Oracle Database 11g Express Edition Recommended Values" >> /etc/sysctl.conf
        /sbin/sysctl -w kernel.sem="$semmsl $semmns $semopm $semmni" >> /etc/sysctl.conf
fi

changeshmmax=no
if [ $shmmax -lt 4294967295 ]
then
        shmmax=4294967295
        changeshmmax=yes
fi

changeshmmni=no
if [ $shmmni -lt 4096 ]
then
        shmmni=4096
        changeshmmni=yes
fi

changeshmall=no
if [ $shmall -lt 2097152 ]
then
         shmall=2097152
         changeshmall=yes
fi

changefilemax=no
if [ $filemax -lt 6815744 ]
then
        filemax=6815744
        changefilemax=yes
fi

if [ "$changeshmmax" != "no" ]
then
        /sbin/sysctl -w kernel.shmmax="4294967295" >> /etc/sysctl.conf
fi

if [ "$changeshmmni" != "no" ]
then
        /sbin/sysctl -w kernel.shmmni="4096" >> /etc/sysctl.conf
fi

if [ "$changeshmall" != "no" ]
then
         /sbin/sysctl -w kernel.shmall="2097152" >> /etc/sysctl.conf
fi

if [ "$changefilemax" != "no" ]
then
        /sbin/sysctl -w fs.file-max="6815744" >> /etc/sysctl.conf
fi

changeport=no
if [ $ip_local_port_range_lb -lt 9000 ]
then
        changeport=yes
        ip_local_port_range_lb=9000
fi

if [ $ip_local_port_range_ub -gt 65500 ]
then
        ip_local_port_range_ub=65000
        changeport=yes
fi

if [ "$changeport" != "no" ]
then
        /sbin/sysctl -w net.ipv4.ip_local_port_range="$ip_local_port_range_lb $ip_local_port_range_ub" >> /etc/sysctl.conf
fi

if [ "$change" != "no" ] || [ "$changeport" != "no" ] || [ "$changeshmmax" != "no" ] || [ "$changeshmmni" != "no" ] || [ "$changeshmall" != "no" ] || [ "$changefilemax" != "no" ]
then
        echo "########" >> /etc/sysctl.conf
        /sbin/sysctl -e -p > /dev/null
fi
postinstall scriptlet (using /bin/sh):

echo "Executing post-install steps..."

if [ "$1" = "1"  -o -z "$2" ]  # first install
then
        if `grep -q -i ^dba: /etc/group`
        then
                echo ""
        else
                /usr/sbin/groupadd dba
        fi
        id oracle > /dev/null 2>&1
        status=$?
        if test $status -eq 0
        then
                groups oracle | grep dba > /dev/null
                status=$?
                if test $status != 0
                then
                        /usr/sbin/usermod -G dba oracle
                fi
        else
                /usr/sbin/useradd -M -g dba -d /u01/app/oracle -s /bin/bash oracle
        fi


        # Creating the required symbolic links,directories and instantiatation
        if [ ! -d /u01/app/oracle/product/11.2.0/xe/config/log ]
        then
                mkdir -p /u01/app/oracle/product/11.2.0/xe/config/log
        fi

        if [ ! -d /u01/app/oracle/product/11.2.0/xe/rdbms/audit ]
        then
                mkdir -p /u01/app/oracle/product/11.2.0/xe/rdbms/audit
        fi

        if [ ! -d /u01/app/oracle/product/11.2.0/xe/rdbms/log ]
        then
                mkdir -p /u01/app/oracle/product/11.2.0/xe/rdbms/log
        fi

        if [ ! -d /u01/app/oracle/product/11.2.0/xe/network/trace ]
        then
                mkdir -p /u01/app/oracle/product/11.2.0/xe/network/trace
        fi

        if [ ! -d /u01/app/oracle/product/11.2.0/xe/network/log ]
        then
                mkdir -p /u01/app/oracle/product/11.2.0/xe/network/log
        fi

        cd /u01/app/oracle/product/11.2.0/xe/lib
        if [ ! -h /u01/app/oracle/product/11.2.0/xe/lib/libclntsh.so ]
        then
                ln -s libclntsh.so.11.1 libclntsh.so
        fi
        if [ ! -h /u01/app/oracle/product/11.2.0/xe/lib/libocci.so ]
        then
                ln -s libocci.so.11.1 libocci.so
        fi
        if [ ! -h /u01/app/oracle/product/11.2.0/xe/lib/libagtsh.so ]
        then
                ln -s libagtsh.so.1.0 libagtsh.so
        fi

        sed -i "s/%ORACLE_HOME%/\/u01\/app\/oracle\/product\/11.2.0\/xe/" /u01/app/oracle/product/11.2.0/xe/rdbms/admin/dbmssml.sql
        sed -i "s/%SO_EXT%/so/" /u01/app/oracle/product/11.2.0/xe/rdbms/admin/dbmssml.sql
        sed -i "s/%ORACLE_HOME%/\/u01\/app\/oracle\/product\/11.2.0\/xe/g" /u01/app/oracle/product/11.2.0/xe/config/scripts/postScripts.sql

        # Remove -lipgo and -lsvml from sysliblist as they were not shipped in 11.2XE
        sed -i "s/-lipgo //" /u01/app/oracle/product/11.2.0/xe/lib/sysliblist
        sed -i "s/ -lsvml//" /u01/app/oracle/product/11.2.0/xe/lib/sysliblist

        availphymem=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'`
        availphymem=`echo $availphymem / 1024 | bc`
        memory_target=`echo 0.40 \* $availphymem | bc | sed "s/\..*//"`
        if [ $memory_target -gt 1024 ];
        then
                memory_target=`echo 1024 \* 1048576 | bc`
        else
                memory_target=`echo $memory_target \* 1048576 | bc`
        fi

        /bin/sed -i "s/%memory_target%/$memory_target/g" /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
        /bin/sed -i "s/%memory_target%/$memory_target/g" /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora

fi

/bin/chown oracle:dba /u01/app/oracle
/bin/chown -R oracle:dba /u01/app/oracle/product/11.2.0/xe
/bin/chmod 755 /u01/app/oracle
/bin/chmod 755 /u01/app/oracle/product
/bin/chmod 755 /u01/app/oracle/product/11.2.0
/bin/chmod -R 755 /u01/app/oracle/product/11.2.0/xe
/sbin/ldconfig >/dev/null
/bin/chown oracle:dba /u01/app/oracle
/bin/chown -R oracle:dba /u01/app/oracle/product/11.2.0/xe
/bin/chmod 755 /u01/app/oracle
/bin/chmod 755 /u01/app/oracle/product
/bin/chmod 755 /u01/app/oracle/product/11.2.0
/bin/chmod -R 755 /u01/app/oracle/product/11.2.0/xe

/bin/chmod 755 /etc/init.d/oracle-xe

if [ -f /etc/SuSE-release ]
then
        cp -f /u01/app/oracle/product/11.2.0/xe/config/scripts/oracle-xe.sles /etc/init.d/oracle-xe
        /usr/lib/lsb/install_initd /etc/init.d/oracle-xe > /dev/null 2>&1
        /sbin/insserv /etc/init.d/oracle-xe > /dev/null 2>&1
        /sbin/SuSEconfig > /dev/null 2>&1
else
        /sbin/chkconfig --add oracle-xe
fi

/bin/chmod 6751 /u01/app/oracle/product/11.2.0/xe/bin/oracle
/bin/chmod 751 /u01/app/oracle/product/11.2.0/xe/bin/sqlplus

if [ "$1" = "1"  -o -z "$2" ]  # first install
then
        # Start Menu icons

        if test -d  /etc/kde/xdg/menus/OracleXE
        then
                echo ""
        else
                mkdir -p /etc/kde/xdg/menus/OracleXE/GetHelp
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/.directory ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/.directory
                ln -s /usr/share/desktop-menu-files/oraclexe-11g.directory /etc/kde/xdg/menus/OracleXE/.directory
        else
                ln -s /usr/share/desktop-menu-files/oraclexe-11g.directory /etc/kde/xdg/menus/OracleXE/.directory
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-startdb.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-startdb.desktop
                ln -s /usr/share/applications/oraclexe-startdb.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-startdb.desktop
        else
                ln -s /usr/share/applications/oraclexe-startdb.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-startdb.desktop
        fi


        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-stopdb.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-stopdb.desktop
                ln -s /usr/share/applications/oraclexe-stopdb.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-stopdb.desktop
        else
                ln -s /usr/share/applications/oraclexe-stopdb.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-stopdb.desktop
        fi
        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-runsql.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-runsql.desktop
                ln -s /usr/share/applications/oraclexe-runsql.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-runsql.desktop
        else
                ln -s /usr/share/applications/oraclexe-runsql.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-runsql.desktop
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-backup.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-backup.desktop
                ln -s /usr/share/applications/oraclexe-backup.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-backup.desktop
        else
                ln -s /usr/share/applications/oraclexe-backup.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-backup.desktop
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-restore.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-restore.desktop
                ln -s /usr/share/applications/oraclexe-restore.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-restore.desktop
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/oraclexe-getstarted.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/oraclexe-getstarted.desktop
                ln -s /usr/share/applications/oraclexe-getstarted.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-getstarted.desktop
        else
                ln -s /usr/share/applications/oraclexe-getstarted.desktop /etc/kde/xdg/menus/OracleXE/oraclexe-getstarted.desktop
        fi


        if [ -f /etc/kde/xdg/menus/OracleXE/GetHelp/.directory ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/GetHelp/.directory
                ln -s /usr/share/desktop-menu-files/oraclexe-gethelp.directory /etc/kde/xdg/menus/OracleXE/GetHelp/.directory
        else
                ln -s /usr/share/desktop-menu-files/oraclexe-gethelp.directory /etc/kde/xdg/menus/OracleXE/GetHelp/.directory
        fi
        if [ -f /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-registerforonlineforum.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-registerforonlineforum.desktop
                ln -s /usr/share/applications/oraclexe-registerforonlineforum.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-registerforonlineforum.desktop
        else
                ln -s /usr/share/applications/oraclexe-registerforonlineforum.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-registerforonlineforum.desktop
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-readdocumentation.desktop ]
        then
                rm -fr  /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-readdocumentation.desktop
                ln -s /usr/share/applications/oraclexe-readdocumentation.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-readdocumentation.desktop
        else
                ln -s /usr/share/applications/oraclexe-readdocumentation.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-readdocumentation.desktop
        fi

        if [ -f /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-gotoonlineforum.desktop ]
        then
                rm -fr /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-gotoonlineforum.desktop
                ln -s /usr/share/applications/oraclexe-gotoonlineforum.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-gotoonlineforum.desktop
        else
                ln -s /usr/share/applications/oraclexe-gotoonlineforum.desktop /etc/kde/xdg/menus/OracleXE/GetHelp/oraclexe-gotoonlineforum.desktop
        fi
        if [ -f /etc/xdg/menus/applications.menu ]
        then
                cp -f /usr/share/desktop-menu-files/oraclexe-11g.directory /usr/share/desktop-directories/oraclexe-11g.directory
                cp -f /usr/share/desktop-menu-files/oraclexe-gethelp.directory /usr/share/desktop-directories/oraclexe-gethelp.directory
                cp -f /u01/app/oracle/product/11.2.0/xe/config/scripts/oraclexe.menu /etc/xdg/menus
                sed -i '1,// { // r /u01/app/oracle/product/11.2.0/xe/config/scripts/oraclexe-merge.menu
                }' /etc/xdg/menus/applications.menu

        fi

        homedir=`echo $HOME`

        if [ "$homedir" != "/root" ]
        then
                loginuser=`who | cut -d' ' -f1 | uniq | sed -n '1p'`
                if [ -d $homedir/.gnome-desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "cp -f /usr/share/applications/oraclexe-gettingstarted.desktop $homedir/.gnome-desktop"
                fi
                if [ -d $homedir/Desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "cp -f /usr/share/applications/oraclexe-gettingstarted.desktop $homedir/Desktop"
                fi
        else
                loginuser=`who | cut -d' ' -f1 | uniq | sed -n '1p'`
                homedir=`sh -c "echo ~$loginuser"`
                if [ -d $homedir/.gnome-desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "cp -f /usr/share/applications/oraclexe-gettingstarted.desktop $homedir/.gnome-desktop"
                fi
                if [ -d $homedir/Desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "cp -f /usr/share/applications/oraclexe-gettingstarted.desktop $homedir/Desktop"
                fi
        fi

fi
rm -fr /u01/app/oracle/screenrc
rm -fr /u01/app/oracle/gtkrc
rm -fr /u01/app/oracle/emacs
rm -fr /u01/app/oracle/cshrc-DEFAULT_old
rm -fr /u01/app/oracle/cshrc-DEFAULT.06292004
rm -fr /u01/app/oracle/cshrc-DEFAULT
rm -fr /u01/app/oracle/cshrc
rm -fr /u01/app/oracle/bashrc-DEFAULT
rm -fr /u01/app/oracle/bashrc_logout

# Implenting setowner.sh script operations in the spec file, since it has
# dependency on rootmacro.sh script which is not shipped in 11.2XE

if [ ! -d /var/tmp/.oracle ]
then
  mkdir -p /var/tmp/.oracle;
fi

chmod 01777 /var/tmp/.oracle
chown root  /var/tmp/.oracle

if [ ! -d /tmp/.oracle ]
then
  mkdir -p /tmp/.oracle;
fi

chmod 01777 /tmp/.oracle
chown root  /tmp/.oracle

# setowner.sh operations ends here

CONFIGURATION=/etc/sysconfig/oracle-xe

[ -f "$CONFIGURATION" ] && . "$CONFIGURATION"

if [ "$CONFIGURE_RUN" != "true" ]
then
    echo -e "You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database."
    echo
fi
preuninstall scriptlet (using /bin/sh):

if [ "$1" = "0" ] # last uninstall
then
        if [ -f /u01/app/oracle/product/11.2.0/xe/config/scripts/stopall.sh ]
        then
                sh /u01/app/oracle/product/11.2.0/xe/config/scripts/stopall.sh
        fi
        rm -f /u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora
        rm -f /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
        rm -f /u01/app/oracle/product/11.2.0/xe/config/scripts/postDBCreation.sql
        rm -f /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
        rm -f /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora
        if [ -f /etc/SuSE-release ]
        then
                /usr/lib/lsb/remove_initd /etc/init.d/oracle-xe > /dev/null 2>&1
                /sbin/SuSEconfig > /dev/null 2>&1
        else
                /sbin/chkconfig --del oracle-xe
        fi
        rm -f /etc/init.d/oracle-xe
fi
postuninstall scriptlet (using /bin/sh):

/sbin/ldconfig >/dev/null
if [ "$1" = "0" ]  # last uninstall
then

        if [ -f /etc/oratab ]
        then
                /bin/cp /etc/oratab /etc/oratab.xe
                /bin/sed -i -s '/XE:\/u01\/app\/oracle\/product\/11.2.0\/xe:N/d' /etc/oratab.xe
                /bin/cp /etc/oratab.xe /etc/oratab
                /bin/rm -f /etc/oratab.xe
        fi

        rm -fr /etc/sysconfig/oracle-xe

        if test -d /u01/app/oracle/oradata/XE
        then
                rm -fr /u01/app/oracle/oradata/XE
        fi
        if test -d /u01/app/oracle/oradata
        then
                rm -fr /u01/app/oracle/oradata
        fi
        if test -d /u01/app/oracle/admin/XE
        then
                rm -fr /u01/app/oracle/admin/XE
        fi
        if test -d /u01/app/oracle/flash_recovery_area/XE
        then
                rm -fr /u01/app/oracle/flash_recovery_area/XE
        fi
        if test -d /u01/app/oracle/flash_recovery_area
        then
                rm -fr /u01/app/oracle/flash_recovery_area
        fi
        if test -d /u01/app/oracle/admin/cfgtoollogs/dbca/XE
        then
                rm -fr /u01/app/oracle/admin/cfgtoollogs/dbca/XE
        fi
        if test -d /u01/app/oracle/admin/cfgtoollogs/dbca
        then
                rm -fr /u01/app/oracle/admin/cfgtoollogs/dbca
        fi
        if test -d /u01/app/oracle/admin
        then
                rm -fr /u01/app/oracle/admin
        fi

        if test -d /u01/app/oracle/diag
        then
                rm -fr /u01/app/oracle/diag
        fi

        rm -fr /u01/app/oracle/product/11.2.0/xe
        rm -fr /u01/app/oracle/doc
        rm -fr /usr/share/doc/oracle_xe
        rm -fr /usr/share/desktop-menu-files/oraclexe-11g.directory
        rm -fr /usr/share/desktop-menu-files/oraclexe-gethelp.directory
        rm -fr /etc/kde/xdg/menus/OracleXE
        rm -fr /usr/share/gnome/vfolders/oraclexe-11g.directory
        rm -fr /usr/share/gnome/vfolders/oraclexe-gethelp.directory


        if [ -f /etc/xdg/menus/applications.menu ]
        then
                rm -f /usr/share/desktop-directories/oraclexe-11g.directory
                rm -f /usr/share/desktop-directories/oraclexe-gethelp.directory
                rm -f /etc/xdg/menus/oraclexe.menu

                sed -i '//,//d' /etc/xdg/menus/applications.menu

        elif [ -f /etc/X11/desktop-menus/applications.menu ]
        then
                sed -i '//,//d' /etc/X11/desktop-menus/applications.menu
        elif [ -f /etc/xdg/menus/applications-merged/kde-essential.menu ]
        then
                rm -f /usr/share/desktop-directories/oraclexe-11g.directory
                rm -f /usr/share/desktop-directories/oraclexe-gethelp.directory
                rm -f /etc/xdg/menus/oraclexe.menu
                sed -i '//,//d' /etc/xdg/menus/applications-merged/kde-essential.menu
        fi

        homedir=`echo $HOME`

        if [ "$homedir" != "/root" ]
        then
                loginuser=`who | cut -d' ' -f1 | uniq | sed -n '1p'`
                if [ -d $homedir/.gnome-desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "rm -f  $homedir/.gnome-desktop/oraclexe-gettingstarted.desktop"
                fi
                if [ -d $homedir/Desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "rm -f $homedir/Desktop/oraclexe-gettingstarted.desktop"
                fi
        else
                loginuser=`who | cut -d' ' -f1 | uniq | sed -n '1p'`
                homedir=`sh -c "echo ~$loginuser"`
                if [ -d $homedir/.gnome-desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "rm -f $homedir/.gnome-desktop/oraclexe-gettingstarted.desktop"
                fi
                if [ -d $homedir/Desktop ]
                then
                        /bin/su -s /bin/sh $loginuser -c "rm -f $homedir/Desktop/oraclexe-gettingstarted.desktop"
                fi
        fi

fi
$
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: