Skip to content

Bash tool to convert APT .list files (One-Line-Style) to .sources files (Deb822 format) and vice-versa

License

Notifications You must be signed in to change notification settings

ErikMichelson/apt-deb822-tool

Repository files navigation

APT Deb822 Tool

This is a bash implementation of a parser for APT entries in "One-Line-Style Format" (.list file) as well as entries in "Deb822-style Format" (.sources file). The tool allows to convert between both formats back and forth.

Features

  • Conversion from One-Line-Style format to Deb822 format and vice versa
  • Read a whole directory (like /etc/apt/sources.list.d) and operate only on files with the right extension
  • Create backup files of the originals

Installation

  1. Clone this repository to a location of your choice
  2. Run make install or copy the file from the src directory somewhere and make it executable

Usage

Use apt-deb822-tool in your terminal.

There are two modes: to-deb822 and to-list. It is mandatory to specify one of these modes as an argument.

You can specify an arbitrary amount of files and/or directories afterwards. Directories will be walked through recursively while only files with a matching file extension will be used (unless --all-extensions is given as an option).

The conversion result is output on STDOUT unless the option --write is given. In latter case, the result will be written to a file with the right extension next to the source file. Output on STDOUT for multiple input files is delimited by a NULL byte, so further processing with tools like xargs is possible.

You can enable verbose output mode by adding the --verbose option. Verbose output is written to STDERR.

Use the --help option for more information.

Dependencies

This tool only requires basic system dependencies (coreutils, findutils) that should be installed on every Debian and Ubuntu out of the box. The minimum bash version required is 5.0.

Known limitations

  • Embedded PGP public keys in the Signed-By field in Deb822 format are not supported yet

Development

To run the tests, install bats-core and bats-file, and run make test.

About

Bash tool to convert APT .list files (One-Line-Style) to .sources files (Deb822 format) and vice-versa

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published