Hi,

I try to package some maps for navit. Because I don't want to waste hard
disk space on the SHR server I want to use postinst and postrm and
download the maps from cloudmade.com [0].
The problems:
    * maps are really big and you might get problems if you don't use a
    memory card
    * navit needs a fixed directory for maps in the config file(see PATCH #3)
    * How should the versioning be done (cloudmade updates weekly)

My ideas:
    * The sze of the maps must be known before downloading
    * figure out which partition has enough space left, else bail out
    * create a link to /usr/share/navit/maps
    * remove everything on postrm

My new problems:
    * My test package for andorra is empty
    * Some fights against navit compilation

Is this a bad or good idea? Could someone help me to fix the issues and
add the rest of the World?

Regards, Frederik

P.S.: I created a screenshot for the navit config from my patches:
http://scap.linuxtogo.org/files/8a5696050bc8f713dedef532303f1df7.png

[0] http://downloads.cloudmade.com/
-- 
IRC: playya @ Freenode, Gimpnet
xmpp: [email protected]
DESCRIPTION = "Navit Map for ${COUNTRY}"
DEPENDS = "navit wget"
LICENSE = "GPL"
SECTION = "optional"

postinst_append() {
    PARTITIONS=$(mount | grep ^/ | cut -d ' ' -f 3)
    EXPECTED_SIZE=${EXPECTED_SIZE}
    TMP=${${PN}##navit-map-}
    COUNTRY=${TMP/-/_}


    BIGGEST_PART=""
    BIGGEST_SIZE=0

    for p in $PARTITIONS; do
        SIZE=$(df | grep "$p$" | cut -b 41-50)
        if [ $SIZE -gt $BIGGEST_SIZE ] ; then
            BIGGEST_PART=$p
            BIGGEST_SIZE=$SIZE
        fi
    done

    echo "Biggest Partition: $BIGGEST_PART"
    if [ $BIGGEST_SIZE -lt ${EXPECTED_SIZE} ] ; then
        echo "Not enough free space on $BIGGEST_PART"
        exit 1;
    else
        DL_DIR=$BIGGEST_PART/Maps/
        mkdir -p $DL_DIR
        cd $DL_DIR && \
        wget -O $COUNTRY.bin.zip 
"http://downloads.cloudmade.com/europe/andorra/${COUNTRY}.navit.bin.zip"; && \
        unzip $COUNTRY.bin.zip && \
        rm -f $COUNTRY.bin.zip && \
        mkdir -p  /usr/share/navit/maps/ && \\
        ln -s $COUNTRY /usr/share/navit/maps/
    fi
}
postrm_append() {
    COUNTRY=${${PN}##navit-map-}
    LINK="/usr/share/navit/maps/$COUNTRY"
    ORIG=$(readlink $LINK)
    rm -f $ORIG $LINK
}
EXPECTED_SIZE = 280000
require navit-maps.inc

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Shr-devel mailing list
[email protected]
http://lists.shr-project.org/mailman/listinfo/shr-devel

Reply via email to