LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-15-2011, 03:48 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
create a deb file


hi

I've 2 directories:

/etc

/usr

and 1 install script:

doinst.sh

Howto create one deb file that contains these all files?
 
Old 02-15-2011, 04:13 PM   #2
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
Take a look at this. You need to create a fake file system tree where it's more comfortable for you; it can be inside your home directory, for example, in a directory named "my_deb", which will emulate the root directory, so inside "my_deb" you will have "etc" and "usr" with the stuff you want installed (BTW, be careful with what you put inside these directories, if it's a specific program it should have its own directory inside /usr, likely). You will also need a "DEBIAN" subdirectory containing a "control" file with the info about your package (check the guide for information about how to create the "control" file). Then you execute:

Code:
dpkg-deb -b my_deb program-name_version_architecture.deb
(Changing "version" and "architecture" for the real version and architecture of the .deb file). If everything goes fine, you should have a nice .deb to install. Of course, a package created like this won't meet the debian standards, but for personal use, it's ok.

BTW, which package are you trying to build? If you have a doinst.sh script, then maybe it will take charge of installing the package itself, so there would be no need of creating a .deb package.
 
1 members found this post helpful.
Old 02-15-2011, 04:20 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Thx a lot, this is my doinst.sh script an I need deb file for live usb-hdd:
Code:
#!/bin/sh
# postinst script for mdaemon
#

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

on_init_error()
{
	exit 1
}

case "$1" in

    configure|abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# Give VIEW_USB access to the USB devices to allow USB redirection
VIEW_USB="/usr/lib/vmware/vmware-view-usb"
if [ -x "$VIEW_USB" ]; then
	if [ -e /proc/bus/usb ]; then
		groupadd usb 2>/dev/null || : # Do not error if group already exists
		GROUP_ID=$(cat /etc/group | grep -r "^usb" | cut -d ':' -f 3)
		sed -i '/\/proc\/bus\/usb/d' /etc/fstab
		echo "none	/proc/bus/usb	usbfs	listgid=$GROUP_ID,listmode=0664,busgid=$GROUP_ID,busmode=0775,devgid=$GROUP_ID,devmode=0664	0	0" >> /etc/fstab
		chown root:usb $VIEW_USB
		chmod 2755 $VIEW_USB
		umount /proc/bus/usb || :
		mount /proc/bus/usb
	else
		echo "/proc/bus/usb reqired for USB redirection support."
	fi	
fi

# Change sysinfo indicator to vmware-view to avoid updating the sysinfo package
PKG_LIST=/etc/SysInfo/pkg_list.conf
if [ -f "$PKG_LIST" ]; then 
	sed -i '/hptc-view-mgr/d' $PKG_LIST
	sed -i '/vmware-view-client/d' $PKG_LIST
	sed -i '/hptc-view-client/d' $PKG_LIST
	echo "vmware-view-client" >> $PKG_LIST
fi 

# One time hack to link the appropriate Qt 4.4/4.6 usb plugin to the usb-mgr
# so that this package can be installed on ThinPro 3.1 and 3.2
QT_VERSION=$(ls -l /usr/lib/libQtCore.so.4)
QT_VERSION=${QT_VERSION##*libQtCore.so.}
PLUGIN=/usr/lib/hptc-usb-mgr/plugins/libUsbVMwareView.so
if [ -f "$PLUGIN" ]; then
	rm -rf $PLUGIN
fi
if [ "$QT_VERSION" = "4.4.0" ]; then
	ln -s /usr/lib/vmware/plugins/libUsbVMwareView-4.4.so $PLUGIN
else
	ln -s /usr/lib/vmware/plugins/libUsbVMwareView-4.6.so $PLUGIN
fi
exit 0
 
Old 02-15-2011, 04:30 PM   #4
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
Is this a program you compiled your self from source? If it is, then you can either install it running "make install", or install checkinstall (through apt-get/aptitude), and execute checkinstall -D as root, inside the source directory.
 
Old 02-15-2011, 04:39 PM   #5
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by odiseo77 View Post
Is this a program you compiled your self from source?
No, it was deb file, I have extracted it, changed the doinst.sh script and I'd like to create again a deb file.
 
Old 02-15-2011, 05:04 PM   #6
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
Then you can rebuild it with dpkg-deb, as I explained above in my first post. If you extracted it and you only need to change the doinst.sh file, then it will be easier, since you probably have the file system tree of the extracted package already, as well as the control file.
 
1 members found this post helpful.
Old 02-15-2011, 05:42 PM   #7
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Thx again, but howto extract deb file, "control" file included using dpkg-deb?

Last edited by cccc; 02-15-2011 at 08:07 PM.
 
Old 02-15-2011, 07:12 PM   #8
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
To extract the contents of the "DEBIAN" subdirectory, simply execute:

Code:
dpkg-deb -e packagename.deb
Then put this DEBIAN directory inside the root of the program directory you extracted before, do the changes you need to do, and rebuild it with dpkg-deb.

BTW, may I ask what's wrong with the original .deb file you extracted? Doesn't it work without changing the doinst.sh script? (just wondering, in case there's a better solution ).
 
1 members found this post helpful.
Old 02-15-2011, 07:53 PM   #9
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by odiseo77 View Post
BTW, may I ask what's wrong with the original .deb file you extracted? Doesn't it work without changing the doinst.sh script? (just wondering, in case there's a better solution ).
I'd like to create live usb-hdd with vmware-view-client.deb.
I put this vmware-view-client.deb file into config/chroot_local-packages directory on my squeeze.
During creation I'm getting this problem:
Code:
# lb build
.................................................................................
update-initramfs: Generating /boot/initrd.img-2.6.32-5-686
df: Warning: cannot read table of mounted file systems: No such file or directory
egrep: /etc/fstab: No such file or directory
egrep: /etc/fstab: No such file or directory
Errors were encountered while processing:
 vmware-view-client
 hptc-view-mgr
E: Sub-process /usr/bin/dpkg returned an error code (1)
P: Begin unmounting filesystems...
I try to change vmware-view-client.deb file to get working.
That's really strange, because dpkg -i vmware-view-client.deb works well on my squeeze.
Perhaps this entry from doinst.sh:
Code:
echo "none	/proc/bus/usb	usbfs	listgid=$GROUP_ID,listmode=0664,busgid=$GROUP_ID,busmode=0775,devgid=$GROUP_ID,devmode=0664	0	0" >> /etc/fstab
causes this problem.

Last edited by cccc; 02-15-2011 at 08:01 PM.
 
Old 02-16-2011, 05:29 PM   #10
Hungry ghost
Senior Member
 
Registered: Dec 2004
Posts: 1,222

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
hmm, I'm not sure about what may be causing that error, but you can try the modified .deb to see how it works (although, for some reason, I suspect the problem is elsewhere).
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I run this .deb file: install_flash_player_10_linux.deb abefroman Linux - Desktop 1 11-04-2009 10:02 AM
How do you create a .deb file / get it into repositories? war1025 Debian 4 10-28-2009 06:22 PM
create .deb ??? sub_slack Debian 2 07-20-2007 03:20 AM
how can I create a .deb from an installed package? monkeyman2000 Debian 5 06-16-2005 07:56 PM
Create deb file Cybercool Linux - Newbie 15 04-08-2004 01:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration