Waou ! This is great ! Thanks for this<br><br>Hum, I just tried and I got this error:<br><br>debian-gta02:~# apt-get-file install <a href="http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk">http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk</a><br>
trap: 26: ERR: bad trap<br><br>Any clue ?<br><br><br><div class="gmail_quote">2009/5/10 Rask Ingemann Lambertsen <span dir="ltr">&lt;<a href="mailto:rask@sygehus.dk">rask@sygehus.dk</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
   For part 1, please see the mailing list archive:<br>
<a href="http://lists.openmoko.org/pipermail/community/2009-March/043753.html" target="_blank">http://lists.openmoko.org/pipermail/community/2009-March/043753.html</a><br>
<br>
   Below you will find a shell script to install a package from a .deb, .opk<br>
or .ipk file on a Debian system. It will<br>
<br>
        - download the package if necessary.<br>
        - repack gzipped tar archives if necessary (some *.ipk).<br>
        - edit the control file for Debian compatibility (*.opk and *.ipk).<br>
        - jump through hoops so apt-get can be used for installation,<br>
        so dependencies can be resolved necessary.<br>
        - delete all temporary files created.<br>
<br>
   Dependencies: dpkg-dev wget file binutils tar gzip<br>
<br>
   Usage: apt-get-file [--verbose] install &lt;file&gt; [apt-get options]<br>
<br>
   I&#39;m sure there are still small bugs around the edges, so this is only<br>
alpha quality. I&#39;m posting the script now because it mostly does what it&#39;s<br>
supposed to do and I want to get some feedback.<br>
<br>
   Example run:<br>
<br>
# ~rask/bin/apt-get-file install <a href="http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk%0A--2009-05-10" target="_blank">http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk<br>
--2009-05-10</a> 06:49:26--  <a href="http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk" target="_blank">http://projects.openmoko.org/frs/download.php/575/ledclock_0.6_all.ipk</a><br>
Resolving projects.openmoko.org... 88.198.93.218<br>
Connecting to <a href="http://projects.openmoko.org" target="_blank">projects.openmoko.org</a>|88.198.93.218|:80... connected.<br>
HTTP request sent, awaiting response... 200 OK<br>
Length: 13214 (13K) [application/binary]<br>
Saving to: `ledclock_0.6_all.ipk&#39;<br>
<br>
100%[================================================================&gt;] 13,214      --.-K/s   in 0.1s<br>
<br>
2009-05-10 06:49:28 (99.5 KB/s) - `ledclock_0.6_all.ipk&#39; saved [13214/13214]<br>
<br>
 ** Packages in archive but missing from override file: **<br>
  ledclock<br>
<br>
 Wrote 1 entries to output Packages file.<br>
Reading package lists... Done<br>
Building dependency tree<br>
Reading state information... Done<br>
The following extra packages will be installed:<br>
  python-pygtk python-subprocess python2.6-minimal<br>
Suggested packages:<br>
  binfmt-support<br>
Recommended packages:<br>
  python2.6<br>
The following NEW packages will be installed:<br>
  ledclock python-pygtk python-subprocess python2.6-minimal<br>
0 upgraded, 4 newly installed, 0 to remove and 112 not upgraded.<br>
Need to get 1331kB/1344kB of archives.<br>
After this operation, 4780kB of additional disk space will be used.<br>
Do you want to continue [Y/n]?<br>
WARNING: The following packages cannot be authenticated!<br>
  python-pygtk python-subprocess ledclock<br>
Install these packages without verification [y/N]? y<br>
Get:1 <a href="http://ftp.dk.debian.org" target="_blank">http://ftp.dk.debian.org</a> experimental/main python2.6-minimal 2.6.1-3 [1330kB]<br>
Get:2 <a href="http://nospamnospam.homepage.dk" target="_blank">http://nospamnospam.homepage.dk</a>  python-pygtk 2.14.1-2 [576B]<br>
Get:3 <a href="http://nospamnospam.homepage.dk" target="_blank">http://nospamnospam.homepage.dk</a>  python-subprocess 2.6.1-3 [582B]<br>
Fetched 1331kB in 2s (451kB/s)<br>
debconf: delaying package configuration, since apt-utils is not installed<br>
Selecting previously deselected package python-pygtk.<br>
(Reading database ... 45694 files and directories currently installed.)<br>
Unpacking python-pygtk (from .../python-pygtk_2.14.1-2_all.deb) ...<br>
Selecting previously deselected package python2.6-minimal.<br>
Unpacking python2.6-minimal (from .../python2.6-minimal_2.6.1-3_armel.deb) ...<br>
Selecting previously deselected package python-subprocess.<br>
Unpacking python-subprocess (from .../python-subprocess_2.6.1-3_all.deb) ...<br>
Selecting previously deselected package ledclock.<br>
Unpacking ledclock (from .../ledclock_0.6_all.deb) ...<br>
Processing triggers for man-db ...<br>
Setting up python-pygtk (2.14.1-2) ...<br>
Setting up python2.6-minimal (2.6.1-3) ...<br>
Could not find platform dependent libraries &lt;exec_prefix&gt;<br>
Consider setting $PYTHONHOME to &lt;prefix&gt;[:&lt;exec_prefix&gt;]<br>
Setting up python-subprocess (2.6.1-3) ...<br>
Setting up ledclock (0.6) ...<br>
#<br>
<br>
   And the script itself:<br>
<br>
#!/bin/sh<br>
<br>
# apt-get-file - Install package from .deb, .opk or .ipk file.<br>
# Copyright (c) 2009 Rask Ingemann Lambertsen &lt;<a href="mailto:ccc94453@vip.cybercity.dk">ccc94453@vip.cybercity.dk</a>&gt;<br>
<br>
#   This program is free software: you can redistribute it and/or modify<br>
#   it under the terms of the GNU General Public License version 3 as<br>
#   published by the Free Software Foundation.<br>
<br>
#   This program is distributed in the hope that it will be useful,<br>
#   but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
#   GNU General Public License for more details.<br>
<br>
#   You should have received a copy of the GNU General Public License<br>
#   along with this program.  If not, see &lt;<a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>&gt;.<br>
<br>
exit_clean () {<br>
        cd / || true<br>
        [ -z &quot;${APTSRC}&quot; ]      || rm -rf -- &quot;${APTSRC}&quot;<br>
        [ -z &quot;${APTLIST}&quot; ]     || rm -rf -- &quot;${APTLIST}&quot;<br>
        [ -z &quot;${PKG_TMPDIR}&quot; ]  || rm -rf -- &quot;${PKG_TMPDIR}&quot;<br>
        exit 1<br>
}<br>
<br>
trap exit_clean ERR<br>
set -o errexit<br>
set -o errtrace<br>
<br>
if [ &quot;--verbose&quot; = &quot;$1&quot; ]; then<br>
        shift<br>
        AR_VERBOSE=v<br>
        TAR_VERBOSE=v<br>
        set -o xtrace<br>
else<br>
        AR_VERBOSE=<br>
        TAR_VERBOSE=<br>
fi<br>
<br>
if [ &quot;install&quot; != &quot;$1&quot; ]; then<br>
        echo &quot;Usage: $0 [--verbose] install &lt;file&gt; &lt;apt-get options&gt;&quot;<br>
        exit 1<br>
fi<br>
shift<br>
<br>
PKG_URL=&quot;$1&quot;; shift<br>
PKG_FILE=$(basename &quot;${PKG_URL}&quot;)<br>
<br>
case &quot;${PKG_FILE}&quot; in<br>
        *.opk)<br>
        PKG_FORMAT=opk<br>
        ;;<br>
        *.deb)<br>
        PKG_FORMAT=deb<br>
        ;;<br>
        *)<br>
        PKG_FORMAT=ipk<br>
        ;;<br>
esac<br>
<br>
PKG_TMPDIR=$(mktemp -d)<br>
cd &quot;${PKG_TMPDIR}&quot; || exit $?<br>
<br>
# A debian package file can be used directly, everything else<br>
# needs a copy.<br>
case &quot;${PKG_URL}&quot; in<br>
        http://* | https://* | ftp://*)<br>
        wget -O &quot;${PKG_FILE}&quot; -- &quot;${PKG_URL}&quot;<br>
        ;;<br>
        *)<br>
        PKG_URL=$(echo &quot;${PKG_URL}&quot; | sed -e &#39;s/^file://&#39;)<br>
        if [ &quot;deb&quot; = &quot;${PKG_FORMAT}&quot; ]; then<br>
                ln -s &quot;${PKG_URL}&quot; &quot;${PKG_FILE}&quot;<br>
        else<br>
                cp &quot;${PKG_URL}&quot; &quot;${PKG_FILE}&quot;<br>
        fi<br>
        ;;<br>
esac<br>
<br>
PKG_DEB=$(echo &quot;${PKG_FILE}&quot; | sed -e &#39;s/\.[^.]*$/.deb/&#39;)<br>
PKG_FILE_FORMAT=$(file --brief --dereference -- &quot;${PKG_FILE}&quot;)<br>
<br>
case &quot;${PKG_FILE_FORMAT}&quot; in<br>
        &quot;gzip compressed data&quot;*)<br>
        PKG_FORMAT=ipk<br>
        ;;<br>
        &quot;Debian binary package&quot;*)<br>
        if [ &quot;ipk&quot; = &quot;${PKG_FORMAT}&quot; ]; then<br>
                PKG_FORMAT=opk<br>
        fi<br>
        ;;<br>
        *)<br>
        echo &quot;Unsupported package format ${PKG_FILE_FORMAT}.&quot;;<br>
        exit 1<br>
        ;;<br>
esac<br>
<br>
# Unpack the package if not .deb format.<br>
case &quot;${PKG_FORMAT}&quot; in<br>
        ipk)<br>
        tar -zx${TAR_VERBOSE}f &quot;${PKG_FILE}&quot;<br>
        rm -f &quot;${PKG_FILE}&quot;<br>
        ;;<br>
        opk)<br>
        ar xo${AR_VERBOSE} &quot;${PKG_FILE}&quot; control.tar.gz<br>
        mv &quot;${PKG_FILE}&quot; &quot;${PKG_DEB}&quot;<br>
        ;;<br>
esac<br>
<br>
# Debian uses architectures &#39;armel&#39; and &#39;all&#39;. There appears to<br>
# be no way of telling dpkg/APT of compatible architectures.<br>
# Edit the control file.<br>
if [ &quot;${PKG_FORMAT}&quot; != &quot;deb&quot; ]; then<br>
        mkdir control<br>
        tar -C control -zx${TAR_VERBOSE}f control.tar.gz<br>
<br>
        sed -i  -e &#39;s/^Architecture: any$/Architecture: all/&#39; \<br>
                -e &#39;s/^Architecture: \(armv[1234]t\?\|arm\|om-gta02\)$/Architecture: armel/&#39; \<br>
                control/control<br>
<br>
        (cd control &amp;&amp; tar -zc${TAR_VERBOSE}f ../control.tar.gz *)<br>
fi<br>
<br>
# Repack the .ipk or .opk package as .deb.<br>
if [ &quot;ipk&quot; = &quot;${PKG_FORMAT}&quot; ]; then<br>
        ar qc${AR_VERBOSE} &quot;${PKG_DEB}&quot; debian-binary control.tar.gz data.tar.gz<br>
elif [ &quot;opk&quot; = &quot;${PKG_FORMAT}&quot; ]; then<br>
        ar r${AR_VERBOSE} &quot;${PKG_DEB}&quot; control.tar.gz<br>
fi<br>
<br>
# What follows is an ugly hack, but you just can&#39;t pass a filename to<br>
# apt-get. So fake a repository with the package in it and install it<br>
# by package name.<br>
<br>
# mktemp brain damage: You can&#39;t make a file ending in .list.<br>
APTSRC=$(mktemp /etc/apt/sources.list.d/00-apt-get-file-XXXXXXXXXX)<br>
ln &quot;${APTSRC}&quot; &quot;${APTSRC}.list&quot; &amp;&amp; rm -f &quot;${APTSRC}&quot;<br>
APTSRC=&quot;${APTSRC}.list&quot;<br>
echo &quot;deb file:${PKG_TMPDIR}/ /&quot; &gt;&quot;${APTSRC}&quot;<br>
<br>
APTLIST=/var/lib/apt/lists/$(echo &quot;${PKG_TMPDIR}/Packages&quot; | tr / _)<br>
dpkg-scanpackages . /dev/null | sed -e &#39;s_^Filename: ./_Filename: _&#39; &gt;&quot;${APTLIST}&quot;<br>
<br>
PKG_NAME=$(dpkg-deb --field &quot;${PKG_DEB}&quot; Package)<br>
apt-get install &quot;$@&quot; &quot;${PKG_NAME}&quot;<br>
<br>
# Clean up.<br>
cd /<br>
rm -r -f -- &quot;${APTSRC}&quot; &quot;${APTLIST}&quot; &quot;${PKG_TMPDIR}&quot;<br>
<font color="#888888"><br>
<br>
--<br>
Rask Ingemann Lambertsen<br>
Danish law requires addresses in e-mail to be logged and stored for a year<br>
<br>
_______________________________________________<br>
Openmoko community mailing list<br>
<a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
<a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
</font></blockquote></div><br>