|
|
e4ef47 |
From 4697e670434d01464723d3f3da6608ea6d650cf2 Mon Sep 17 00:00:00 2001
|
|
|
e4ef47 |
From: Jan Grulich <jgrulich@redhat.com>
|
|
|
e4ef47 |
Date: Tue, 7 Apr 2015 13:42:15 +0200
|
|
|
e4ef47 |
Subject: [PATCH 6/6] Add force mode BUG:1205691
|
|
|
e4ef47 |
|
|
|
e4ef47 |
---
|
|
|
e4ef47 |
sapconf | 33 +++++++++++++++++++--------------
|
|
|
e4ef47 |
sapconf.man | 7 ++++---
|
|
|
e4ef47 |
2 files changed, 23 insertions(+), 17 deletions(-)
|
|
|
e4ef47 |
|
|
|
e4ef47 |
diff --git a/sapconf b/sapconf
|
|
|
e4ef47 |
index 58096fe..bad7736 100755
|
|
|
e4ef47 |
--- a/sapconf
|
|
|
e4ef47 |
+++ b/sapconf
|
|
|
e4ef47 |
@@ -20,10 +20,11 @@
|
|
|
e4ef47 |
# requires: tuned-profiles-sap
|
|
|
e4ef47 |
#
|
|
|
e4ef47 |
# options:
|
|
|
e4ef47 |
-# -f <file> : uses the given file instead of /etc/sysconfig/sap (FUTURE USE)
|
|
|
e4ef47 |
-# -n : just check and don't modify
|
|
|
e4ef47 |
-# -q : quiet, no output
|
|
|
e4ef47 |
-# -d <dbtyp>: used to set special parameters for Sybase and Oracle
|
|
|
e4ef47 |
+# -d <dbtyp> : used to set special parameters for Sybase and Oracle, respectively (i.e. sybase|syb|oracle|ora)
|
|
|
e4ef47 |
+# -f : FORCE mode: do actions which are not required, but makes your life easier (i.e. disable firewall)
|
|
|
e4ef47 |
+# -n : CHECK_ONLY mode: no modification will be made to the system
|
|
|
e4ef47 |
+# -q : quiet execution. log file directory: /var/log/sap
|
|
|
e4ef47 |
+# -h : help message
|
|
|
e4ef47 |
#
|
|
|
e4ef47 |
# returncodes:
|
|
|
e4ef47 |
# 0 : all works well
|
|
|
e4ef47 |
@@ -53,6 +53,7 @@ export LOGFILE=${LOGDIR}/${SCRIPTNAME}-$(date +"%Y%m%d%H%M").log
|
|
|
e4ef47 |
|
|
|
e4ef47 |
SAP_NOTE_RHEL7="SAP Note 2002167"
|
|
|
e4ef47 |
CHECK_ONLY=0
|
|
|
e4ef47 |
+FORCE_MODE=0
|
|
|
e4ef47 |
QUIET=0
|
|
|
e4ef47 |
# rec_count counts the number of lines of variable array REC[] that contains recommendations to be put at the end of the $LOGFILE
|
|
|
e4ef47 |
rec_count=0
|
|
|
e4ef47 |
@@ -115,10 +116,11 @@ ORA_EXTRA_RPMS="@development libaio libaio-devel compat-libstdc++-33 elfutils-li
|
|
|
e4ef47 |
# 1
|
|
|
e4ef47 |
function usage() {
|
|
|
e4ef47 |
cat << EOU
|
|
|
e4ef47 |
-Usage: $0 [-d <dbtype>] [-n] [-q]
|
|
|
e4ef47 |
+Usage: $0 [-d <dbtype>] [-f] [-n] [-q]
|
|
|
e4ef47 |
|
|
|
e4ef47 |
-d <dbtyp> : used to set special parameters for Sybase and Oracle, respectively (i.e. sybase|syb|oracle|ora)
|
|
|
e4ef47 |
- -n : CHECK_ONLY mode: check only, no modification will be made to the system
|
|
|
e4ef47 |
+ -f : FORCE mode: do actions which are not required, but makes your life easier (i.e. disable firewall)
|
|
|
e4ef47 |
+ -n : CHECK_ONLY mode: no modification will be made to the system
|
|
|
e4ef47 |
-q : quiet execution. log file directory: /var/log/sap
|
|
|
e4ef47 |
-h : help message
|
|
|
e4ef47 |
|
|
|
e4ef47 |
@@ -639,7 +639,12 @@ function check_security() {
|
|
|
e4ef47 |
# SELinux needs to be permissive or disabled
|
|
|
e4ef47 |
SELINUX_CONFIG=/etc/selinux/config
|
|
|
e4ef47 |
if egrep -q "^SELINUX=['\"]?enforcing" $SELINUX_CONFIG; then
|
|
|
e4ef47 |
- rec "SELinux is configured to be booted in enforcing mode. It's recommended to set to permissive. Please check $SAP_NOTE_RHEL7 for details."
|
|
|
e4ef47 |
+ if [ $FORCE_MODE == 1 ]; then
|
|
|
e4ef47 |
+ sed -i "s/^SELINUX=['\"]\?enforcing/SELINUX=permissive/" $SELINUX_CONFIG
|
|
|
e4ef47 |
+ out "Configuring SELinux to be permissive..."
|
|
|
e4ef47 |
+ else
|
|
|
e4ef47 |
+ rec "SELinux is configured to be booted in enforcing mode. It's recommended to set to permissive. Please check $SAP_NOTE_RHEL7 for details."
|
|
|
e4ef47 |
+ fi
|
|
|
e4ef47 |
else
|
|
|
e4ef47 |
if egrep -q "^SELINUX=['\"]?disabled" $SELINUX_CONFIG; then
|
|
|
e4ef47 |
rec "SElinux is configured to be disabled on boot. It's recommended to be set to permissive, however your system may then require to be relabeled. Please check $SAP_NOTE_RHEL7 for details."
|
|
|
e4ef47 |
@@ -655,7 +657,7 @@ fi
|
|
|
e4ef47 |
|
|
|
e4ef47 |
# Firewall needs to be off
|
|
|
e4ef47 |
if systemctl status firewalld.service > /dev/null 2>&1 ; then
|
|
|
e4ef47 |
- if [ $CHECK_ONLY == 0 ]; then
|
|
|
e4ef47 |
+ if [ $FORCE_MODE == 1 ]; then
|
|
|
e4ef47 |
# disable firewall or open required ports
|
|
|
e4ef47 |
systemctl disable firewalld.service > /dev/null 2>&1
|
|
|
e4ef47 |
systemctl stop firewalld.service > /dev/null 2>&1
|
|
|
e4ef47 |
@@ -905,18 +907,9 @@ done
|
|
|
e4ef47 |
#
|
|
|
e4ef47 |
####################################################################################
|
|
|
e4ef47 |
|
|
|
e4ef47 |
-while getopts "nqhf:d:" opt; do
|
|
|
e4ef47 |
+while getopts "c:d:fhnq" opt; do
|
|
|
e4ef47 |
case $opt in
|
|
|
e4ef47 |
- n)
|
|
|
e4ef47 |
- CHECK_ONLY=1
|
|
|
e4ef47 |
- ;;
|
|
|
e4ef47 |
- q)
|
|
|
e4ef47 |
- QUIET=1
|
|
|
e4ef47 |
- ;;
|
|
|
e4ef47 |
- h)
|
|
|
e4ef47 |
- usage
|
|
|
e4ef47 |
- ;;
|
|
|
e4ef47 |
- f)
|
|
|
e4ef47 |
+ c)
|
|
|
e4ef47 |
SAPCONFIG=$OPTARG
|
|
|
e4ef47 |
[ ! -r $SAPCONFIG ] && error "File $SAPCONFIG does not exist" 2
|
|
|
e4ef47 |
. $SAPCONFIG
|
|
|
e4ef47 |
@@ -924,6 +917,18 @@ while getopts "nqhf:d:" opt; do
|
|
|
e4ef47 |
d)
|
|
|
e4ef47 |
dbtyp=$OPTARG
|
|
|
e4ef47 |
;;
|
|
|
e4ef47 |
+ f)
|
|
|
e4ef47 |
+ FORCE_MODE=1
|
|
|
e4ef47 |
+ ;;
|
|
|
e4ef47 |
+ h)
|
|
|
e4ef47 |
+ usage
|
|
|
e4ef47 |
+ ;;
|
|
|
e4ef47 |
+ n)
|
|
|
e4ef47 |
+ CHECK_ONLY=1
|
|
|
e4ef47 |
+ ;;
|
|
|
e4ef47 |
+ q)
|
|
|
e4ef47 |
+ QUIET=1
|
|
|
e4ef47 |
+ ;;
|
|
|
e4ef47 |
*)
|
|
|
e4ef47 |
usage
|
|
|
e4ef47 |
;;
|
|
|
e4ef47 |
diff --git a/sapconf.man b/sapconf.man
|
|
|
e4ef47 |
index 0d49cdf..57e50fd 100644
|
|
|
e4ef47 |
--- a/sapconf.man
|
|
|
e4ef47 |
+++ b/sapconf.man
|
|
|
e4ef47 |
@@ -4,7 +4,7 @@
|
|
|
e4ef47 |
.SH NAME
|
|
|
e4ef47 |
sapconf \- prepares fresh installed RHEL for installation of SAP
|
|
|
e4ef47 |
.SH SYNOPSIS
|
|
|
e4ef47 |
-sapconf [-d <dbtype>] [-n] [-q]
|
|
|
e4ef47 |
+sapconf [-d <dbtype>] [-f] [-n] [-q]
|
|
|
e4ef47 |
|
|
|
e4ef47 |
.SH DESCRIPTION
|
|
|
e4ef47 |
sapconf is a shell program for configuring/checking a Red Hat Enterprise Linux system according to the follwing SAP Notes:
|
|
|
e4ef47 |
@@ -21,9 +21,10 @@ SE Linux status will only be checked.
|
|
|
e4ef47 |
|
|
|
e4ef47 |
.SH OPTIONS
|
|
|
e4ef47 |
|
|
|
e4ef47 |
- -n : CHECK_ONLY mode: check only, no modification will be made to the system
|
|
|
e4ef47 |
+ -d <dbtyp> : used to set special parameters for Sybase and Oracle, respectively (i.e. sybase|syb|oracle|ora)
|
|
|
e4ef47 |
+ -f : FORCE mode: do actions which are not required, but makes your life easier (i.e. disable firewall)
|
|
|
e4ef47 |
+ -n : CHECK_ONLY mode: no modification will be made to the system
|
|
|
e4ef47 |
-q : quiet execution. log file directory: /var/log/sap
|
|
|
e4ef47 |
- -d <dbtype> : used to set special parameters for Sybase and Oracle, respectively (i.e. sybase|syb|oracle|ora|db2|ada)
|
|
|
e4ef47 |
-h : help message
|
|
|
e4ef47 |
|
|
|
e4ef47 |
.\.SH SEE ALSO
|
|
|
e4ef47 |
--
|
|
|
e4ef47 |
2.1.0
|
|
|
e4ef47 |
|