COMP 3000 Lab 5 2012

From Soma-notes
Jump to navigation Jump to search

In this lab you will be creating a new package for ubuntu called netcat-comp3000, based on the netcat-traditional package. We will be grading the .deb file you create using scripts, so be sure to follow the directions below carefully!

(Note that there exist other netcat packages, such as netcat-openbsd. Please use netcat-traditional for this lab!)

You will submit a file netcat-comp3000_1.10-39comp3000_amd64.deb or netcat-comp3000_1.10-39comp3000_i386.deb, depending on whether you are running a 64 or 32-bit version of Ubuntu 12.04. The answers to Part A should appear in a file /usr/share/doc/netcat-comp3000/PART-A when the package is installed, with each answer appearing on one line, and with the very first answer appearing on the very first line of the file. This file MUST be a UNIX text file (delimited by LF)!

If you do not manage to finish Part B, just submit this answers file for partial credit.

NOTE: The password for the COMP 3004 Ubuntu VM's admin account has been changed to nimda!

This lab is due Wednesday, Nov. 7, by 11:55 PM via cuLearn. (extended)

Part A

Note the answers for this part go in a file PART-A, with each answer on a line by itself, starting with the first line. There should be no line numbers; just the commands that are asked for. Expect these answers to be graded automatically!

  1. Install the netcat-traditional package. Give the exact apt-get command you used to install it.
  2. Give the target of the symbolic link /etc/alternatives/nc.
  3. Give the command to make netcat (nc) listen on port 4000 for incoming connections and execute /usr/bin/bc on every connection. (Note it will be difficult to do this if you use the netcat-openbsd package.)
  4. Give the command needed to have netcat connect to the server you created in the previous question. Connect from the same machine, i.e., use "localhost" as the host. You can terminate a connection by typing Ctrl-D.
  5. Give the command line needed to extract the contents of the netcat-traditional package you installed into the directory CONTENTS, using the dpkg-deb command.
  6. Give the command line needed to extract the control files of the netcat-traditional package you installed into the directory CONTROL, using the dpkg-deb command.
  7. Install the dpkg-dev package. Give the exact apt-get command you used to install it.
  8. Install the fakeroot package. Give the exact apt-get command you used to install it.
  9. Install the quilt package. Give the exact apt-get command you used to install it.
  10. Download the unpacked source for netcat-traditional. Give the exact apt-get command you used to download the source.
  11. Give the command line needed to build the source package you downloaded, using dpkg-buildpackage and fakeroot, only building the binary packages.

Part B

Create a new netcat-traditional binary package (using the source package) with the following attributes:

  • [2] Make the name of the package netcat-comp3000 instead of netcat-traditional by editing debian/control and other files as necessary. Be sure to make yourself the maintainer and uploader, using your Carleton email address. Note your package should not be creating or touching any files normally created by netcat-traditional, except those that are generic netcat files (and that are controlled by the Debian alternatives infrastructure). In other words, you should be able to install netcat-comp3000 and netcat-traditional without any errors regarding file conflicts.
  • [2] The version should be set to 1.10-39comp3000 by editing the debian/changelog. Urgency should be low, version should be unstable. Only change is "* COMP 3000 Assignment". The timestamp should be when you make the change, and the maintainer should be you, giving your Carleton email address. (Note: emacs has a changelog mode!)
  • [1] The file PART-A should be installed in /usr/share/doc/netcat-comp3000 along with the other standard doc files for netcat-traditional.
  • [2] Make the binary installed nc.comp3000, not nc.traditional (start by editing the debian/rules file). Make sure it is installed as an alternative for nc (binary and man page).
  • [2] Make nc.comp3000 -h return the normal help message, appended with the line "Version for COMP 3000. Prepared by Jane Smith." Substitute your name for Jane Smith.
  • [2] Have the package install an upstart script that spawns bc on port 4000. Use the getty startup scripts (tty?.conf) as a model. You should need four lines of actual statements to make it work, perhaps less. Note that bc should always be running, even after someone has connected and exited.
  • [2] BONUS: Add a file /etc/default/nc.comp3000 that allows you to change the program that is spawned and the port being listened to by the instance started by upstart. The installed version of this file should default to the same command and port as before.