Skip to content

Instantly share code, notes, and snippets.

@neklaf
Last active April 29, 2020 09:21
Show Gist options
  • Save neklaf/b98efc970d1569e6f88ec4b14c66b148 to your computer and use it in GitHub Desktop.
Save neklaf/b98efc970d1569e6f88ec4b14c66b148 to your computer and use it in GitHub Desktop.
Modifying and repack a Debian GNU/Linux package

Creating directory structure

$ mkdir -p newdeb olddeb/DEBIAN

Extracting package content:

$ dpkg-deb -x libapache2-mod-auth-openidc_2.4.1-1.buster+1_amd64.deb olddeb/

Extract control information files

$ dpkg-deb -e libapache2-mod-auth-openidc_2.4.1-1.buster+1_amd64.deb olddeb/DEBIAN

Checking package directory structure

$ tree
.
├── DEBIAN
│   ├── conffiles
│   ├── control
│   ├── md5sums
│   └── postinst
├── etc
│   └── apache2
│       └── mods-available
│           ├── auth_openidc.conf
│           └── auth_openidc.load
├── usr
│   ├── lib
│   │   └── apache2
│   │       └── modules
│   │           ├── mod_auth_openidc.BACKUP
│   │           └── mod_auth_openidc.so
│   └── share
│       └── doc
│           └── libapache2-mod-auth-openidc
│               ├── changelog.Debian.gz
│               ├── changelog.gz
│               ├── copyright
│               └── README.md.gz
└── var
    └── cache
        └── apache2
            └── mod_auth_openidc
                └── metadata

Modify package content and update its version

$ vim olddeb/DEBIAN/control
...
Version: 2.0
...

Repackage files in a new package

$ dpkg-deb -Z xz  -b olddeb newdeb
$ mv newdeb libapache2-mod-auth-openidc_2.4.1-2.buster+1_amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment