Brian E. Seppanen wrote: > Somewhat of an offtopic question, but I ask this because I'm trying to > create a debian package for distributing out a cfengine upgrade from > 2.1.13 to 2.1.19p1. > > I've compiled cfengine with the following > > ./configure --bindir=/root/debs/cfengine/var/cfengine/bin > --sbindir=/root/debs/cfengine/var/cfengine/sbin > --datadir=/root/debs/cfengine/usr/share/ > --sysconfdir=/root/debs/cfengine/var/cfengine/inputs --localstatedir= > /root/debs/cfengine/var/log --infodir=/root/debs/cfengine/usr/share/info > --mandir=/root/debs/cfengine/usr/share/man > --with-berkeleydb=/usr --with-openssl=/usr --with-docs --with-pcre=/usr > > I make and then I make install > > The hierarchy that I want ends up in /root/debs/cfengine as I want. > > I package it up using dpkg with dpkg --build /root/debs/cfengine > cfengine_2.1.19p1-1_i386.deb
This is really a Debian question, but that's okay. You should use one of the package building frameworks available, such as dh_make. The Debian New Maintainers Guide has lots of interesting information about package building, though there is lots of Debian administrivia there also. I have a dirty script I use to wrap dh_make, which I will include below my signature in case it is of use to you. It might be too specific to my site, but at the very least it will give you an idea about how to use dh_make to create Debian packages. > So my question is does the hardcoded path end up being referenced in the > binary later? So will a cfagent binary compiled as such expect to find > /var/cfengine/inputs in /root/debs/cfengine/var/cfengine/inputs or are the > compilation flags simply. The cfengine programs will probably expect to find things under /root in this case, which is not what you want. fakeroot should take care of this sort of thing for you for free, if you use the helper scripts. Sorry to all the non-Debian people out there who may find this boring... Best, Brendan -- Senior System Administrator The University of Chicago Department of Computer Science http://www.cs.uchicago.edu/people/brendan http://praksys.blogspot.com/ ######################################################################## #!/bin/sh VERBOSE= SRCROOT= DSTROOT= NONSPARSE= PKG_TITLE= PKG_NAME= REQ_NUM= OUTPUT_CHANNEL=/dev/null SELF=`basename $0` PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH usage() { cat <<EOF Usage: $SELF -t arg -i arg [-p] [-r arg] [-v] [-h] Create a Debian package out of some files. -h Display this help message -i Build a package from files in directory "arg" (Required) (example: arg/opt/gak/bin/thing will end up in /opt/gak/bin/thing) "arg" should be an absolute path -p "arg" specified with -i is non-sparse and exclusive (example: -i /opt/foo/ will work as you would expect) Confused? Talk to Brendan and help write a better usage message -r Use req number "arg" in the package desciption fields -t Use "arg" as package name-version (example: some-pkg-1.3) (Required) (Limitation: underscore "_" characters not permitted) -v Be verbose Examples: $SELF -t cs-somepkg-0.1 -i /opt/cs-somepkg -p -r 12345 $SELF -t cs-anotherpkg-0.1 -i /var/tmp/working -r 12345 EOF } while getopts pvht:r:i: i; do case $i in h) usage; exit 0 ;; t) PKG_TITLE=$OPTARG ;; i) SRCROOT=$OPTARG ;; p) NONSPARSE=true ;; r) REQ_NUM=$OPTARG ;; v) VERBOSE=-v ;; ?) usage; exit 1 ;; esac done if ! test "$PKG_TITLE"; then echo Error: must specify package name/version with -t echo Aborting. echo echo usage exit 1 fi if ! test "$SRCROOT"; then echo Error: must specify source directory with -i echo Aborting. echo echo usage exit 1 fi if test "$NONSPARSE"; then NONSPARSE=$SRCROOT fi # Given foo-bar3-1.3.4, extract foo-bar3 # That is, get everything before the last "-" character PKG_NAME=`echo $PKG_TITLE|sed 's/\(.*\)-.*/\1/'` test "$VERBOSE" && echo PKG_TITLE is $PKG_TITLE if test "$REQ_NUM"; then DESCRIPTION="req $REQ_NUM" else DESCRIPTION="Consult [EMAIL PROTECTED]" fi test "$VERBOSE" && echo DESCRIPTION is $DESCRIPTION if test "$VERBOSE"; then OUTPUT_CHANNEL=/dev/stdout fi TEMPDIR=`mktemp -d` echo Using directory $TEMPDIR cd $TEMPDIR mkdir $VERBOSE $PKG_TITLE cd $PKG_TITLE echo Creating template files with dh_make if test "$VERBOSE"; then echo yes|dh_make -s -e [EMAIL PROTECTED] else echo yes|dh_make -s -e [EMAIL PROTECTED] >/dev/null 2>&1 fi cp $VERBOSE debian/changelog . test -f debian/compat && cp $VERBOSE debian/compat . cp $VERBOSE debian/control . cp $VERBOSE debian/copyright . cp $VERBOSE debian/rules . rm $VERBOSE debian/* mv $VERBOSE `ls|grep -v debian` debian/ echo Editing control file ed debian/control <<EOF >$OUTPUT_CHANNEL 2>&1 /^Depends: d i Depends: . /^Description: d d a Description: $DESCRIPTION $DESCRIPTION . w q EOF echo Editing rules file ed debian/rules <<EOF >$OUTPUT_CHANNEL 2>&1 %s/-..MAKE./#/ %s/..MAKE./#/ /^install: /DESTDIR a mkdir -p $VERBOSE \$(CURDIR)/debian/$PKG_NAME/$NONSPARSE cp -r $VERBOSE $SRCROOT/* \$(CURDIR)/debian/$PKG_NAME/$NONSPARSE . /^clean: /dh_clean i rm -rf $VERBOSE \$(CURDIR)/debian/$PKG_NAME . %s/.dh_strip/# dh_strip/ w q EOF # Separate ed invocation so this edit can fail with affecting other edits ed debian/rules <<EOF >$OUTPUT_CHANNEL 2>&1 /dh_install$ s/^#// w q EOF echo Building package dpkg-buildpackage -rfakeroot >$OUTPUT_CHANNEL 2>&1 echo Package created: $TEMPDIR/*deb _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org http://cfengine.org/mailman/listinfo/help-cfengine