sap-hana-ha/create-rename-patches.sh

55 lines
1.7 KiB
Bash
Raw Normal View History

2024-11-25 14:49:20 +00:00
#!/usr/bin/bash
# NAME = name of the source unpack dir
NAME="sap-hana-ha-87a5781"
# BROOT = build root
# Enable this path when using 'rpmbuild -bp'.
# In the .spec file this requires '%autopatch -p 6'.
# BROOT="${HOME}/rpmbuild/BUILD/${NAME}"
# Use this path with 'rhpkg prep', e.g. 'rhpkg --release rhel-10.0 prep'.
BROOT="${NAME}"
RAPATH="${BROOT}/ra/"
SRHOOKPATH="${BROOT}/srHook/"
TOOLSPATH="${BROOT}/tools/"
PATTERN="provider_company|susChkSrv|suschksrv|sustkover_timeout|susHanaSR|sushanasr|suse_SAPHanaFilesystem|SAPHanaSR-angi"
# patch100 - patterns in the srHook/ path
PNAME="patch100"
grep -rlE "${PATTERN}" "${SRHOOKPATH}" | xargs sed -i."${PNAME}" \
-e 's/\("provider_company": \)"SUSE"/\1"Red Hat"/g' \
-e 's/susChkSrv/ChkSrv/g' \
-e 's/suschksrv/chksrv/g' \
-e 's/susTkOver/TkOver/g' \
-e 's/sustkover/tkover/g' \
-e 's/susHanaSR/HanaSR/g' \
-e 's/sushanasr/hanasr/g' \
-e 's/SAPHanaSR-angi/sap-hana-ha/g'
gendiff "${BROOT}" ."${PNAME}" >patterns-srHook-files.patch
# patch101 - patterns in the ra/ path
PNAME="patch101"
grep -rlE "${PATTERN}" "${RAPATH}" | xargs sed -i."${PNAME}" \
-e 's/suse_SAPHanaFilesystem/heartbeat_SAPHanaFilesystem/g' \
-e 's/SAPHanaSR-angi/sap-hana-ha/g'
gendiff "${BROOT}" ."${PNAME}" >patterns-ra-files.patch
# patch102 - patterns in the tools/ path
PNAME="patch102"
grep -rlE "${PATTERN}" "${TOOLSPATH}" | xargs sed -i."${PNAME}" \
-e 's/susChkSrv/ChkSrv/g' \
-e 's/suschksrv/chksrv/g' \
-e 's/susTkOver/TkOver/g' \
-e 's/sustkover/tkover/g' \
-e 's/susHanaSR/HanaSR/g' \
-e 's/sushanasr/hanasr/g' \
-e 's/SAPHanaSR-angi/sap-hana-ha/g'
gendiff "${BROOT}" ."${PNAME}" >patterns-tools-files.patch
exit 0