@@ -369,16 +369,29 @@ ip_info_file="/etc/update-motd.d/20-ip-info"
369369ldconfig 2> /dev/null || true
370370tolog " 93. Update library cache"
371371
372- # Restore the systemd-osc-context script if it was previously diverted
373- # rm /etc/profile.d/80-systemd-osc-context.sh
374- # dpkg-divert --remove --rename /etc/profile.d/80-systemd-osc-context.sh
372+ # Restore the systemd-osc-context script if it was previously disabled:
373+ # dpkg-divert --remove --rename --divert /usr/lib/systemd/profile.d/80-systemd-osc-context.sh.diverted /usr/lib/systemd/profile.d/80-systemd-osc-context.sh
374+ # dpkg-divert --remove --no-rename --divert /etc/profile.d/80-systemd-osc-context.sh.diverted /etc/profile.d/80-systemd-osc-context.sh
375+ # systemd-tmpfiles --create /usr/lib/tmpfiles.d/20-systemd-osc-context.conf
375376#
376- # Disable the systemd-osc-context script
377- systemd_osc_context=" /etc/profile.d/80-systemd-osc-context.sh"
378- [[ -f " ${systemd_osc_context} " ]] && {
379- dpkg-divert --add --rename /etc/profile.d/80-systemd-osc-context.sh 2> /dev/null
377+ # Disable the systemd-osc-context script (OSC 3008, UAPI.15)
378+ systemd_osc_context_lib=" /usr/lib/systemd/profile.d/80-systemd-osc-context.sh"
379+ systemd_osc_context_etc=" /etc/profile.d/80-systemd-osc-context.sh"
380+ [[ -f " ${systemd_osc_context_lib} " ]] && {
381+ # 1. Divert the real script and leave a neutered stub in its place
382+ dpkg-divert --add --rename \
383+ --divert " ${systemd_osc_context_lib} .diverted" \
384+ " ${systemd_osc_context_lib} " > /dev/null 2>&1
385+ echo " Neutered locally via dpkg-divert." > " ${systemd_osc_context_lib} " 2> /dev/null
386+
387+ # 2. Divert the /etc path too
388+ dpkg-divert --remove --no-rename " ${systemd_osc_context_etc} " > /dev/null 2>&1
389+ dpkg-divert --add --no-rename \
390+ --divert " ${systemd_osc_context_etc} .diverted" \
391+ " ${systemd_osc_context_etc} " > /dev/null 2>&1
392+
380393 tolog " 94. Disable the systemd-osc-context script"
381- }
394+ } || true
382395
383396# Show end message
384397tolog " All system fixes applied successfully."
0 commit comments