[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

make my own debian package



Hi all,

I am learning how to make packages debian for my personal use to install my own scripts, files of conf and others. I test all that currently while making a package which allows me to replace the files of conf Shell, I try to make un package which allows me to replace the files of conf /etc/bash.bashrc, /etc/profile and /etc/skel/.bash* by my own files.

As these files belong already to other packages (typically bash) I intended to use dpkg-divert to make a deviation and to be able to install mine without conflicts but I don't know if it's the optimal solution.

I've two questions for you :

* When I install my package, either it carries out well the diversion (preinst) but I do not find my new file installed, or it installs my file but does not carry out the diversion (yes I know, it's odd, that's why I need your help :p). And when I test the command manually, all occurs correctly (diversion then suppression of this one correctly). I think that I had to mislead me but I don't know where, dpkg-divert command in preinst isn't good ? Or my idea is simply stupid ?!

* I change the permissions and user and group of the files to be installed with the command "install" in my Makefile but it doesn't seem to use that, the permissions remain those of the "source". How set correctly permissions of these files ?


My files :

----------------------------------------------------------------------------------------------------------------------------
# Makefile of my "source package" files

DESTDIR = $(DEBDIR)/etc

install:
  install -d $(DESTDIR)/skel
  install -o root -g adm -m 664 bash.bashrc $(DESTDIR)/bash.bashrc
  install -o root -g adm -m 664 profile $(DESTDIR)/profile
  install -o root -g adm -m 664 bashrc $(DESTDIR)/skel/.bashrc
  install -o root -g adm -m 664 bash_profile $(DESTDIR)/skel/.bash_profile
  install -o root -g adm -m 664 bash_logout $(DESTDIR)/skel/.bash_logout


----------------------------------------------------------------------------------------------------------------------------
# debian/rules

export DH_COMPAT=3

configure: configure-stamp

configure-stamp:
  dh_testdir
  touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
  dh_testdir
  touch build-stamp

clean:
  dh_testdir
  dh_testroot
  rm -f build-stamp configure-stamp
  rm -rf $(CURDIR)/debian/omd-base-files
  rm -rf ../omd-base-files_*
  # Add here commands to clean up after the build process.
  -$(MAKE) clean
  dh_clean

install: build
  dh_testdir
  dh_testroot
  dh_clean -k
  dh_installdirs
  # Add here commands to install the package into debian/base-files.
  $(MAKE) DEBDIR=$(CURDIR)/debian/omd-base-files

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
  dh_testdir
  dh_testroot
  dh_installchangelogs
  dh_installdocs
  dh_installexamples
#   dh_install
#   dh_installmenu
  dh_installdebconf
#   dh_installlogrotate
#   dh_installemacsen
#   dh_installpam
#   dh_installmime
#   dh_installinit
#   dh_installcron
#   dh_installinfo
#   dh_installman
#   dh_link
#   dh_strip
  dh_compress
  dh_fixperms
#   dh_perl
#   dh_python
#   dh_makeshlibs
  dh_installdeb
  dh_shlibdeps
  dh_gencontrol
  dh_md5sums
  dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

----------------------------------------------------------------------------------------------------------------------------
# debian/preinst

set -e

dpkg-divert --package omd-base-files --add --rename --divert /etc/bash.bashrc.omd-bak /etc/bash.bashrc dpkg-divert --package omd-base-files --add --rename --divert /etc/profile.omd-bak /etc/profile dpkg-divert --package omd-base-files --add --rename --divert /etc/skel/.bashrc.omd-bak /etc/skel/.bashrc dpkg-divert --package omd-base-files --add --rename --divert /etc/skel/.bash_profile.omd-bak /etc/skel/.bash_profile dpkg-divert --package omd-base-files --add --rename --divert /etc/skel/.bash_logout.omd-bak /etc/skel/.bash_logout


----------------------------------------------------------------------------------------------------------------------------
# debian/postrm

set -e

dpkg-divert --package omd-base-files --remove /etc/bash.bashrc
dpkg-divert --package omd-base-files --remove /etc/profile
dpkg-divert --package omd-base-files --remove /etc/skel/.bashrc
dpkg-divert --package omd-base-files --remove /etc/skel/.bash_profile
dpkg-divert --package omd-base-files --remove /etc/skel/.bash_logout

----------------------------------------------------------------------------------------------------------------------------

Thanks for any help

--
Richard




Reply to: