From 153a36e6039f9d62554fae232565714b6678c7fc Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 12 Apr 2024 15:55:34 +0200 Subject: [PATCH 1/3] sap_install_media_detect: improve file type detection Solves issue #695. Signed-off-by: Bernd Finger --- .../files/tmp/sapfile | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 49a782ff8..034285ef6 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -207,12 +207,12 @@ for _FILE in "$@"; do _FILE_OUTPUT=$(file "${_FILE}" | sed 's,'"${_FILE}"': ,,') _GENERIC_FILE_TYPE=$(echo "${_FILE_OUTPUT}" | awk ' BEGIN{_file_type="other"} - /RAR self-extracting archive/{_file_type="rarexe"} - /RAR archive data/{_file_type="rar"} - /Zip archive data/{_file_type="zip"} - /SAPCAR archive data/{_file_type="sapcar"} - /XML/&&/ASCII/{_file_type="xml"} - /directory/{_file_type="dir"} + /RAR self-extracting archive/{_file_type="rarexe"; exit} + /RAR archive data/{_file_type="rar"; exit} + /Zip archive data/{_file_type="zip"; exit} + /SAPCAR archive data/{_file_type="sapcar"; exit} + /XML/&&/ASCII/{_file_type="xml"; exit} + /directory/{_file_type="dir"; exit} END{print _file_type}') if [[ ${_GENERIC_FILE_TYPE}. == "rarexe." ]]; then _list_content="${_LSAR_COMMAND}" @@ -241,23 +241,23 @@ for _FILE in "$@"; do SAP_FILE_TYPE_FROM_FILENAME=$(echo "${_FILE}" | awk ' BEGIN{_sap_file_type="look_inside"} - /SAPCAR/&&/\.EXE/{_sap_file_type="sapcar"} - /IMDB_SERVER/&&/\.SAR/{_sap_file_type="saphana"} - /IMDB_CLIENT/&&/\.SAR/{_sap_file_type="saphana_client"} - !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="saphana_other"} - /SWPM/&&/\.SAR/{_sap_file_type="sap_swpm"} - /SAPHOSTAGENT/&&/\.SAR/{_sap_file_type="sap_hostagent"} - /SAPEXE_/{_sap_file_type="sap_kernel"} - /SAPEXEDB_/{_sap_file_type="sap_kernel_db"} - /igsexe/||/igshelper/{_sap_file_type="sap_igs"} - /SAPWEBDISP_/{_sap_file_type="sap_webdisp"} - /SAPJVM/{_sap_file_type="sap_jvm"} - /ASEBC/{_sap_file_type="sapase_client"} - /COMPLETE/{_sap_file_type="saphana_backup"} - /S4/&&/LANG/{_sap_file_type="sap_s4hana_lang"} - /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"} - /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} - /VCH/&&/\.SAR/{_sap_file_type="saphana_vch_afl"} + /SAPCAR/&&/\.EXE/{_sap_file_type="sapcar"; exit} + /IMDB_SERVER/&&/\.SAR/{_sap_file_type="saphana"; exit} + /IMDB_CLIENT/&&/\.SAR/{_sap_file_type="saphana_client"; exit} + !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="saphana_other"; exit} + /SWPM/&&/\.SAR/{_sap_file_type="sap_swpm"; exit} + /SAPHOSTAGENT/&&/\.SAR/{_sap_file_type="sap_hostagent"; exit} + /SAPEXE_/{_sap_file_type="sap_kernel"; exit} + /SAPEXEDB_/{_sap_file_type="sap_kernel_db"; exit} + /igsexe/||/igshelper/{_sap_file_type="sap_igs"; exit} + /SAPWEBDISP_/{_sap_file_type="sap_webdisp"; exit} + /SAPJVM/{_sap_file_type="sap_jvm"; exit} + /ASEBC/{_sap_file_type="sapase_client"; exit} + /COMPLETE/{_sap_file_type="saphana_backup"; exit} + /S4/&&/LANG/{_sap_file_type="sap_s4hana_lang"; exit} + /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"; exit} + /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"; exit} + /VCH/&&/\.SAR/{_sap_file_type="saphana_vch_afl"; exit} END{print _sap_file_type}') if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. == "sap_kernel_db." ]]; then SAP_FILE_TYPE_FROM_FILENAME=$(eval "${_list_content}" "${_FILE}" | awk ' @@ -277,22 +277,22 @@ for _FILE in "$@"; do ${_GENERIC_FILE_TYPE}. == "xml." ]]; then _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' BEGIN{_sap_file_type="sap_unknown"} - /BD_SYBASE_ASE/{_sap_file_type="sapase"} - /ASEBC/{_sap_file_type="sapase_client"} - /MaxDB_7.9/{_sap_file_type="sapmaxdb"} - /19cinstall.sh/{_sap_file_type="oracledb"} - /OCL_LINUX_X86_64/{_sap_file_type="oracledb_client"} - /brtools/{_sap_file_type="oracledb_tools"} - /db2setup/{_sap_file_type="ibmdb2"} - /db6_update_client.sh/{_sap_file_type="ibmdb2_client"} - /db2aese_c.lic/{_sap_file_type="ibmdb2_license"} - /DATA_UNITS\/EXPORT/{_sap_file_type="sap_export_ecc"} - /EXP[0-9]/{_sap_file_type="sap_export_ecc_ides"} - /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"} - /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} - /DATA_UNITS\/SOLMAN/&&/_JAVA_UT/{_sap_file_type="sap_export_solman_java"} - / Date: Fri, 12 Apr 2024 16:08:53 +0200 Subject: [PATCH 2/3] sap_install_media_detect: Solve issue #699 --- roles/sap_install_media_detect/files/tmp/sapfile | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 034285ef6..ac26a8758 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -286,6 +286,7 @@ for _FILE in "$@"; do /db2setup/{_sap_file_type="ibmdb2"; exit} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"; exit} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"; exit} + /DATA_UNITS\/S4_JAVA/{_sap_file_type="sap_export_s4hana_java"; exit} /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"; exit} /DATA_UNITS\/EXPORT/{_sap_file_type="sap_export_ecc"; exit} /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"; exit} From fd0296fa1e39a12267bca664671a71457140fb93 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 12 Apr 2024 18:05:40 +0200 Subject: [PATCH 3/3] sap_install_media_detect: No need for a new file type According to further testing, the new file type sap_export_s4hana_java is not required. File 51057035 will be detected as type sap_export_nwas_java, which should be sufficient for correct processing. Signed-off-by: Bernd Finger --- roles/sap_install_media_detect/files/tmp/sapfile | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index ac26a8758..034285ef6 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -286,7 +286,6 @@ for _FILE in "$@"; do /db2setup/{_sap_file_type="ibmdb2"; exit} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"; exit} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"; exit} - /DATA_UNITS\/S4_JAVA/{_sap_file_type="sap_export_s4hana_java"; exit} /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"; exit} /DATA_UNITS\/EXPORT/{_sap_file_type="sap_export_ecc"; exit} /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"; exit}