[Xedeb-commits] jlbec commits r23 - in trunk: debian/server override/server override/server/config override/server/config/scripts
svn-commits@oss.oracle.com
svn-commits at oss.oracle.com
Thu Feb 9 20:17:44 CST 2006
Author: jlbec
Date: 2006-02-09 20:17:42 -0600 (Thu, 09 Feb 2006)
New Revision: 23
Added:
trunk/debian/server/oracle-xe.default
trunk/override/server/config/
trunk/override/server/config/scripts/
trunk/override/server/config/scripts/oracle-xe
Modified:
trunk/debian/server/oracle-xe.conffiles
trunk/debian/server/postinst
trunk/debian/server/postrm
trunk/debian/server/preinst
trunk/debian/server/prerm
trunk/debian/server/rules
Log:
o Make the install steps support reinstalls and upgrades.
o Allow configuration files and the database to live after --remove.
Modified: trunk/debian/server/oracle-xe.conffiles
===================================================================
--- trunk/debian/server/oracle-xe.conffiles 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/oracle-xe.conffiles 2006-02-10 02:17:42 UTC (rev 23)
@@ -1,3 +1,6 @@
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/postDBCreation.sql
+/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/init.ora
+/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/initXETemp.ora
+/etc/default/oracle-xe
Added: trunk/debian/server/oracle-xe.default
===================================================================
--- trunk/debian/server/oracle-xe.default 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/oracle-xe.default 2006-02-10 02:17:42 UTC (rev 23)
@@ -0,0 +1,3 @@
+#
+# Please run "/etc/init.d/oracle-xe configure" to configure Oracle XE.
+#
Modified: trunk/debian/server/postinst
===================================================================
--- trunk/debian/server/postinst 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/postinst 2006-02-10 02:17:42 UTC (rev 23)
@@ -1,135 +1,159 @@
#!/bin/sh
-#DEBHELPER#
-
-echo "Executing Post-install steps..."
-if `grep -q ^dba: /etc/group`
+if [ "$1" != "configure" ]
then
- echo ""
-else
- /usr/sbin/groupadd dba
+ exit 0
fi
-id oracle > /dev/null 2>&1
-status=$?
-if test $status -eq 0
+
+if [ -z "$2" ]
then
- groups oracle | grep dba > /dev/null
- status=$?
- if test $status != 0
- then
- /usr/sbin/usermod -G dba oracle
- fi
+ MODE=install
else
- /usr/sbin/useradd -g dba -d /usr/lib/oracle/xe -s /bin/bash oracle
+ MODE=upgrade
fi
-/bin/chown -R oracle:dba /usr/lib/oracle/xe
+#DEBHELPER#
-# SGA & PGA algo
-sgamin=146800640
-pgamin=16777216
-sgamax=805306368
-pgamax=268435456
-TM=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'`
-TM=`echo $TM / 1024 | bc`
-TM=`echo 0.40 \* $TM | bc | sed "s/\..*//"`
-TMSP=`echo $TM-40 | bc`
-sga_target=`echo 0.75 \* $TMSP | bc`
-pga_target=`echo 0.25 \* $TMSP | bc `
-sga=`echo $sga_target \* 1048576 | bc | sed "s/\..*//"`
-pga=`echo $pga_target \* 1048576 | bc | sed "s/\..*//"`
-check=`echo $sga \< $sgamin | bc`
-if test $check != 0
-then
- sga=$sgamin
-fi
+echo "Executing Post-install steps..."
-check=`echo $pga \< $pgamin | bc`
-if test $check != 0
+if [ "$MODE" = "install" ]
then
- pga=$pgamin
-fi
+ if `grep -q ^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 -g dba -d /usr/lib/oracle/xe -s /bin/bash oracle
+ fi
-if test `echo $sga + $pga \> $sgamax + $pgamax | bc`
-then
- check=`echo $sga \> $sgamax | bc`
- if test $check != 0
- then
- sga=$sgamax
- fi
+ # SGA & PGA algo
+ sgamin=146800640
+ pgamin=16777216
+ sgamax=805306368
+ pgamax=268435456
+ TM=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'`
+ TM=`echo $TM / 1024 | bc`
+ TM=`echo 0.40 \* $TM | bc | sed "s/\..*//"`
+ TMSP=`echo $TM-40 | bc`
+ sga_target=`echo 0.75 \* $TMSP | bc`
+ pga_target=`echo 0.25 \* $TMSP | bc `
+ sga=`echo $sga_target \* 1048576 | bc | sed "s/\..*//"`
+ pga=`echo $pga_target \* 1048576 | bc | sed "s/\..*//"`
+ check=`echo $sga \< $sgamin | bc`
+ if test $check != 0
+ then
+ sga=$sgamin
+ fi
+
+ check=`echo $pga \< $pgamin | bc`
+ if test $check != 0
+ then
+ pga=$pgamin
+ fi
+
+ if test `echo $sga + $pga \> $sgamax + $pgamax | bc`
+ then
+ check=`echo $sga \> $sgamax | bc`
+ if test $check != 0
+ then
+ sga=$sgamax
+ fi
+
+ check=`echo $pga \> $pgamax | bc`
+ if test $check != 0
+ then
+ pga=$pgamax
+ fi
+ fi
+
+ # init.ora parameters instantiation
+
+ /bin/sed -i "s/%sga_target%/$sga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/init.ora
+ /bin/sed -i "s/%pga_aggregate_target%/$pga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/init.ora
+ /bin/sed -i "s/%sga_target%/$sga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/initXETemp.ora
+ /bin/sed -i "s/%pga_aggregate_target%/$pga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/initXETemp.ora
+
- check=`echo $pga \> $pgamax | bc`
- if test $check != 0
- then
- pga=$pgamax
- fi
-fi
+# End MODE=install
+fi
-# init.ora parameters instantiation
+/bin/chown -R oracle:dba /usr/lib/oracle/xe
-/bin/sed -i "s/%sga_target%/$sga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/init.ora
-/bin/sed -i "s/%pga_aggregate_target%/$pga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/init.ora
-/bin/sed -i "s/%sga_target%/$sga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/initXETemp.ora
-/bin/sed -i "s/%pga_aggregate_target%/$pga/g" /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/initXETemp.ora
-
/bin/chmod 6751 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle
/bin/chmod 755 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus
-# Start Menu icons
-
-mergefile()
-{
- MENUFILE="$1"
-
- if [ -z "$MENUFILE" ]
+if [ "$MODE" = "install" ]
+then
+ # Start Menu icons
+
+ mergefile()
+ {
+ MENUFILE="$1"
+
+ if [ -z "$MENUFILE" ]
+ then
+ return
+ fi
+
+ TFILE="$(mktemp)" || TFILE="/tmp/xeapplications.tmp"
+ (sed -n '1,/<\/Menu>/p' "$MENUFILE" ; cat /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/oraclexe-merge.menu ; sed -n '1,/<\/Menu>/!p' "$MENUFILE" ) > "$TFILE"
+ cp -f "$TFILE" "$MENUFILE"
+ rm -f "$TFILE"
+ }
+
+ if [ -f /etc/xdg/menus/gnome-applications.menu ]
then
- return
+ mergefile /etc/xdg/menus/gnome-applications.menu
fi
+ if [ -f /etc/xdg/menus/kde-applications.menu ]
+ then
+ mergefile /etc/xdg/menus/kde-applications.menu
+ fi
+ if [ -f /etc/xdg/menus/applications.menu ]
+ then
+ mergefile /etc/xdg/menus/applications.menu
+ fi
+
+ homedir=`echo $HOME`
+ if [ "$homedir" = "/root" ]
+ then
+ homedir=`sh -c "echo ~$USER"`
+ fi
+
+ home=`echo $homedir | cut -d "/" -f2`
+
+ drive=`df -l \/$home | head -2 | tail -1 | awk '{print $1}'`
+ check=`expr match "$drive" '\(^/dev*\)'`
+ if [ "$check" != "" ];
+ then
+ if [ "$homedir" != "/root" ]
+ then
+ if [ -d $homedir/.gnome-desktop ]
+ then
+ cp -f /usr/share/applications/oraclexe-getstarteddesktop.desktop $homedir/.gnome-desktop
+ fi
+ if [ -d $homedir/Desktop ]
+ then
+ cp -f /usr/share/applications/oraclexe-getstarteddesktop.desktop $homedir/Desktop
+ fi
+ fi
+ fi
- TFILE="$(mktemp)" || TFILE="/tmp/xeapplications.tmp"
- (sed -n '1,/<\/Menu>/p' "$MENUFILE" ; cat /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/oraclexe-merge.menu ; sed -n '1,/<\/Menu>/!p' "$MENUFILE" ) > "$TFILE"
- cp -f "$TFILE" "$MENUFILE"
- rm -f "$TFILE"
-}
-
-if [ -f /etc/xdg/menus/gnome-applications.menu ]
-then
- mergefile /etc/xdg/menus/gnome-applications.menu
+# End MODE=install
fi
-if [ -f /etc/xdg/menus/kde-applications.menu ]
-then
- mergefile /etc/xdg/menus/kde-applications.menu
-fi
-if [ -f /etc/xdg/menus/applications.menu ]
-then
- mergefile /etc/xdg/menus/applications.menu
-fi
-
-homedir=`echo $HOME`
-if [ "$homedir" = "/root" ]
-then
- homedir=`sh -c "echo ~$USER"`
-fi
-
-home=`echo $homedir | cut -d "/" -f2`
-
-drive=`df -l \/$home | head -2 | tail -1 | awk '{print $1}'`
-check=`expr match "$drive" '\(^/dev*\)'`
-if [ "$check" != "" ];
-then
- if [ "$homedir" != "/root" ]
- then
- if [ -d $homedir/.gnome-desktop ]
- then
- cp -f /usr/share/applications/oraclexe-getstarteddesktop.desktop $homedir/.gnome-desktop
- fi
- if [ -d $homedir/Desktop ]
- then
- cp -f /usr/share/applications/oraclexe-getstarteddesktop.desktop $homedir/Desktop
- fi
- fi
-fi
-
+
rm -fr /usr/lib/oracle/screenrc
rm -fr /usr/lib/oracle/gtkrc
rm -fr /usr/lib/oracle/emacs
@@ -140,12 +164,15 @@
rm -fr /usr/lib/oracle/bashrc-DEFAULT
rm -fr /usr/lib/oracle/bashrc_logout
rm -fr /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/admin/patch
-/bin/sed -i 's/\$MKDIR/\/bin\/mkdir/g' /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
-/bin/sed -i 's/\$CHMOD/\/bin\/chmod/g' /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
-/bin/sed -i 's/\$CHOWN/\/bin\/chown/g' /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
+
sh /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
-echo -e "You must run '/etc/init.d/oracle-xe configure' as the root user to
-configure the database."
-echo
+CONFIGURATION=/etc/default/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
+
Modified: trunk/debian/server/postrm
===================================================================
--- trunk/debian/server/postrm 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/postrm 2006-02-10 02:17:42 UTC (rev 23)
@@ -1,44 +1,41 @@
#!/bin/sh
+case "$1" in
+remove|purge)
+ ;;
+*)
+ exit 0
+ ;;
+esac
+
#DEBHELPER#
-if [ -f /etc/oratab ]
-then
- /bin/cp /etc/oratab /etc/oratab.xe
-# /bin/sed -i -s '/XE:/d' /etc/oratab.xe
- /bin/sed -i -s '/XE:\/usr\/lib\/oracle\/xe\/app\/oracle\/product\/10.2.0\/server:N/d' /etc/oratab.xe
- /bin/cp /etc/oratab.xe /etc/oratab
- /bin/rm -f /etc/oratab.xe
-fi
+case "$1" in
+purge)
+ if [ -f /etc/oratab ]
+ then
+ /bin/cp /etc/oratab /etc/oratab.xe
+# /bin/sed -i -s '/XE:/d' /etc/oratab.xe
+ /bin/sed -i -s '/XE:\/usr\/lib\/oracle\/xe\/app\/oracle\/product\/10.2.0\/server:N/d' /etc/oratab.xe
+ /bin/cp /etc/oratab.xe /etc/oratab
+ /bin/rm -f /etc/oratab.xe
+ fi
-rm -fr /etc/default/oracle-xe
+ rm -fr /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
+ rm -fr /usr/lib/oracle/xe/app/oracle/doc
+ rm -fr /usr/lib/oracle/xe/oradata
+ rm -fr /usr/lib/oracle/xe/app/oracle/admin
+ rm -fr /usr/lib/oracle/xe/app/oracle/flash_recovery_area
+ rm -fr /usr/share/desktop-menu-files/oraclexe-10g.directory
+ rm -fr /usr/share/desktop-menu-files/oraclexe-gethelp.directory
+ rm -fr /var/lib/menu/kde/Applications/OracleXE
+ rm -fr /usr/share/gnome/vfolders/oraclexe-10g.directory
+ rm -fr /usr/share/gnome/vfolders/oraclexe-gethelp.directory
+ ;;
+*)
+ ;;
+esac
-if test -d /usr/lib/oracle/xe/oradata/XE
-then
- rm -fr /usr/lib/oracle/xe/oradata/XE
-fi
-if test -d /usr/lib/oracle/xe/app/oracle/admin/XE
-then
- rm -fr /usr/lib/oracle/xe/app/oracle/admin/XE
-fi
-if test -d /usr/lib/oracle/xe/app/oracle/flash_recovery_area/XE
-then
- rm -fr /usr/lib/oracle/xe/app/oracle/flash_recovery_area/XE
-fi
-
-if test -d /usr/lib/oracle/xe/app/oracle/admin/cfgtoollogs/dbca/XE
-then
- rm -fr /usr/lib/oracle/xe/app/oracle/admin/cfgtoollogs/dbca/XE
-fi
-
-rm -fr /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
-rm -fr /usr/lib/oracle/xe/app/oracle/doc
-rm -fr /usr/share/desktop-menu-files/oraclexe-10g.directory
-rm -fr /usr/share/desktop-menu-files/oraclexe-gethelp.directory
-rm -fr /var/lib/menu/kde/Applications/OracleXE
-rm -fr /usr/share/gnome/vfolders/oraclexe-10g.directory
-rm -fr /usr/share/gnome/vfolders/oraclexe-gethelp.directory
-
mergefile()
{
MENUFILE="$1"
Modified: trunk/debian/server/preinst
===================================================================
--- trunk/debian/server/preinst 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/preinst 2006-02-10 02:17:42 UTC (rev 23)
@@ -1,5 +1,10 @@
#!/bin/sh
+if [ "$1" != "install" -o -n "$2" ]
+then
+ exit 0
+fi
+
#DEBHELPER#
# User must be root
Modified: trunk/debian/server/prerm
===================================================================
--- trunk/debian/server/prerm 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/prerm 2006-02-10 02:17:42 UTC (rev 23)
@@ -1,5 +1,11 @@
#!/bin/sh
+
+if [ "$1" != "remove" ]
+then
+ exit 0
+fi
+
#DEBHELPER#
if [ -f "/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/stopall.sh" ]; then
@@ -9,3 +15,4 @@
#rm -f /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora
#rm -f /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
#rm -f /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/scripts/postDBCreation.sql
+
Modified: trunk/debian/server/rules
===================================================================
--- trunk/debian/server/rules 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/debian/server/rules 2006-02-10 02:17:42 UTC (rev 23)
@@ -46,6 +46,11 @@
$(MAKE) destroot=`pwd`/debian/tmp install
+ # clean up oracleness
+ /bin/sed -i 's/\$$MKDIR/\/bin\/mkdir/g' debian/tmp/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
+ /bin/sed -i 's/\$$CHMOD/\/bin\/chmod/g' debian/tmp/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
+ /bin/sed -i 's/\$$CHOWN/\/bin\/chown/g' debian/tmp/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/install/sqlnet/setowner.sh
+
# Install the menu files properly
mkdir -p -m 0755 debian/tmp/usr/share/desktop-directories
mv debian/tmp/usr/share/desktop-menu-files/oraclexe-10g.directory debian/tmp/usr/share/desktop-directories
Added: trunk/override/server/config/scripts/oracle-xe
===================================================================
--- trunk/override/server/config/scripts/oracle-xe 2006-02-08 00:49:17 UTC (rev 22)
+++ trunk/override/server/config/scripts/oracle-xe 2006-02-10 02:17:42 UTC (rev 23)
@@ -0,0 +1,667 @@
+#!/bin/bash
+#
+#
+# chkconfig: 2345 80 05
+# description: This is a program that is responsible for taking care of
+# configuring the Oracle Database 10g Express Edition and its associated
+# services.
+#
+# processname: oracle-xe
+# Red Hat or SuSE config: /etc/sysconfig/oracle-xe
+# Debian or Ubuntu config: /etc/default/oracle-xe
+#
+# change log:
+# svaggu 09/28/05 - Creation
+# svaggu 11/08/05 - Source function Library change for SuSE
+# svaggu 11/09/05 - Password validation is added
+# jlbec 11/22/05 - Debianization
+# svaggu 12/02/05 - Errors messages are updated
+# svaggu 12/14/05 - Anonymous is removed from password message prompt and
+# changing the password for anonymous user logic is also
+# removed
+# svaggu 12/12/05 - Password validation is modified
+#
+
+# Source fuction library
+if [ -f /lib/lsb/init-functions ]
+then
+ . /lib/lsb/init-functions
+elif [ -f /etc/init.d/functions ]
+then
+ . /etc/init.d/functions
+fi
+
+# Set path if path not set (if called from /etc/rc)
+case $PATH in
+ "") PATH=/bin:/usr/bin:/sbin:/etc
+ export PATH ;;
+esac
+
+# Save LD_LIBRARY_PATH
+SAVE_LLP=$LD_LIBRARY_PATH
+
+RETVAL=0
+ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
+ORACLE_OWNER=oracle
+ORACLE_SID=XE
+LSNR=$ORACLE_HOME/bin/lsnrctl
+SQLPLUS=$ORACLE_HOME/bin/sqlplus
+SU=/bin/su
+export ORACLE_HOME
+export ORACLE_SID
+export PATH=$ORACLE_HOME/bin:$PATH
+LOG="$ORACLE_HOME_LISTNER/listener.log"
+
+export LC_ALL=C
+
+if [ $(id -u) != "0" ]
+then
+ echo "You must be root to run the configure script. Login as root and then run the
+configure script."
+ exit 1
+fi
+
+CONFIG_NAME=oracle-xe
+CONFIGURATION="/etc/sysconfig/$CONFIG_NAME"
+if [ -f /etc/redhat-release ]
+then
+ . /etc/init.d/functions
+
+ init_status()
+ {
+ return 0
+ }
+ exit_status()
+ {
+ exit $?
+ }
+ success_status()
+ {
+ success
+ echo
+ }
+ failure_status()
+ {
+ failure $?
+ echo
+ }
+
+elif [ -f /etc/SuSE-release ]
+then
+ . /etc/rc.status
+
+ init_status()
+ {
+ rc_reset
+ }
+ success_status()
+ {
+ echo "OK"
+ return 0
+ }
+ failure_status()
+ {
+ echo "Failed"
+ return 1
+ }
+ exit_status()
+ {
+ exit $?
+ }
+
+else
+ if [ -d /etc/default ]
+ then
+ CONFIGURATION="/etc/default/$CONFIG_NAME"
+ fi
+
+ init_status()
+ {
+ return 0
+ }
+
+ success_status()
+ {
+ echo "OK"
+ return 0
+ }
+
+ failure_status()
+ {
+ echo "Failed"
+ return 0
+ }
+
+ exit_status()
+ {
+ exit $?
+ }
+fi
+
+# Source configuration
+
+[ -f "$CONFIGURATION" ] && . "$CONFIGURATION"
+
+init_status
+
+#
+# if_fail()
+#
+# Evaluates return codes. If 0, prints "OK", if 1, prints "Failed"
+# and exits. If 2, status is "already done" and nothing is printed.
+# The rest of the functions in here all honor this convention.
+#
+if_fail()
+{
+ RC="$1"
+ REASON="$2"
+ if [ "$RC" = "0" ]
+ then
+ return
+ elif [ "$RC" = "2" ]
+ then
+ return
+ fi
+ failure_status "${REASON}"
+ exit 1
+}
+
+
+#
+# write_sysconfig()
+#
+# Writes the system configuration
+#
+write_sysconfig()
+{
+ cat >"$CONFIGURATION" <<EOF
+
+#This is a configuration file for automatic starting of the Oracle
+#Database and listener at system startup.It is generated By running
+#'/etc/init.d/oracle-xe configure'.Please use that method to modify this
+#file
+
+# ORACLE_DBENABLED:'true' means to load the Database at system boot.
+ORACLE_DBENABLED=${ORACLE_DBENABLED:-false}
+
+# LISTENER_PORT: Database listener
+LISTENER_PORT=${LISTENER_PORT}
+
+# HTTP_PORT : HTTP port for Oracle Application Express
+HTTP_PORT=${HTTP_PORT}
+
+# Configuration : Check whether configure has been done or not
+CONFIGURE_RUN=${CONFIGURE_RUN}
+
+EOF
+
+ if [ $? != 0 ]
+ then
+ return 1
+ fi
+ return 0
+}
+
+# configure_perform()
+#
+# Instantantiate listener.ora,tnsnames.ora,and create the database,
+# sets the password,start the listener,and adds database to inittab
+# if necessary
+
+configure_perform()
+{
+ sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network/admin/listener.ora
+ sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/listener.ora
+ /bin/chown oracle:dba $ORACLE_HOME/network/admin/listener.ora
+
+ sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/network/admin/tnsnames.ora
+ sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/tnsnames.ora
+ /bin/chown oracle:dba $ORACLE_HOME/network/admin/tnsnames.ora
+
+ sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/postDBCreation.sql
+ /bin/chown oracle:dba $ORACLE_HOME/config/scripts/postDBCreation.sql
+
+ if test $LISTENER_PORT -ne 1521
+ then
+ if [ -f /tmp/local_listener ]
+ then
+ cat >/tmp/local_listener$$ <<EOF
+###########################################
+# Registration of instance with listsner
+###########################################
+local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
+EOF
+ /bin/chmod 664 /tmp/local_listener$$
+ cat /tmp/local_listener$$ >> $ORACLE_HOME/config/scripts/init.ora
+ else
+ cat >/tmp/local_listener <<EOF
+###########################################
+# Registration of instance with listsner
+###########################################
+local_listener="(ADDRESS = (PROTOCOL=TCP) (HOST=%hostname%) (PORT=%port%))"
+EOF
+ /bin/chmod 664 /tmp/local_listener
+ cat /tmp/local_listener >> $ORACLE_HOME/config/scripts/init.ora
+ fi
+
+ if test -f /tmp/local_listener
+ then
+ rm -fr /tmp/local_listener
+ elif test -f /tmp/local_listener$$
+ then
+ rm -fr /tmp/local_listener$$
+ fi
+
+ sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/config/scripts/init.ora
+ sed -i "s/%hostname%/`hostname`/g" $ORACLE_HOME/config/scripts/init.ora
+ /bin/chown oracle:dba $ORACLE_HOME/config/scripts/init.ora
+
+ fi
+
+ sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/DatabaseHomePage.sh
+ /bin/chown oracle:dba $ORACLE_HOME/config/scripts/DatabaseHomePage.sh
+
+ sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/readonlinehelp.sh
+ /bin/chown oracle:dba $ORACLE_HOME/config/scripts/readonlinehelp.sh
+
+ homedir=`echo $HOME`
+ if [ "$homedir" = "/root" ]
+ then
+ homedir=`sh -c "echo ~$USER"`
+ fi
+
+ if [ -f $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop ]
+ then
+ /bin/chown oracle:dba $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop
+ /bin/chmod 664 $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop
+ fi
+ if [ -f $homedir/Desktop/oraclexe-gettingstarteddesktop.desktop ]
+ then
+ /bin/chown oracle:dba $homedir/Desktop/oraclexe-gettingstarteddesktop.desktop
+ /bin/chmod 664 $homedir/Desktop/oraclexe-gettingstarteddesktop.desktop
+ fi
+
+ if [ -f $ORACLE_HOME/bin/tnslsnr ]
+ then
+ echo -n "Starting Oracle Net Listener..."
+ $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start" > /dev/null 2>&1
+ echo "Done"
+ fi
+
+ echo -n "Configuring Database..."
+ $SU -s /bin/bash $ORACLE_OWNER -c "$ORACLE_HOME/config/scripts/XE.sh" > /dev/null 2>&1
+ err=`grep "ORA-44410" $ORACLE_HOME/config/log/*.log`
+ if test "$err" != ""
+ then
+ echo "Database Configuration failed. Look into $ORACLE_HOME/config/log for details"
+ exit 1
+ fi
+ echo alter user sys identified by \"$ORACLE_PASSWORD\"\; | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1
+ echo alter user system identified by \"$ORACLE_PASSWORD\"\; | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1
+ echo "Done"
+
+ /bin/chmod -R 640 /usr/lib/oracle/xe/oradata/XE
+ /bin/chmod 750 /usr/lib/oracle/xe/oradata/XE
+ rm -fr $ORACLE_HOME/config/seeddb
+
+ if [ -f /etc/oratab ]
+ then
+ echo "XE:$ORACLE_HOME:N" >> /etc/oratab
+ else
+ echo "XE:$ORACLE_HOME:N" >> /etc/oratab
+ /bin/chown oracle:dba /etc/oratab
+ /bin/chmod 644 /etc/oratab
+ fi
+
+ echo -n "Starting Oracle Database 10g Express Edition Instance..."
+ pmon=`ps -ef | egrep pmon_$ORACLE_SID'\>' | grep -v grep`
+
+ if [ "$pmon" = "" ];
+ then
+ $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev/null 2>&1
+ fi
+ echo "Done"
+
+ echo "Installation Completed Successfully."
+
+
+ return 0
+}
+
+#
+#configure_ask()
+#
+# Ask configuration questions,setting the variables.
+#
+
+configure_ask()
+{
+ cat <<EOF
+
+Oracle Database 10g Express Edition Configuration
+-------------------------------------------------
+This will configure on-boot properties of Oracle Database 10g Express
+Edition. The following questions will determine whether the database should
+be starting upon system boot, the ports it will use, and the passwords that
+will be used for database accounts. Press <Enter> to accept the defaults.
+Ctrl-C will abort.
+
+EOF
+
+ #get the http port value
+ while :
+ do
+ while [ 1 ]
+ do
+ echo -n Specify the HTTP port that will be used for Oracle Application Express [8080]:
+ read LINE
+ if [ -z $LINE ]
+ then
+ LINE=8080
+ fi
+ port=`netstat -n --tcp --listen | grep :$LINE | awk '{print $4}' | cut -d':' -f2`
+ if [ "$port" = "$LINE" ]
+ then
+ echo Port $port appears to be in use by another application.\
+ Please specify a different port.
+ else
+ break;
+ fi
+ done
+
+ case "$LINE" in
+ "")
+ break
+ ;;
+ *[^0-9]*)
+ echo "Invalid http port: $LINE"
+ ;;
+ *)
+ HTTP_PORT=$LINE
+ break
+ ;;
+ esac
+ done
+
+ #get the listener port value
+ while :
+ do
+ echo
+ while [ 1 ]
+ do
+ echo -n Specify a port that will be used for the database listener [1521]:
+ read LINE
+ if [ -z $LINE ]
+ then
+ LINE=1521
+ fi
+ echo
+ port=`netstat -n --tcp --listen | grep :$LINE | awk '{print $4}' | cut -d':' -f2`
+ if [ "$port" = "$LINE" ]
+ then
+ echo Port $port appears to be in use by another application.\
+ Please specify a different port.
+ else
+ break;
+ fi
+ done
+
+ case "$LINE" in
+ "")
+ break
+ ;;
+ *[^0-9]*)
+ echo "Invalid port: $LINE" >&2
+ ;;
+ *)
+ if [ "$HTTP_PORT" != "$LINE" ]
+ then
+ LISTENER_PORT=$LINE
+ break
+ else
+ echo Database listener cannot be configured on the same port as Oracle Application Express.
+ fi
+ ;;
+ esac
+ done
+
+ #get the database password
+ while :
+ do
+ echo -n "Specify a password to be used for database accounts. Note that the same
+password will be used for SYS and SYSTEM. Oracle recommends the use of
+different passwords for each database account. This can be done after
+initial configuration:"
+ while [ 1 ]
+ do
+ /bin/stty -echo > /dev/null 2>&1
+ temp=`echo $IFS`
+ export IFS="\n"
+ while [ 1 ]
+ do
+ read LINE
+ while [ -z "$LINE" ]
+ do
+ echo
+ echo -n "Password can't be null. Enter password:"
+ read LINE
+ done
+
+ result=`expr index "$LINE" [\'\"]`
+ if [ $result != 0 ];
+ then
+ echo
+ echo -n "The password you entered contains invalid characters. Enter password:"
+ else
+ break
+ fi
+ done
+ echo
+ echo -n "Confirm the password:"
+ read LINE1
+ echo
+ if [ "$LINE" != "$LINE1" ];
+ then
+ echo
+ echo -n "Passwords do not match. Enter the password:"
+ else
+ break
+ fi
+ done
+ /bin/stty echo > /dev/null 2>&1
+ ORACLE_PASSWORD=$LINE
+ export IFS=$temp
+ break;
+ done
+
+ while :
+ do
+ if [ "$ORACLE_DBENABLED" = "true" ]
+ then
+ CUR=y
+ else
+ CUR=n
+ fi
+ echo
+ echo -n "Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:"
+ read LINE
+ if [ -z $LINE ]
+ then
+ ORACLE_DBENABLED=true
+ fi
+ echo
+ case "$LINE" in
+ "")
+ break
+ ;;
+ y|Y)
+ ORACLE_DBENABLED=true
+ break
+ ;;
+ n|N)
+ ORACLE_DBENABLED=false
+ break
+ ;;
+ *)
+ echo "Invalid response: $LINE " >&2
+ break
+ esac
+ done
+}
+
+configure()
+{
+ if [ "$CONFIGURE_RUN" = "true" ]
+ then
+ echo "Oracle Database 10g Express Edition is already configured"
+ exit 1
+ fi
+ configure_ask
+ configure_perform
+ CONFIGURE_RUN=true
+ write_sysconfig
+ echo To access the Database Home Page go to \"http://127.0.0.1:$HTTP_PORT/apex\"
+
+}
+
+start() {
+
+ if [ "$CONFIGURE_RUN" != "true" ]
+ then
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+ status=`ps -ef | grep tns | grep oracle`
+ if [ "$status" == "" ]
+ then
+ if [ -f $ORACLE_HOME/bin/tnslsnr ]
+ then
+ echo "Starting Oracle Net Listener."
+ $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR start" > /dev/null 2>&1
+ fi
+ fi
+ echo "Starting Oracle Database 10g Express Edition Instance."
+ $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/startdb.sql" > /dev/null 2>&1
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]
+ then
+ echo
+ else
+ echo Failed to start Oracle Net Listener using $ORACLE_HOME/bin/tnslsnr\
+ and Oracle Express Database using $ORACLE_HOME/bin/sqlplus.
+ RETVAL=1
+ fi
+ return $RETVAL
+}
+
+stop() {
+ if [ "$CONFIGURE_RUN" != "true" ]
+ then
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+
+ # Stop Oracle 10g Express Edition Database and Listener
+ echo Shutting down Oracle Database 10g Express Edition Instance.
+ $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s /nolog @$ORACLE_HOME/config/scripts/stopdb.sql" > /dev/null 2>&1
+ echo Stopping Oracle Net Listener.
+ $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR stop" > /dev/null 2>&1
+ RETVAL=$?
+ echo
+ if [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$LSNR
+ then
+ return $RETVAL
+ fi
+}
+
+dostatus() {
+ if test ! -f "$CONFIGURATION"
+ then
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ elif [ "$CONFIGURE_RUN" != "true" ]
+ then
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+
+ $SU -s /bin/bash $ORACLE_OWNER -c "$LSNR status"
+ RETVAL=$?
+}
+
+# See how we were called
+case "$1" in
+ start)
+ if test -f "$CONFIGURATION"
+ then
+ if test "$ORACLE_DBENABLED" != "true"
+ then
+ exit 0
+ fi
+ else
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+ start
+ ;;
+ configure)
+ configure
+ ;;
+ stop)
+ if test -f "$CONFIGURATION"
+ then
+ if test "$ORACLE_DBENABLED" != "true"
+ then
+ exit 0
+ fi
+ else
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+ stop
+ ;;
+ restart|reload|force-reload)
+ stop
+ start
+ RETVAL=$?
+ ;;
+ status)
+ dostatus
+ ;;
+ enable)
+ if test -f "$CONFIGURATION"
+ then
+ ORACLE_DBENABLED=true
+ write_sysconfig
+ else
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+ ;;
+
+ disable)
+ if test -f "$CONFIGURATION"
+ then
+ ORACLE_DBENABLED=false
+ write_sysconfig
+ else
+ echo "Oracle Database 10g Express Edition is not configured. You must run
+'/etc/init.d/oracle-xe configure' as the root user to configure the database."
+ exit 0
+ fi
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|restart|force-reload|configure|status|enable|disable}"
+ exit 1
+esac
+
+
+
More information about the Xedeb-commits
mailing list