Exercise: Build Multiple Packages Using dh_install

Build and install multiple packages using the dh_install tool.

We'll cover the following

Task

In this exercise, you are required to create multiple binary packages (calculate-average and calculate-average-data) from one source package (calculate-average) using the tool dh_install.

  • You are given a scores file with the content consisting of numbers on each line.

  • You are also given a calculate-average.c file, which reads the numbers from the scores file and calculates their average. If the scores file is empty, it prints a message informing the user and displays the message No file found in case no such file exists.

To complete the task, you need to perform the following steps:

  1. In the Makefile, add statements to install the calculate-average binary and scores data file separately.

  2. Make the necessary changes, if any, in the control and rules files of the calculate-average/debian directory to build the calculate-average package.

  3. Write to the two .install files in the debian/ directory and specify the relevant relative paths.

After these file modifications, perform the following steps:

  1. Ensure that the *.install files are not executable by running chmod -x <filename>.

  2. Enter the commands to build the .deb packages.

  3. Once the Debian packages are built, install the calculate-average-data package first and then install the calculate-average package.

  4. If your package is built successfully, typing calculate-average will display an average of the scores present in the scores file.

Get hands-on with 1400+ tech skills courses.