Skip to content

Commit 9bef0df

Browse files
authored
Merge pull request #176 from angelabriel/master
Fix for bsc#1244077
2 parents ad18ae9 + 1da7cfc commit 9bef0df

File tree

8 files changed

+151
-44
lines changed

8 files changed

+151
-44
lines changed

ospackage/bin/saptune_check

100644100755
Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# ------------------------------------------------------------------------------
3-
# Copyright (c) 2019 SUSE LLC
3+
# Copyright (c) 2019-2025 SUSE LLC
44
#
55
# This program is free software; you can redistribute it and/or modify it under
66
# the terms of version 3 of the GNU General Public License as published by the
@@ -39,8 +39,9 @@
3939
# 31.10.2024 v0.4.1 added --force-color to support forced colored output by saptune
4040
# 16.01.2025 v0.4.2 a failed sapconf.service causes just a warning an remediation is now correct
4141
# 21.03.2025 v0.4.3 fix missing warning increment if saptune.service is inactive
42+
# 04.06.2025 v0.5 adaption to SLE16 and the new config file location
4243

43-
declare -r VERSION="0.4.3"
44+
declare -r VERSION="0.5"
4445

4546
# We use these global arrays through out the program:
4647
#
@@ -54,6 +55,19 @@ declare -A package_version os_version system_status unit_state_active unit_state
5455

5556
color=1 # we like it colorful
5657

58+
function define_config_file() {
59+
local VERSION_ID
60+
eval $(grep ^VERSION_ID= /etc/os-release)
61+
case ${VERSION_ID} in
62+
12*|15*)
63+
saptune_config=/etc/sysconfig/saptune
64+
;;
65+
16*)
66+
saptune_config=/var/lib/saptune/config/saptune
67+
;;
68+
esac
69+
}
70+
5771
function header() {
5872
[ ${DO_JSON} -ne 0 ] && return
5973
local len=${#1}
@@ -668,9 +682,9 @@ function get_tool_profiles() {
668682
[ -e /etc/tuned/active_profile ] && active_profile=$(< /etc/tuned/active_profile)
669683
tool_profile['tuned']="${active_profile:-missing}"
670684

671-
if [ -e /etc/sysconfig/saptune ] ; then
672-
eval $(grep ^TUNE_FOR_NOTES= /etc/sysconfig/saptune)
673-
eval $(grep ^TUNE_FOR_SOLUTIONS= /etc/sysconfig/saptune)
685+
if [ -e ${saptune_config} ] ; then
686+
eval $(grep ^TUNE_FOR_NOTES= ${saptune_config})
687+
eval $(grep ^TUNE_FOR_SOLUTIONS= ${saptune_config})
674688
if [ -z "${TUNE_FOR_NOTES}" -a -z "${TUNE_FOR_SOLUTIONS}" ] ; then
675689
tool_profile['saptune']='missing'
676690
else
@@ -694,7 +708,7 @@ function configured_saptune_version() {
694708
# Requires: -
695709

696710
local SAPTUNE_VERSION
697-
[ -e /etc/sysconfig/saptune ] && eval $(grep ^SAPTUNE_VERSION= /etc/sysconfig/saptune)
711+
[ -e ${saptune_config} ] && eval $(grep ^SAPTUNE_VERSION= ${saptune_config})
698712
configured_saptune_version="${SAPTUNE_VERSION:-missing}"
699713
}
700714

@@ -772,6 +786,14 @@ function file_check() {
772786
;;
773787
esac
774788
;;
789+
16*)
790+
case ${tag} in
791+
saptune-3)
792+
mandatory_files=( '/var/lib/saptune/config/saptune' )
793+
invalid_files=( '/etc/saptune/extra/SAP_ASE-SAP_Adaptive_Server_Enterprise.conf' '/etc/saptune/extra/SAP_BOBJ-SAP_Business_OBJects.conf' '/etc/sysconfig/saptune-note-1275776' '/etc/sysconfig/saptune-note-1557506' '/etc/sysconfig/saptune-note-SUSE-GUIDE-01' '/etc/sysconfig/saptune-note-SUSE-GUIDE-02' '/etc/tuned/saptune' '/etc/sysconfig/saptune' )
794+
;;
795+
esac
796+
;;
775797
esac
776798

777799
# Leftovers from a damaged sapconf update/removal, which do not pervent saptune from starting.
@@ -1118,6 +1140,9 @@ done
11181140
eval $(grep ^ID= /etc/os-release)
11191141
[ "${ID}" != "sles" ] && { echo "Only SLES is supported! Your OS ID is ${ID}! Exiting." ; exit 2 ; }
11201142

1143+
# Define main saptune configuration file
1144+
define_config_file
1145+
11211146
# Introduction.
11221147
intro
11231148

ospackage/usr/share/saptune/scripts/upd_helper

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,47 @@ change_note_names() {
244244
done
245245
}
246246

247+
enabled_sol_to_be_deleted() {
248+
esol=$(grep '^TUNE_FOR_SOLUTIONS[[:space:]]*=' $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
249+
if [ -n "$esol" ]; then
250+
# enabled solution found
251+
for delsol in $SOLS2DELETE; do
252+
if [ "${esol}.sol" == "$delsol" ]; then
253+
# enabled solution will be deleted
254+
return 0
255+
fi
256+
done
257+
fi
258+
return 1
259+
}
260+
261+
delete_sols() {
262+
esol=$(grep '^TUNE_FOR_SOLUTIONS[[:space:]]*=' $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
263+
if enabled_sol_to_be_deleted; then
264+
# enabled solution found, which will be deleted
265+
echo "enabled Solution '$esol' will be deleted, adjust config"
266+
# extract notes of enabled solution from the note definition
267+
if [ -f ${OVERRIDEDIR}/"${esol}".sol ]; then
268+
# file found in the override area
269+
SOLNOTES=$(awk '/\[ArchX86\]/ {getline; print $0}' ${OVERRIDEDIR}/"${esol}".sol)
270+
echo "WARNING: override file for enabled Solution '${esol}' detected. As this Solution will be no longer available, please remove your override file"
271+
else
272+
# file found in the working area
273+
SOLNOTES=$(awk '/\[ArchX86\]/ {getline; print $0}' ${WORKINGAREA}/sols/"${esol}".sol)
274+
fi
275+
# for each note from the solution check, if note is in
276+
# NOTE_APPLY_ORDER. If not, skip note (do nothing).
277+
# Else add note to TUNE_FOR_NOTES, if not yet available
278+
add_TUNE_FOR_NOTES "$SOLNOTES" "$esol" "from deleted"
279+
# delete solution from TUNE_FOR_SOLUTIONS
280+
echo "### removing solution '$esol' from TUNE_FOR_SOLUTIONS"
281+
sed -i "s/$esol//g" $SAPTUNE_CONFIG
282+
fi
283+
# do nothing for not enabled solution (no need to adjust the config)
284+
# remove of solution definition files will be done later in
285+
# adjust_workingarea
286+
}
287+
247288
delete_notes() {
248289
for delnote in $NOTES2DELETE; do
249290
if [ ! -f ${NOTEDIR}/"${delnote}" ]; then
@@ -304,10 +345,15 @@ adjust_enabled_solution() {
304345
# need to run before the working area is touched in the postinstall
305346
# only needed, if staging is NOT active and a solution is enabled and no
306347
# override file exists.
348+
# no need to run, if the solution will be deleted
307349
# The staging is checked in the postinstall, so no need to do it again.
308350
# If an override file for the enabled solution exists, we will NOT change
309351
# anything. It is up to the customer to check and adjust after the update
310352
esol=$(grep '^TUNE_FOR_SOLUTIONS[[:space:]]*=' $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
353+
if enabled_sol_to_be_deleted; then
354+
echo "enabled Solution '$esol' detected, which will be deleted later. No need to adjust"
355+
return 0
356+
fi
311357
if [ -n "$esol" ] && [ ! -f ${OVERRIDEDIR}/"${esol}".sol ]; then
312358
# enabled solution found, override does not exist
313359
# extract notes of enabled solution from the solution definition file
@@ -375,7 +421,7 @@ adjust_enabled_solution() {
375421
fi
376422
done
377423
add_NOTE_APPLY_ORDER "$NOTES2ADD" "$esol"
378-
delete_NOTE_APPLY_ORDER "$NOTES2REM" "$esol"
424+
add_TUNE_FOR_NOTES "$NOTES2REM" "$esol" "deleted from"
379425
fi
380426
if [ -n "$esol" ] && [ -f ${OVERRIDEDIR}/"${esol}".sol ]; then
381427
echo "WARNING: override file for enabled Solution '${esol}' detected. As the content of this Solution changed, please check and adapt your override file"
@@ -409,9 +455,10 @@ add_NOTE_APPLY_ORDER() {
409455
done
410456
}
411457

412-
delete_NOTE_APPLY_ORDER() {
458+
add_TUNE_FOR_NOTES() {
413459
del_notes="$1"
414460
sol="$2"
461+
txt="$3"
415462
apply_list=$(grep '^NOTE_APPLY_ORDER[[:space:]]*=' $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
416463

417464
for fnote in $del_notes; do
@@ -423,16 +470,17 @@ delete_NOTE_APPLY_ORDER() {
423470
if [ "$dnote" == "$fnote" ]; then
424471
# don't touch NOTE_APPLY_ORDER, but
425472
# append Note to TUNE_FOR_NOTES, if not yet available
426-
add_TUNE_FOR_NOTES "$fnote" "$sol"
473+
append_TUNE_FOR_NOTES "$fnote" "$sol" "$txt"
427474
fi
428475
done
429476
done
430477
}
431478

432-
add_TUNE_FOR_NOTES() {
479+
append_TUNE_FOR_NOTES() {
433480
# append Note to TUNE_FOR_NOTES, if not yet available.
434481
notes="$1"
435482
sol="$2"
483+
txt="$3"
436484
notes_list=$(grep '^TUNE_FOR_NOTES[[:space:]]*=' $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
437485

438486
for fnote in $notes; do
@@ -445,7 +493,7 @@ add_TUNE_FOR_NOTES() {
445493
done
446494
if [ "$found" == "false" ]; then
447495
if [ -n "$sol" ]; then
448-
echo "### appending the Note '$fnote' deleted from Solution '$sol' to 'TUNE_FOR_NOTES' in '$SAPTUNE_CONFIG'"
496+
echo "### appending the Note '$fnote' $txt Solution '$sol' to 'TUNE_FOR_NOTES' in '$SAPTUNE_CONFIG'"
449497
sed -i "/^TUNE_FOR_NOTES[[:space:]]*=.*/s/\"$/ $fnote\"/" $SAPTUNE_CONFIG
450498
#else # for future use
451499
fi
@@ -686,6 +734,7 @@ sleto16pt)
686734
# important for note delete, sol delete and note changes in sols
687735
# needs to run always
688736
change_note_names
737+
delete_sols
689738
delete_notes
690739
staging=$(grep ^STAGING= $SAPTUNE_CONFIG | awk -F '"' '{ print $2 }')
691740
if [ "$staging" == "false" ]; then
@@ -708,7 +757,7 @@ cleanup)
708757
cleanup_savestates
709758
;;
710759
staging)
711-
# called from the postinstall script of saptune to handle the staging area
760+
# called from the posttrans script of saptune to handle the staging area
712761
copy_packednotes2staging
713762
;;
714763
enabledSol)

ospackage/usr/share/saptune/sols_16/HANA.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DESCRIPTION=Definition of HANA solution for SLE16
55
REFERENCES=
66

77
[ArchX86]
8-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
8+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250
99

1010
[ArchPPC64LE]
11-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
11+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250

ospackage/usr/share/saptune/sols_16/NETWEAVER+HANA.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DESCRIPTION=Definition of NETWEAVER+HANA solution for SLE16
55
REFERENCES=
66

77
[ArchX86]
8-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
8+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250
99

1010
[ArchPPC64LE]
11-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
11+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250

ospackage/usr/share/saptune/sols_16/S4HANA-APP+DB.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DESCRIPTION=Definition of S4HANA-APP+DB solution for SLE16
55
REFERENCES=
66

77
[ArchX86]
8-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
8+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250
99

1010
[ArchPPC64LE]
11-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
11+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250

ospackage/usr/share/saptune/sols_16/S4HANA-DBSERVER.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DESCRIPTION=Definition of S4HANA-DBSERVER solution for SLE16
55
REFERENCES=
66

77
[ArchX86]
8-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
8+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250
99

1010
[ArchPPC64LE]
11-
941735 3565382 1868829 3577842 2382421 2534844 2993054 1656250
11+
941735 3565382 1868829 1980196 3577842 2382421 2534844 2993054 1656250

0 commit comments

Comments
 (0)