@@ -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+
247288delete_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 ;;
710759staging)
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 ;;
714763enabledSol)
0 commit comments