Skyedra / UnspamifyUbuntu

Remove spam from Ubuntu
MIT License
152 stars 9 forks source link

Suggestions #3

Open dampfklon opened 1 year ago

dampfklon commented 1 year ago

Thank for maintaining this helpful overview.

After implementing the changes i found two possible improvements

  1. apt-get purge ubuntu-advantage-tools after installing the fake package. This automatically removes the hole /var/lib/ubuntu-advantage directory seems the cleaner way than removing only the cached messages.
  2. In /usr/lib/update-notifier/apt_check.py instead of changing the two functions you can change the Line ESM_INFRA_ORIGIN = "UbuntuESM" to some other value like ESM_INFRA_ORIGIN = "UbuntuESM_disabled" which disables the messages without changing actual code. The command would be like sudo sed -Ezi.orig 's/ESM_INFRA_ORIGIN = "UbuntuESM"/ESM_INFRA_ORIGIN = "UbuntuESM_disabled"/' /usr/lib/update-notifier/apt_check.py
Skyedra commented 1 year ago

Thanks for the suggestions, will look into these when I have a bit :)

Xon commented 1 year ago

That isn't actually enough to stop /usr/lib/update-notifier/apt-check --human-readable from outputting a bunch of spammy text;

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

There are actually two lines to be changes, from:

    have_esm_infra = has_esm_service(cache, esm_origin=ESM_INFRA_ORIGIN)
    have_esm_apps = has_esm_service(cache, esm_origin=ESM_APPS_ORIGIN)

to

    have_esm_infra = None
    have_esm_apps = None

Which is much simpler than patching the functions and fully supressed the ESM related messages.

Skyedra commented 1 year ago

Great idea, thanks!

dampfklon commented 1 year ago

Thats exactly what happens when you set ESM_INFRA_ORIGIN = "UbuntuESM_disabled" as the check returns None

banagale commented 1 year ago

The command would be like

sudo sed -Ezi.orig 's/ESM_INFRA_ORIGIN = "UbuntuESM"/ESM_INFRA_ORIGIN = >"UbuntuESM_disabled"/' /usr/lib/update-notifier/apt_check.py

I don't know if this was intended to fully replace the readme's current:

sudo sed -Ezi.orig \
  -e 's/(def _output_esm_service_status.outstream, have_esm_service, service_type.:\n)/\1    return\n/' \
  -e 's/(def _output_esm_package_alert.*?\n.*?\n.:\n)/\1    return\n/' \
  /usr/lib/update-notifier/apt_check.py

But I tried the former on Ubuntu 18.04.06 followed by the regen line and it did not remove the message mentioned by @Xon

I then tried the latter (current readme method) followed by the regen line and that did work.