Author Topic: How to manage software packages with ipkg in Dingux  (Read 5772 times)

batman52 (OP)

  • Posts: 111
How to manage software packages with ipkg in Dingux
« on: October 26, 2009, 10:29:01 pm »
How to manage software packages with ipkg in Dingux

There have been discussions about this topic in the early days of dingux (when it still booted hooked to the usb). Some time is past since then and it seems that we all have forgotten. Anyway, since I am a bit tired of reconfiguring menus and copying files into the right directories, I feel like it would be of great benefit having a working package manager.

I was quite astonished when randomly browsing the rootfs I noticed that WE ALREADY HAVE IPKG into our standard dingux distro. So what I will explain here is how to configure it, in order to make it usable to easy install applications. I have to say that the most difficult part of the whole job I made was finding documentation about ipkg, which seems atm unsupported.

Here is where you can learn the basic working of ipkg.
http://handhelds.org/moin/moin.cgi/Ipkg

The main issue we have to deal with, is that ipkg is configured to to work on the root directory, that as we all know is read-only in dingux. In order to prevent this, I have moved the working "root" directory of ipkg to /usr/local/ creating an ipkg.conf file and putting it in /usr/local/etc.
Following the example that I found browsing the ipkg code (no official docs found on how to write this file), I also created two directories where ipkg is supposed to do something.

Here is my ipkg.conf:

Code: [Select]
# Must have one or more source entries of the form:
#
#       src <src-name> <source-url>
#
# and one or more destination entries of the form:
#
#       dest <dest-name> <target-path>
#
# where <src-name> and <dest-names> are identifiers that
# should match [a-zA-Z0-9._-]+, <source-url> should be a
# URL that points to a directory containing a Familiar
# Packages file, and <target-path> should be a directory
# that exists on the target system.

src custom-package ftp://localhost/ipkg
#src familiar-unstable http://familiar.handhelds.org/familiar/feeds/unstable/packages/armv4l

dest root /usr/local/
dest ram /usr/local/apps/ipkg/ram
dest ext /usr/local/apps/ipkg/ext

In order to correctly install a .ipk file therefore, one can type from the shell:

Code: [Select]
ipkg-cl -f /usr/local/etc/ipkg.conf -d root install myPackage.ipk

This command can usefully be included into a script that can be called from dmenu, in order to create an "install package" entry.

Code: [Select]
#!/bin/sh
ipkg-cl -f /usr/local/etc/ipkg.conf -d root  install $1

Ok, so now we could install every .ipk package we want, if only said package would exist...

In order to create packages, developers have to download and install ipkg-utils from here:

http://handhelds.org/download/packages/ipkg-utils/

Once the package is correctly installed into your linux (or cygwin) machine you can create .ipk packages from a directory tree using the ipkg-build tool.
The structure of the directory is described here:

http://handhelds.org/moin/moin.cgi/BuildingIpkgs

In addition, I created a demo package that installs a script (install.sh) that allows to install other ipk packages, and adds the relative entry to the Base theme of dmenu (and eventually removes it when the package is removed). In attachment, the archive (.zip) that contains the example directory tree, and the .ipk package that results (I had to rename them as .pdf to match requirements of the allowed filetypes).

EDIT:
I report here the little code snippets i wrote to modify dmenu config files, that are supposed to be used as guidelines. The first is called postinst and will be executed by ipkg after it will have copied the files.

Code: [Select]
#!/bin/sh

CFG=/usr/local/dmenu/themes/Base/menu_system.cfg
TMP=/usr/local/dmenu/themes/Base/menu_system.tmp
BAK=/usr/local/dmenu/themes/Base/menu_system.bak

sed '$i \
MenuItem Install\
{\
Icon = "/usr/local/dmenu/themes/Base/res/install.png"\
Name = " install"\
Executable = "/usr/local/dmenu/scripts/install.sh"\
WorkDir = "/usr/local/"\
Selector = yes\
}\
' $CFG > $TMP

mv $CFG $BAK
mv $TMP $CFG

# is there a more clever way to remove the installed .ipk file?
rm $PKG_ROOT/install_0.1_mipsel.ipk

# this is needed to avoid filesystem corruption if dingoo isn't shut down properly
sync

exit 0

This second one is called postrm, and will be executed by ipkg after the package is removed.

Code: [Select]
#!/bin/sh

CFG=/usr/local/dmenu/themes/Base/menu_system.cfg
TMP=/usr/local/dmenu/themes/Base/menu_system.tmp
BAK=/usr/local/dmenu/themes/Base/menu_system.bak

sed '/MenuItem Install/,/}/ d' $CFG > $TMP

mv $CFG $BAK
mv $TMP $CFG

# this is needed to avoid filesystem corruption if dingoo isn't shut down properly
sync

exit 0

Both those scripts have to go under the CONTROL subdirectory of the directory tree.

SUMMARY

Main Features:
- A list of the installed packages can be obtained by typing:
Code: [Select]
ipkg-cl list

- An installed package can be removed by typing:
Code: [Select]
ipkg-cl remove pkgName

Future developments:
-It would be great if someone wrote a gui app to remove an installed package
-*In theory* ipkg should allow to install packages from a remote (aka web) repository, but since I wasn't able to download anything with wget, I suppose that ipkg won't work too. Probabilly the host pc has to be configured as a proxy or something. I hope that someone can explain how to reach the internet from our dingux boxes ;-).

EDIT: zear told me how to get in touch with the WWW (thanks zear! ;-) )... still hadn't time to try, but I assume it will work flawlessly since many have reported using. Instructions here:
http://boards.dingoonity.org/dingux-general/connect-to-the-dingoo-with-telnet/
BTW: an internet install GUI would also be nice!
« Last Edit: October 27, 2009, 01:36:56 pm by batman52 »

athlon4011

  • Guest
Re: How to manage software packages with ipkg in Dingux
« Reply #1 on: October 26, 2009, 11:18:19 pm »
 :o :o :o :o

this would be amazing if we could fully adopt this. I know toddler's packages help everyone, but this would make it very simple for anyone to update said application or install a new one. Even possibly update the rootfs and a appropriate zimage.  Cant test it right now cuz im at work, but im interested in seeing this fully adopted.  A lot of people won't get this. but if anyone could make a screenplay or play by play screen shot. This would help others put their hands in to help.

Goon8

  • Guest
Re: How to manage software packages with ipkg in Dingux
« Reply #2 on: October 27, 2009, 12:41:14 am »
Do want!

Connecting to the internet and downloading the latest packages would be amazingly awesome!

Will definitely try and wrap my head around the package manager, hopefully someone can make a GUI for it!

bmg002

  • Posts: 29
Re: How to manage software packages with ipkg in Dingux
« Reply #3 on: October 31, 2009, 05:39:12 pm »
That link you posted (http://boards.dingoonity.org/dingux-general/connect-to-the-dingoo-with-telnet/) doesn't allow you to go on the internet.  It allows a telnet/ftp connection between your PC and your dingux.  Although, I believe in windows you could bridge your two ethernet controllers (real and dingux) and you should be able to have internet access through your dingux.  Linux should have a similar method, but I have not played with it enough to find out.  And with windows you get 5 minute max (from my exp) then the connection seems to die.  Dingux is still stable and windows is still stable, but the communication between the two seems to die.
The Gh0ce_>0

remax

  • Guest
Re: How to manage software packages with ipkg in Dingux
« Reply #4 on: October 31, 2009, 05:57:10 pm »
Same for me

batman52 (OP)

  • Posts: 111
Re: How to manage software packages with ipkg in Dingux
« Reply #5 on: November 01, 2009, 12:48:08 pm »
That link you posted (http://boards.dingoonity.org/dingux-general/connect-to-the-dingoo-with-telnet/) doesn't allow you to go on the internet.  It allows a telnet/ftp connection between your PC and your dingux.  Although, I believe in windows you could bridge your two ethernet controllers (real and dingux) and you should be able to have internet access through your dingux.  Linux should have a similar method, but I have not played with it enough to find out.  And with windows you get 5 minute max (from my exp) then the connection seems to die.  Dingux is still stable and windows is still stable, but the communication between the two seems to die.
The Gh0ce_>0

To get telnet and ftp access you don't actually need to set up anything on the host pc (at least with linux, I am using ubuntu)... but this doesn't allow you to access the internet. I'm not expert on networking settings, but after having followed that guide i was able to ping zear's remote pc.

I have posted here:
http://rapidshare.com/files/300893675/local.zip.html

a minimal local archive, that you can use to test how it could be easy installing applications with the proposed method. I have created an install package for greader2x. After dmenu is started, you just have to select the "install" entry under the "system" menu, and then select the installer package (greader2x_0.1_mipsel.ipk). Et voila! greader is installed!

« Last Edit: November 03, 2009, 02:08:21 pm by batman52 »

 

Post a new topic