[Xedeb-commits] jlbec commits r5 - in trunk: . override override/server override/server/config override/server/config/scripts

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Nov 22 19:47:37 CST 2005


Author: jlbec
Date: 2005-11-22 19:47:36 -0600 (Tue, 22 Nov 2005)
New Revision: 5

Added:
   trunk/HACKING
   trunk/override/
   trunk/override/client/
   trunk/override/server/
   trunk/override/server/config/
   trunk/override/server/config/scripts/
   trunk/override/server/config/scripts/oracle-xe
Modified:
   trunk/Makefile
Log:

o Read HACKING please
o Now it builds debs



Added: trunk/HACKING
===================================================================
--- trunk/HACKING	2005-11-22 23:33:26 UTC (rev 4)
+++ trunk/HACKING	2005-11-23 01:47:36 UTC (rev 5)
@@ -0,0 +1,35 @@
+
+This is a simple environment for workingon Debian/Ubuntu/Kubuntu
+packages of Oracle XE.  Here's how it is laid out:
+
+sources/
+	These are the XE tarballs from Oracle's source control.  They
+	MUST NOT BE MODIFIED.  They will always be the latest from the
+	XE team (to the best of my ability).
+
+override/server
+override/client
+	Any file in an override directory is laid over the corresponding
+	file in the unpacked tree.  So, if
+	override/server/config/scripts/oracle-xe exists, it will be
+	overlaid atop oracle-xe-<version>/config/scripts/oracle-xe.
+	It is intended that the override directories will be empty by
+	release, as anything we need to override should be merged into
+	the XE team's tree.
+
+debian/server
+debian/client
+	These are the debian directories.  They get symlinked to
+	the oracle-xe-<version>/debian and oracle-xe-client-<version>
+	respectively.  ONLY DEBIAN/UBUNTU-SPECIFIC FILES GO HERE.  If
+	a file is a variation on a generic file (that is, it is an
+	edit of a file that is part of the main distribution), it should
+	go in the override directory until the XE team accepts it.  So,
+	oracle-xe.init is copied in from config/scripts/oracle-xe
+	instead of maintaining a Debian-specific copy in debian/server,
+	but debian/server/postinst is kept in the debian/server
+	directory.
+
+How does one get the magic?  "make prep" will unpack the directories,
+link the debian dirs, and overlay the overrides.  "make debs" will
+run debuild in the directories.

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2005-11-22 23:33:26 UTC (rev 4)
+++ trunk/Makefile	2005-11-23 01:47:36 UTC (rev 5)
@@ -21,8 +21,24 @@
 prep-server: .$(SERVER_DIR).stamp
 prep-client: .$(CLIENT_DIR).stamp
 
-prep: prep-server prep-client $(SERVER_DIR)/debian $(CLIENT_DIR)/debian
+prep-dirs: prep-server prep-client
 
+prep-debian: prep-dirs $(SERVER_DIR)/debian $(CLIENT_DIR)/debian
+
+
+SERVER_OVERRIDES = $(addprefix $(SERVER_DIR)/, $(shell cd override/server && find . -type f))
+$(SERVER_OVERRIDES): $(SERVER_DIR)/%: override/server/%
+	cp $< $@
+
+overrides-server: $(SERVER_OVERRIDES)
+
+overrides: overrides-server
+
+prep: prep-dirs prep-debian overrides
+
+server-debs: prep
+	cd $(SERVER_DIR) && debuild -r fakeroot
+
 realclean-server:
 	-rm -rf $(SERVER_DIR)
 	-rm -f .$(SERVER_DIR).stamp

Added: trunk/override/server/config/scripts/oracle-xe
===================================================================
--- trunk/override/server/config/scripts/oracle-xe	2005-11-22 23:33:26 UTC (rev 4)
+++ trunk/override/server/config/scripts/oracle-xe	2005-11-23 01:47:36 UTC (rev 5)
@@ -0,0 +1,576 @@
+#!/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
+#
+
+# Source fuction library
+if [ -f /lib/lsb/init-functions ]
+then
+	. /lib/lsb/init-functions
+elif [ -f /etc/init.d/functions ]
+	. /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:
+LISTENER_PORT=${LISTENER_PORT}
+
+# HTTP_PORT
+HTTP_PORT=${HTTP_PORT}
+
+#Configuration
+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/%hostname%/`hostname`/g" $ORACLE_HOME/network/admin/tnsnames.ora
+    sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/listener.ora
+    sed -i "s/%port%/$LISTENER_PORT/g" $ORACLE_HOME/network/admin/tnsnames.ora
+    sed -i "s/%httpport%/$HTTP_PORT/g" $ORACLE_HOME/config/scripts/postDBCreation.sql
+    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
+    sed -i "s/%FRA_DIR%/\/usr\/lib\/oracle\/xe\/app\/oracle\/flash_recovery_area/g" $ORACLE_HOME/config/scripts/postDBCreation.sql
+    sed -i "s/%httpport%/$HTTP_PORT/g" /usr/share/applications/oraclexe-dbhp.desktop
+    sed -i "s/%httpport%/$HTTP_PORT/g" /usr/share/applications/oraclexe-readonlinehelp.desktop
+
+    homedir=`echo $HOME`
+    if [ "$homedir" == "/root" ]
+    then
+        homedir=`sh -c "echo ~$USER"`
+    fi
+
+    if [ -f $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop ]  
+    then
+    	    chown oracle:dba $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop
+    	    chmod 664  $homedir/.gnome-desktop/oraclexe-gettingstarteddesktop.desktop
+    fi
+    if [ -f $homedir/Desktop/oraclexe-gettingstarteddesktop.desktop ]
+    then
+	chown oracle:dba $homedir/Desktop/oraclexe-gettingstarteddesktop.desktop
+	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
+    echo  "alter user flows_020100 identified by "$ORACLE_PASSWORD";" | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1
+    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  "alter user flows_files identified by "$ORACLE_PASSWORD";" | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1
+    echo  "alter user anonymous identified by "$ORACLE_PASSWORD";" | $SU -s /bin/bash $ORACLE_OWNER -c "$SQLPLUS -s / as sysdba" > /dev/null 2>&1
+    echo "Done"
+
+    chmod -R 640 /usr/lib/oracle/xe/oradata/XE
+    chmod 750 /usr/lib/oracle/xe/oradata/XE
+    chown -R oracle:dba /usr/lib/oracle/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
+	chown oracle:dba /etc/oratab
+	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."
+   echo "Launching Oracle Database 10g Express Edition Home Page."
+   mozilla http://127.0.0.1:$HTTP_PORT/htmldb
+   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 HTML DB [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" > /dev/null
+            ;;
+        *)
+            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
+            ;;
+	    *) 
+            LISTENER_PORT=$LINE
+	      	break
+            ;;
+	    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, SYSTEM and FLOWS_020100.  Oracle recommends
+the use of different passwords for each database account.  This can be done
+after initial configuration:"
+	   while [ 1 ]
+	   do
+	     stty -echo
+	     read LINE
+	     while [ -z $LINE ]
+	     do
+	     echo
+	     echo -n "Password can't be null.  Enter password:"
+		read LINE
+	     done
+	     if [ -n $LINE ]
+	     then
+		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
+	     fi
+	   done
+	
+	   case "$LINE" in
+	    [^a-zA-Z]*)
+              echo "Invalid password" >&2
+	    *[^a-zA-Z0-9]*)
+              echo "Invalid password" >&2
+            ;;
+	   *)
+            stty echo
+            ORACLE_PASSWORD=$LINE
+            break
+            ;;
+	   esac
+	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 test -f "$CONFIGURATION"
+	then
+		echo "Oracle Database 10g Express Edition is already configured"
+	exit 1
+	fi
+	configure_ask
+	configure_perform
+	CONFIGURE_RUN=true
+	write_sysconfig
+}
+
+start() {
+
+	if test ! -f "$CONFIGURATION"
+	then
+		echo You need to configure Oracle Database 10g Express Edition before\
+            you can start it.
+		exit 0
+	elif [ "$CONFIGURE_RUN" != "true" ]		
+	then
+		echo You need to configure Oracle Database 10g Express Edition before\
+            you can start it.
+		exit 0
+	fi
+	if [ "$ORACLE_DBENABLED" != "true" ]
+	then
+		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 test ! -f "$CONFIGURATION"
+    then
+        echo Oracle Database 10g Express Edition is not configured.
+        exit 0
+	elif [ "$CONFIGURE_RUN" != "true" ]               
+    then
+        echo Oracle Database 10g Express Edition is not configured.
+        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 You need to configure Oracle Database 10g Express\
+             listener to get the status.
+        exit 0
+	elif [ "$CONFIGURE_RUN" != "true" ]
+    then
+        echo You need to configure Oracle Database 10g Express\
+             listenr to get the status
+        exit 0
+    fi
+        
+	$SU -s /bin/bash $ORACLE_OWNER -c "$LSNR status"
+    RETVAL=$?
+}
+
+# See how we were called
+case "$1" in
+  start)
+       start
+       ;;
+  configure)
+        configure
+        if [ "$ORACLE_DBENABLED" = "true" ]
+        then
+	    /sbin/chkconfig --add oracle-xe
+        fi
+        ;;
+  stop)
+        stop
+        ;;
+  restart|reload)
+        stop
+        start
+        RETVAL=$?
+        ;;
+  status)
+        dostatus
+        ;;
+	*)
+        echo $"Usage: $0 {start|stop|restart|configure|status}"
+        exit 1
+esac
+
+


Property changes on: trunk/override/server/config/scripts/oracle-xe
___________________________________________________________________
Name: svn:executable
   + *



More information about the Xedeb-commits mailing list