Fix run_db_install.sh template for first-time installations
- Check if inventory.xml exists before grep operation - Handle first installation scenario properly - Add informative messages for different installation states - Use more robust comparison (-ge 1 instead of == 1)
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Vérifier si c'est une première installation ou si ORACLE_HOME existe déjà
|
||||||
|
if [[ -f "{{ oracle_inventory }}/ContentsXML/inventory.xml" ]]; then
|
||||||
chkifinstalled=`grep "{{ oracle_home }}" "{{ oracle_inventory }}/ContentsXML/inventory.xml" | wc -l`
|
chkifinstalled=`grep "{{ oracle_home }}" "{{ oracle_inventory }}/ContentsXML/inventory.xml" | wc -l`
|
||||||
if [[ $chkifinstalled == 1 ]]; then
|
if [[ $chkifinstalled -ge 1 ]]; then
|
||||||
echo "Error: ORACLE_HOME: {{ oracle_home }} already present. Exiting"
|
echo "Error: ORACLE_HOME: {{ oracle_home }} already present. Exiting"
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
echo "First installation - inventory.xml not found, proceeding with installation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configuration et installation
|
||||||
linux_version=$(cat /etc/os-release | egrep "^VERSION=" | cut -d= -f2 | sed 's/"//g' | cut -d. -f1)
|
linux_version=$(cat /etc/os-release | egrep "^VERSION=" | cut -d= -f2 | sed 's/"//g' | cut -d. -f1)
|
||||||
if [ "${linux_version}" -ge 9 ]
|
if [ "${linux_version}" -ge 9 ]
|
||||||
then
|
then
|
||||||
|
|||||||
Reference in New Issue
Block a user