Discussion:
[opkg] "Cannot install package package.tar.gz"
Gilles Ganault
2011-06-24 13:41:38 UTC
Permalink
Hello

I've never built packages before (Debian or opkg). I used the
following short article, but it doesn't work:

http://inportb.com/2010/10/19/making-an-opkg-package/

When I try to install the package on a Linux appliance:
=============
var/tmp> ./opkg-cl install package.tar.gz
Unknown package 'package.tar.gz'.
Collected errors:
* opkg_install_cmd: Cannot install package package.tar.gz.
=============

Here's what I did:
=============
/usr/src/mypackage# tree .
+-- bin
¦   +-- hello
¦   +-- hello.c
+-- control
+-- debian-binary
+-- postinst
+-- postrm
+-- preinst
+-- prerm
=============
/usr/src/mypackage# cat control
Package: mypackage
Version: 0.0.1
Description: Sample OPKG package
Maintainer: John Doe
Architecture: all

/usr/src/mypackage# cat preinst
#!/bin/sh
echo "The name of this script is \"$0\"."

/usr/src/mypackage# cat postinst
#!/bin/sh
echo "The name of this script is \"$0\"."

/usr/src/mypackage# cat prerm
#!/bin/sh
echo "The name of this script is \"$0\"."

/usr/src/mypackage# cat postrm
#!/bin/sh
echo "The name of this script is \"$0\"."

/usr/src/mypackage# cat debian-binary
2.0
=============
/usr/src/mypackage# tar czvf control.tar.gz control pre* post*

/usr/src/mypackage# tar czvf data.tar.gz bin/hello

/usr/src/mypackage# tar czvf package.tar.gz control.tar.gz data.tar.gz

/usr/src/mypackage# mv package.tar.gz /var/www
=============

FWIW, I used "hexadump" to check that lines end with LF (0a).

Does someone have a hint about what could be wrong?

Thanks for any help.
Gilles Ganault
2011-06-24 14:43:01 UTC
Permalink
On Fri, 24 Jun 2011 15:41:38 +0200, Gilles Ganault
Post by Gilles Ganault
=============
var/tmp> ./opkg-cl install package.tar.gz
Unknown package 'package.tar.gz'.
* opkg_install_cmd: Cannot install package package.tar.gz.
=============
I don't know if it means anything but searching the trunk...

http://code.google.com/p/opkg/source/browse/

... the only occurence of "Unknown package" is found in in
trunk/libopkg/opkg_install.c:

=============
new =
pkg_hash_fetch_best_installation_candidate_by_name(pkg_name);
if (new == NULL) {
opkg_msg(NOTICE, "Unknown package '%s'.\n", pkg_name);
return -1;
}
=============

Could it be that opkg packages require some kind of hashing (eg. MD5)
not mentionned in the tutorial?
Thomas Zimmermann
2011-06-24 15:11:56 UTC
Permalink
Post by Gilles Ganault
Hello
I've never built packages before (Debian or opkg). I used the
http://inportb.com/2010/10/19/making-an-opkg-package/
=============
var/tmp> ./opkg-cl install package.tar.gz
Unknown package 'package.tar.gz'.
* opkg_install_cmd: Cannot install package package.tar.gz.
=============
A opkg package is ar package not a tar.gz. So just package it the right way
and it should work.
Gilles Ganault
2011-06-24 17:41:20 UTC
Permalink
On Fri, 24 Jun 2011 17:11:56 +0200, Thomas Zimmermann
Post by Thomas Zimmermann
A opkg package is ar package not a tar.gz. So just package it the right way
and it should work.
Thanks Thomas, that did it:
============
root:/var/tmp> ./opkg-cl install package.opk
Installing opkg-hello (0.0.1) to root...

The name of this script is
"/tmp/opkg-4Oa1dd/opkg-hello-MjJMjr/preinst".

Configuring opkg-hello.
The name of this script is "//usr/lib/opkg/info/opkg-hello.postinst".
============
root:/var/tmp> ls -al /bin/hello

-rwxr-xr-x 1 root root 4968 Jun 24 2011 /bin/hello
root:/var/tmp> hello

Hello World
============

So the two following documents...

http://inportb.com/2010/10/19/making-an-opkg-package/
www.oesf.org/index.php?title=Pdaxrom:_Create_An_Ipk_Howto

... include two errors:

1. After compiling control.tar.gz and data.tar.gz, a package is not
created either with tar" or "ar", or "tar" followed by "ar", but
simply with "ar -r mypackage.opk control.tar.gz data.tar.gz
debian-binary"

2. Control files must not be located in ./CONTROL/ but rather at the
root; Otherwise, "opkg-cl install" triggers "pkg_init_from_file:
Malformed package file package.opk"

This won't work either: "tar czvf control.tar.gz CONTROL/*". Maybe
"tar" offers an option to leave out the path leading to the files.
Bottom line: control.tar.gz must NOT include paths.

Thanks for the help.

Continue reading on narkive:
Loading...