Customize a deb package
wordpress meta
title: 'Customize a .deb package'
date: '2013-02-06T19:49:49-06:00'
status: publish
permalink: /customize-a-deb-package
author: admin
excerpt: ''
type: post
id: 247
category:
- Linux
tag: []
post_format: []
title: 'Customize a .deb package'
date: '2013-02-06T19:49:49-06:00'
status: publish
permalink: /customize-a-deb-package
author: admin
excerpt: ''
type: post
id: 247
category:
- Linux
tag: []
post_format: []
In this case I had to fix some startup links in a Networker Debian package. If I recall correctly it was after I had to use alien to create a .deb package from the vendor's rpm packages.
Package made with alien caused the following errors:
# dpkg -i lgtoclnt_7.5.1-2_amd64.deb
Selecting previously deselected package lgtoclnt.
(Reading database ... 22181 files and directories currently installed.)
Unpacking lgtoclnt (from lgtoclnt_7.5.1-2_amd64.deb) ...
Setting up lgtoclnt (7.5.1-2) ...
/bin/ln: creating symbolic link `/etc/init.d/rc2.d/S95networker': No such file or directory
/bin/ln: creating symbolic link `/etc/init.d/rc2.d/K05networker': No such file or directory
...
/bin/ln: creating symbolic link `/etc/init.d/rc5.d/K05networker': No such file or directory
Package info:
# dpkg --info lgtoclnt_7.5.1-2_amd64.deb
new debian package, version 2.0.
...
Package: lgtoclnt
Version: 7.5.1-2
Architecture: amd64
...
Description: NetWorker Client
EMC NetWorker protects the critical business data of more than 10,000
enterprise customers worldwide by simplifying, centralizing, and automating
backup and recovery operations across Unix, Windows, Linux and NetWare platforms
in DAS, NAS, and SAN storage environments. Built upon an open, highly scalable
client-server architecture, NetWorker reduces management overhead by providing
"lights out" protection of storage assets in the largest corporate data centers
and the smallest satellite branch offices.
.
(Converted from a rpm package by alien version 8.72.)
Uncompress with ar:
# ls
lgtoclnt_7.5.1-2_amd64.deb
# ar vx lgtoclnt_7.5.1-2_amd64.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz
Uncompress control file:
# tar xzpf control.tar.gz
Now make your changes to pre and post scripts.
Package control.tar.gz
# tar cpf control.tar control md5sums postinst postrm preinst prerm
# rm control md5sums postinst postrm preinst prerm
Package the .deb with ar:
# ar -r lgtoclnt_7.5.1-2_amd64.deb debian-binary control.tar.gz data.tar.gz
ar: creating lgtoclnt_7.5.1-2_amd64.deb
Install:
# dpkg -i lgtoclnt_7.5.1-2_amd64.deb
Selecting previously deselected package lgtoclnt.
(Reading database ... 22181 files and directories currently installed.)
Unpacking lgtoclnt (from lgtoclnt_7.5.1-2_amd64.deb) ...
Setting up lgtoclnt (7.5.1-2) ...
To install EMC HomeBase Agent run the below script as 'root' user:
/opt/homebase-agent/setup-homebase.sh
Show installed package:
# aptitude show lgtoclnt
Package: lgtoclnt
New: yes
State: installed
Automatically installed: no
Version: 7.5.1-2
Priority: extra
Section: alien
Maintainer: root <root@bermuda>
Uncompressed Size: 144M
Description: NetWorker Client
EMC NetWorker protects the critical business data of more than 10,000 enterprise customers worldwide by simplifying, centralizing, and
automating backup and recovery operations across Unix, Windows, Linux and NetWare platforms in DAS, NAS, and SAN storage environments.
Built upon an open, highly scalable client-server architecture, NetWorker reduces management overhead by providing "lights out"
protection of storage assets in the largest corporate data centers and the smallest satellite branch offices.
(Converted from a rpm package by alien version 8.72.) (Updated postinst and postrm files to be dpkg friendly and start in runlevel 2 )
(-- rrosso 10.21.09)
Although my goal was fix the packaged version, you can also fix startup scripts on Debian and friends with update-rc.d. Example:
root@clnt:/etc/init.d# touch testscript
# update-rc.d testscript defaults
update-rc.d: warning: /etc/init.d/testscript missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/testscript ...
/etc/rc0.d/K20testscript -> ../init.d/testscript
/etc/rc1.d/K20testscript -> ../init.d/testscript
/etc/rc6.d/K20testscript -> ../init.d/testscript
/etc/rc2.d/S20testscript -> ../init.d/testscript
/etc/rc3.d/S20testscript -> ../init.d/testscript
/etc/rc4.d/S20testscript -> ../init.d/testscript
/etc/rc5.d/S20testscript -> ../init.d/testscript
# update-rc.d -f testscript remove
Removing any system startup links for /etc/init.d/testscript ...
/etc/rc0.d/K20testscript
/etc/rc1.d/K20testscript
/etc/rc2.d/S20testscript
/etc/rc3.d/S20testscript
/etc/rc4.d/S20testscript
/etc/rc5.d/S20testscript
/etc/rc6.d/K20testscript