Exercise: Build Multiple Packages Using Separate Install Targets
Build multiple packages using separate install targets.
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 separate install targets.
-
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 thescores
file and calculates their average. If thescores
file is empty, it prints a message informing the user of that and displays the messageNo file found
if no such file exists.
To complete the task, you need to perform the following steps:
-
In the
Makefile
, add statements to install the filescalculate-average
andscores
separately to the location where they are expected to be found bydh_builddeb
. -
Make the necessary changes, if any in the
control
andrules
files of thecalculate-average/debian
directory to build the packagescalculate-average
andcalculate-average-data
. -
In the
debian/rules
file, override thedh_auto_install
step to callmake install_binary
andmake install_data
with the appropriate install targets and the locations where the files can be found bydh_builddeb
.
After these file modifications, perform the following steps:
-
Build and install the
calculate-average-data
package and then thecalculate-average
package. -
If your package is built successfully, typing
calculate-average
will display an average of the scores present in the filescores
.
Get hands-on with 1300+ tech skills courses.