Visit Sudirman Saputra at Ping.sg Simple File Archive Debian | Gunting Batu Kertas Kendari
Loading...
Wednesday, July 24, 2013

Simple File Archive Debian

Simple File Archive

The Falcot Corp administrators need to create a Debian package in order to ease deployment of a set of documents on a large number of machines. The administrator in charge of this task first reads the “New Maintainer's Guide”, then starts working on their first package.


The first step is creating a falcot-data-1.0 directory to contain the target source package. The package will logically, be named falcot-data and bear the 1.0 version number. 
The administrator then places the document files in a data subdirectory. Then they invoke the dh_make command (from the dh-make package) to add files required by the package generation process, which will all be stored in a debian subdirectory:
$ cd falcot-data-1.0
$ dh_make --native

Type of package: single binary, indep binary, multiple binary, library, å kernel module, kernel patch or cdbs?
[s/i/m/l/k/n/b] i
Maintainer name : Raphael Hertzog
Email-Address : hertzog@debian.org
Date : Mon, 11 Apr 2011 15:11:36 +0200
Package Name : falcot-data
Version : 1.0
License : blank
Usind dpatch : no
Type of Package : Independent
Hit <enter> to confirm:
Currently there is no top level Makefile. This may require additional tuning.
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the falcot-data Makefiles install into $DESTDIR and not in / .

The selected type of package (single binary) indicates that this source package will generate a single binary package depending on the architecture (Architecture:any). indep binary acts as a
counterpart, and leads to a single binary package that is not dependent on the target architecture (Architecture:all). In this case, the latter choice is more relevant since the package only
contains documents and no binary programs, so it can be used similarly on computers of all architectures.
The multiple binary type corresponds to a source package leading to several binary packages. 

A particular case, library, is useful for shared libraries, since they need to follow strict packaging rules. In a similar fashion, kernel module should be restricted to packages containing kernel
modules. Finally, cdbs is a specific package build system; it is rather flexible, but it requires some amount of learning.

The dh_make command created a debian subdirectory with many files. Some are required, in particular rules, control, changelog and copyright. Files with the .ex extension are example
files that can used by modifying them (and removing the extension) when appropriate. When they are not needed, removing them is recommended. The compat file should be kept, since it
is required for the correct functioning of the debhelper suite of programs (all beginning with the dh_ prefix) used at various stages of the package build process.
The copyright file must contain information about the authors of the documents included in

the package, and the related license. In our case, these are internal documents and their use is restricted to within the Falcot Corp company. The default changelog file is generally appropriate;
replacing the “Initial release” with a more verbose explanation and changing the distribution from unstable to internal is enough. The control file was also updated: the section has
been changed to misc and the Homepage, Vcs-Git and Vcs-Browser fields were removed. The Depends fields was completed with iceweasel | www-browser so as to ensure the availability
of a web browser able to display the documents in the package.

Source: falcot-data
Section: misc
Priority: optional
Maintainer: Raphael Hertzog <hertzog@debian.org>
Build-Depends: debhelper (>= 7.0.50~)
Standards-Version: 3.8.4
Package: falcot-data
Architecture: all
Depends: iceweasel | www-browser, ${misc:Depends}

Description: Internal Falcot Corp Documentation This package provides several documents describing the internal structure at Falcot Corp. This includes:
- organization diagram Chapter
- contacts for each department.
These documents MUST NOT leave the company.
Their use is INTERNAL ONLY.

falcot-data (1.0) internal; urgency=low
* Initial Release.
* Let's start with few documents:
- internal company structure;
- contacts for each department.
-- Raphael Hertzog <hertzog@debian.org> Mon, 11 Apr 2011 20:46:33 +0200

This work was packaged for Debian by Raphael Hertzog <hertzog@debian.org>
on Mon, 11 Apr 2011 20:46:33 +0200
Copyright:
Copyright (C) 2004-2011 Falcot Corp
License:
All rights reserved.

in a dedicated subdirectory (named after the generated binary package). The contents of this subdirectory is then archived within the Debian package as if it were the root of the filesystem.
In our case, files will be installed in the debian/falcot-data/usr/share/falcot-data/ subdirectory, so that installing the generated package will deploy the files under /usr/share/
falcot-data/. The rules file is used as a Makefile, with a few standard targets (including clean and binary, used respectively to clean the source directory and generate the binary package).

Although this file is the heart of the process, it increasingly contains only the bare minimum for running a standard set of commands provided by the debhelper tool. Such is the case for files
generated by dh_make. To install our files, we simply configure the behavior of the dh_install command by creating the following debian/falcot-data.install file:

data/* usr/share/falcot-data/

At this point, the package can be created. We will however add a lick of paint. Since the administrators want the documents to be easily accessed from the Help menus of graphical desktop
environment, we create an entry in the Debian menu system. This is simply done by renaming the debian/menu.ex without its extension and editing it as follows:

?package(falcot-data):needs=X11|wm section=Help\
title="Internal Falcot Corp Documentation" \
command="/usr/bin/x-www-browser /usr/share/falcot-data/index.html"
?package(falcot-data):needs=text section=Help\
title="Internal Falcot Corp Documentation" \
command="/usr/bin/www-browser /usr/share/falcot-data/index.html"

The needs field, when set to X11|wm indicates that this entry only makes sense in a graphical interface. It will therefore only be integrated into the menus of the graphical (X11) applications
and window managers (hence the wm). The section field states where in the menu the entry should be displayed. In our case, the entry will be in the Help menu. The title field contains the
text that will be displayed in the menu. Finally, the command field describes the command to run when the user selects the menu entry.

The second entry matches the first one, with slight adaptations adapted to the Linux console text mode.
Simply creating the debian/menu file is enough to enable the menu in the package, since the dh_installmenu command is automatically invoked by dh during the package build process.
Our source package is now ready. All that's left to do is to generate the binary package, with the same method we used previously for rebuilding packages: we run the dpkg-buildpackage
-us -uc command from within the falcot-data-1.0 directory.

0 comments:

Post a Comment

 
TOP