Today we're going to look at building meta-packages and doing it fast and easy, and for laughs, we're throwing in a quick repo howto.
This is a quick way to define your own meta-packages and build a small internal repo for local packages or testing. It should not be used for a larger internet hosted mirror, or for any larger distribution, there's better options for that.

For building a private "real" package repository, see Private APT repo with reprepro.

So, okay. Let's go build a meta package first, so we have something to distribute to the clients. Here I'm doing a basic metapackage that installs a couple of libreoffice components. Note it can be anything, so get creative, depending on what your distribution offers in it's package list :)

First up, what do we need ?. For a Debian based host, we need the packages called equivs, so install it.

apt install equivs

Next up, we call the command equivs-control with the filename we want for our new package. Mine's blackdragon-meta-officedesktop, and why's that ?.
Because in Kali, their packages start with kali-tools-package, so this is an easy way to differentiate mine from kali's packages, and a easy way to figure out what the meta package does.
So, it's a good idea to think a bit about how to name your packages, and the different sections, if you're building more. Remember when searching for packages you can use wildcards, so looking for something like blackdragon-* would list all my packages, and not everyone elses.

So, we have a name, call equivs-control with the name

equiv-control blackdragon-meta-officedesktop

Let's see an example file generated by the equivs-control command.

cat blackdragon-meta-officedesktop
### Commented entries have reasonable defaults.
### Uncomment to edit them.
# Source: <source package name; defaults to package name>
Section: misc
Priority: optional
Homepage: https://www.blackdragon.se
Standards-Version: 3.9.2

Package: Package-name-goes-here
Version: 1.0
Maintainer: your name and email
Depends: libreoffice-base,libreoffice-base-core,libreoffice-draw,libreoffice-calc,libreoffice-writer
#Pre-Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
# Provides: <comma-separated list of packages>
# Replaces: <comma-separated list of packages>
# Architecture: all
# Multi-Arch: <one of: foreign|same|allowed>
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>                                                                                                        
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files for the doc directory>
# Links: <pair of space-separated paths; First is path symlink points at, second is filename of link>
# Files: <pair of space-separated paths; First is file to include, second is destination>
#  <more pairs, if there's more than one file to include. Notice the starting space>
Description: Blackdragon Meta office package 
 Install Blackdragon office packages.
 Libreoffice-writer,base, calc og draw.
 .
 The same as the libreoffice metapackage, but in time this will contain other stuff as well, so they are NOT the same.

There's only a couple of things we need to change, and they are Package, Maintainer, Depends and Description. Remember in the Description, a line have to start with an empty space, and line's not used, with a space and a dot .
For finding package names, you can use apt-cache search or apt search packagename, like so. And for listing info, use apt info packagename.

apt search libreoffice-writer

Sortering... Færdig
Fuldtekst-søgning... Færdig

libreoffice-writer/kali-rolling,now 1:7.0.4-3 amd64 [Installeret,automatisk]
  office productivity suite -- word processor

apt info  libreoffice-writer

Package: libreoffice-writer
Version: 1:7.0.4-3
Priority: optional
Section: editors
Source: libreoffice
Maintainer: Debian LibreOffice Maintainers <This email address is being protected from spambots. You need JavaScript enabled to view it.>
Installed-Size: 40,3 MB
Depends: libreoffice-base-core (= 1:7.0.4-3), libreoffice-common (>= 1:7.0.0~alpha~), libreoffice-core (= 1:7.0.4-3), ucf (>= 0.8), libabw-0.1-1, libc6 (>= 2.29), libe-book-0.1-1, libepubgen-0.1-1, libetonyek-0.1-1, libgcc-s1 (>= 3.0), libicu67 (>= 67.1-1~), libmwaw-0.3-3, libodfgen-0.1-1, librevenge-0.0-0, libstaroffice-0.0-0, libstdc++6 (>= 9), libuno-cppu3 (>= 4.4.0~alpha), libuno-cppuhelpergcc3-3 (>= 5.3.0~alpha), libuno-sal3 (>= 5.3.0~alpha), libuno-salhelpergcc3-3 (>= 1.4.0), libwpd-0.10-10, libwpg-0.3-3, libwps-0.4-4, libxml2 (>= 2.8), uno-libs-private, zlib1g (>= 1:1.1.4)
Recommends: libreoffice-math
Suggests: fonts-crosextra-caladea, fonts-crosextra-carlito, libreoffice-base, libreoffice-java-common (>= 1:7.0.4~), default-jre (>= 2:1.8) | java8-runtime | jre
Breaks: libreoffice-common (<< 1:6.4.2~rc1~)
Replaces: libreoffice-common (<< 1:6.4.2~rc1~)
Homepage: http://www.libreoffice.org
Tag: implemented-in::c++, interface::graphical, interface::x11,
 role::program, scope::application, use::editing, use::text-formatting,
 works-with::text, x11::application
Download-Size: 9.143 kB
APT-Manual-Installed: no
APT-Sources: http://http.kali.org/kali kali-rolling/main amd64 Packages
Description: office productivity suite -- word processor
 LibreOffice is a full-featured office productivity suite that provides
 a near drop-in replacement for Microsoft(R) Office.
 .
 This package contains the wordprocessor component for LibreOffice.

When you're done editing the metapackage file, build the package with

equivs-build <package-file-name-here>

so in my case, it would be

equivs-build  blackdragon-meta-officedesktop

Now, we need to set up and APT repo, and this is just a quick way of doing it, for a local testing repo. Here I'm using the Python3 http server module, but it's the same for Apache2. First create a directory to hold the package, mine's /opt/testrepo

mkdir /opt/testrepo


Copy you shiny new package to the repo directory :)

cp blackdragon-meta-officedesktop_1.0_all.deb /opt/testrepo

Next, we need to generate a Packages.gz file, and we do that from the test repo directory like so

dpkg-scanpackages . | gzip -c9  > Packages.gz

On the client, we weed to add a line to /etc/apt/sources.list, with our new repo info. so let's do that now.

deb [trusted=yes] http://IP.OF.SERVER/ ./

Note that we use [trusted=yes], because we need to tell APT to trust the repo, or else we'll get an error when we try to use it. ONLY do this if you really trust the repo and the maintainer / owner. In this case we do :)

When we're ready, let's call python and launch the webserver module.

#From the webroot where out Packages.gz file and packages are.

python3 -m http.server 80

Next we update APT, and look for our packages, to see if it's there, and try to install it.

#update apt

apt update

#Look for package

apt search blackdragon-meta-*


#install it

apt install blackdragon-meta-*

If you did everything right, it should now install. If it did, congrat's, now you know how to build and deploy a test repo, and build metapackages the Debian Way :)
And yes, you can use this tutorial to build Debian packages  also, they are almost identical, even though I'm running Kali :)

You have no rights to post comments