Skip to content

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries (as requested in https://askubuntu.com/a/762815/175814).

License

Notifications You must be signed in to change notification settings

intraspeciespredator161/aptsources-cleanup

 
 

Repository files navigation

Purpose

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries in /etc/sources.list and /etc/sources.list.d/*.list.

Prerequisites

  • Python 3.2+ (or Python 2.7+ if you really can't use Python 3)

  • The aptsources module. In Debian-based distribution you can find it in the python3-apt package (or python-apt if you only have Python 2).

    If you don't have it yet you can install it with:

    sudo apt-get install python3-apt
    

Download

You can download a pre-bundled ZIP file executable by your Python interpreter:

Or you can download the source code and run it in Python albeit without translations.

Usage

  • From a ZIP bundle:

    sudo python3 -OEs aptsources-cleanup.zip
    

    I advise the use of the above interpreter options -OEs to avoid potential issues with your Python environment but they aren't strictly necessary.

  • From source code:

    sudo ./aptsources-cleanup
    

For a (slightly more) detailed description and individual command-line options see the output of

python3 -OEs aptsources-cleanup.zip --help

or

./aptsources-cleanup --help

depending on the deployment type.

About

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries (as requested in https://askubuntu.com/a/762815/175814).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 91.7%
  • Makefile 5.1%
  • Shell 3.2%