ENT is true or if SILENT_F is 1
#
if [ "${OUI_SILENT}" = "true" -o "$SILENT_F" ]
then
SILENT=1
else
SILENT=0
fi
if [ $SILENT -eq 1 ]
then
$ECHO "Check $LOG for the output of root script"
exec > $LOG 2>&1
else
mkfifo $LOG.pipe
tee < $LOG.pipe $LOG &
exec &> $LOG.pipe
rm $LOG.pipe
fi
#
# check for valid crshome
#
if [ "$CRSHOME" -a ! -d "$CRSHOME" ]; then
$ECHO "ERROR: CRS home $CRSHOME is not a valid directory." | $TEE -a $LOG
exit 1
fi
----->>>检查是否设置crshome
#
# Determine how to suppress newline with $ECHO command.
#
case ${N}$C in
"") if $ECHO "\c"| $GREP c >/dev/null 2>&1;then
N='-n'
else
C='\c'
fi;;
esac
#
# check for zero UID
#
RUID=`/usr/bin/id|$AWK -F\( '{print $1}'|$AWK -F= '{print $2}'`
if [ $RUID -ne 0 ];then
$ECHO "You must be logged in as user with UID as zero (e.g. root user) to run root configuration script."| $TEE -a $LOG
$ECHO "Log in as user with UID as zero (e.g. root user) and restart root configuration script execution."| $TEE -a $LOG
exit 1
fi
----->>>检查是否以root用户执行操作
#
# Display abort message on interrupt.
#
trap '$ECHO "Oracle root script execution aborted!"| $TEE -a $LOG;exit' 1 2 3 15
#
# Check for $LOG file existence and if it exists, change the ownership to oracle_owner:oracle_owner_group and permissions to 600
#
if [ -f $LOG ];then
$CHOWN $ORACLE_OWNER:$OSDBA_GROUP $LOG
$CHMOD 600 $LOG
fi
fi
#conditional code execution ends
------>>>>修改权限,修改宿主,拥有者,日志权限为600
可以看到上述脚本主要是检查是否为root用户,修改宿主,并且需要在环境变量有相应的ORACLE_HOME,ORACLE_OWNER等
[oracle@rh64 ~]$
第二个脚本
[oracle@rh64 ~]$ cat /u01/app/db11g/product/11.2.0/dbhome_1/install/utl/rootinstall.sh
$ECHO "Performing root user operation for Oracle 11g "
$ECHO ""
$ECHO "The following environment variables are set as:"
$ECHO " ORACLE_OWNER= $ORACLE_OWNER"
$ECHO " ORACLE_HOME= $ORACLE_HOME"
#
# Get name of local bin directory
#
saveLBIN=$LBIN
retry='r'
while [ "$retry" = "r" ]
do
if [ $SILENT -eq 0 ]
then
LBIN=$saveLBIN
$ECHO ""
$ECHO $N "Enter the full pathname of the local bin directory: $C"
DEFLT=${LBIN}; . $ORACLE_HOME/install/utl/read.sh; LBIN=$RDVAR
fi
if [ ! -d $LBIN ];then
$ECHO "Creating ${LBIN} directory..."
$MKDIR -p ${LBIN} 2>&1
$CHMOD 755 ${LBIN} 2>&1
fi
if [ ! -w $LBIN ]
then
if [ $SILENT -eq 0 ]
then
$ECHO ""
$ECHO $N "$LBIN is read only. Continue without copy (y/n) or retry (r)? $C"
DEFLT='y' ; . $ORACLE_HOME/install/utl/read.sh ; retry=$RDVAR
else
retry='y' # continue without copy
fi
else
retry='y'
fi
done
if [ "$retry" = "n" ] ; then
$ECHO "Warning: Script terminated by user."
exit 1
fi
#
# Move files to LBIN, and set permissions
#
DBHOME=$ORACLE_HOME/bin/dbhome
ORAENV=$ORACLE_HOME/bin/oraenv
CORAENV=$ORACLE_HOME/bin/coraenv
FILES="$DBHOME $ORAENV $CORAENV"
----->>>这里就是移动这几个文件,然后设置相应的权限。上面三个环境变量比较熟悉,我们需要升级备份的时候通常需要备份这些东西,
其实这个东西可以从$ORACLE_HOME/bin下拷贝过到/usr/local/bin,所以?丝们以后可以不用担心了~~~
if [ -w $LBIN ]
then
for f in $FILES ; do
if [ -f $f ] ; then
$CHMOD 755 $f 2>&1 2>> $LOG
short_f=`$ECHO $f | $SED 's;.*/;;'`
lbin_f=$LBIN/$short_f
if [ -f $lbin_f -a $SILENT -eq 0 ] ; then
DIFF_STATUS=`$DIFF $f $lbin_f`
if [ $? -ne 0 ] ; then
# The contents of $lbin_f and $f are different (User updated $lbin_f)
# Prompt user before overwriting $lbin_f.
$ECHO $n "The file \"$short_f\" already exists in $LBIN. Overwrite it? (y/n) $C"
DEFLT='n'; . $ORACLE_HOME/install/utl/read.sh; OVERWRITE=$RDVAR
else
# The contents of $lbin_f and $f are identical. Don't overwrite.
$ECHO "The contents of \"$s |