36

ipk packages are the intallation packages used by opkg.

I'm trying to extract the contents of one of them and also create my own ipk.

I've read that I should be able to untar them but that is not true.

I've tried:

tar -zxvf mypack.ipk 

and I get:

zip: stdin: not in gzip format

I've also tried:

tar -xvf mypack.ipk 

and I get:

tar: This does not look like a tar archive

I've found that most of the information on the internet regarding ipk's are inaccurate.

My ipk was generated by bitbake. I'm having a hard time with bitbake and want to avoid using it.

Any ideas on how to extract and how to create ipk files? A simple template with a single package would be useful to have.

5 Answers 5

42

I figured it out.

You can extract the main package with the ar x command, then extract the control.tar.gz with the tar -zxf command.

Sign up to request clarification or add additional context in comments.

Comments

26

I have tested ar x package-name.ipk command but it didn't help

I found the bellow command which worked perfectly

tar zxpvf package-name.ipk 

This extracts three files:

debian-binary data.tar.gz control.tar.gz 

use the same command to open data.tar.gz and control.tar.gz files

for more information refer to https://cognito.me.uk/computers/manual-extractioninstallation-of-ipk-packages-on-gargoyleopenwrt/

Comments

20

You need to create a control file, and then do some archiving using tar and ar. In my case, I was distributing just python scripts, so there was no architecture dependency. You should check the control and Makefile into version control, and delete all the other intermediate files.

Here are the contents of control

 Package: my-thing-python Version: 1.0 Description: python scripts for MyCompany Section: extras Priority: optional Maintainer: John License: CLOSED Architecture: all OE: my-thing-python Homepage: unknown Depends: python python-distutils python-pyserial python-curses python-mmap python-ctypes Source: N/A 

Here is my Makefile which sits in the same directory as all my python scripts.

 all: my-thing-python.ipk my-thing-python.ipk: rm -rf ipk mkdir -p ipk/opt/my-thing-python cp *.py ipk/opt/my-thing-python tar czvf control.tar.gz control cd ipk; tar czvf ../data.tar.gz .; cd .. echo 2.0 > debian-binary ar r my-thing-python.ipk control.tar.gz data.tar.gz debian-binary clean: FORCE rm -rf ipk rm -f control.tar.gz rm -f data.tar.gz rm -f my-thing-python.ipk FORCE: 

3 Comments

@MarkLakata, After installing the package, it gives an error as Collected errors: * pkg_init_from_file: Malformed package file my-thing-python.ipk.. See this question
What does OE: stand for?
@kmort - good question about OE:. I showed it in the example as a result of reverse engineering. I don't know what it means. It's possible that it is not standard.
5

Extracting with these commands:

  1. Extract the file by running the command:

     ar -xv <.ipk file> 
  2. Extract the control.tar.gz file by running the command:

     tar -zxvf control.tar.gz 
  3. data.tar.gz : untar by running the command:

     tar –zxvf data.tar.gz 

Comments

0

If you want a list of files in an ipk, you can do something like:

#!/bin/sh for f do tar -x -z -f $f ./data.tar.gz -O | tar tvzf - done 

-O is extract to standard output. ipk files used to be AR (like DPKG), but are now tgz. I feel that some dpkg utility ought to cope with ipkg files, but I haven't found the right one.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.