How to manage software packages with ipkg in DinguxThere 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/IpkgThe 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:
# 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:
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.
#!/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/BuildingIpkgsIn 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.
#!/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.
#!/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:
ipkg-cl list
- An installed package can be removed by typing:
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!