I have a need to Debianize some static resources for a software project but am confused by the available information and could use some guidance in doing so. Here are the materials I've been re开发者_运维技巧ading:
- Rolling your own Debian packages
- Debian New Maintainer's Guide
- Debian Library Packaging Guide
- Debian Mentors FAQ
The Debian New Maintainer's Guide seems the most apropos, especially this chapter, but it's didactic presentation is not effective for me; it reads more as a re-learning reference than a guide for the unknowing. Much of the information I've found is likewise geared to getting packages included in a public repository which I do not need. To make it that some kindly folk might show me the way, I've created a small project statrec which exemplifies the type of package I need to create. It's source tree looks like so:
statrec/
├── LICENSE
├── README.md
├── share
│ ├── gilgamesh.txt
│ └── thoreau.txt
└── VERSION
I need to but am unable to deduce how to:
- install
statrec/share
to/usr/share/statrec/VERSION/
, - create or modify a symlink from
/usr/share/statrec/current/
to/usr/share/statrec/VERSION/
and then - uninstall previous versions of statrec.
I understand how to accomplish some of this, maybe which tools to use but feel rather paralized by the surfeit of information.
I would say easiest thing would be to:
Create a makefile, that will install the files as you want them honoring any
DESTDIR
setting and do nothing for default target. Something along the lines of:all: # nothing to build install: cp -r share/* $(DESTDIR)/usr/share/statrec/$(VERSION)
The
DESTDIR
thing is important; it will not be installing to the system, but instead to a temporary directory that dpkg will than pack up. All symlinks must point to the final destinations (without$(DESTDIR)
prefix).Let
dh_make --native
do it's business (it will create another makefiledebian/rules
that will call the first makefile).Look at the files under
debian
. Especiallydebian/changelog
may need editing (it's wheredebuild
/dpkg-buildpackage
get the version number from, so it must be filled in).I believe
debuild
usesfakeroot
automatically, fordpkg-buildpackage
you have to specify it manually. Don't even think about running it as real root.Use
debuild
ordpkg-buildpackage -rfakeroot
to build it
No need to care for uninstalling as dpkg
is going to handle that.
Update: I suggest dh_make --native
, because I understood the question is for simply installing a handful of data files on a handful of debian systems. If it should be distributed, I suggest simply going to ask on the irc.debian.org#debian IRC channel and probably leaving it up to Debian Developer (only Debian Developers may upload to Debian archive and they usually want to handle the packaging themselves).
Also if it's part of software rather than stand-alone bunch of data files, the installation should be part of the general installation of the software using one common makefile, there should be just one Debian source package and just the debian/control
and debian/*.files
should specify which files go to the application package (which is "Architecture: any") and which files go to the data package (which is "Architecure: all" and usually gets suffix -data
).
I found saurik's (of cydia/jailbreak fame) "Hosting a Cydia Repository" guide useful for creating your own .deb files. Have a look at it here: http://www.saurik.com/id/7
You should read section 15.2.2 in the debian-handbook.
I found it helpfull to just create a .install file and skip that Makefile part, for my own project
精彩评论