Und hier nun die komplette bash-Datei zum Text der ersten Seite (man entschuldige mir die wenigen Kommentare und damit verbundene schlechte Lesbarkeit, vielleicht hole ich dass ja noch mal nach.):
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | #!/bin/bash
 
# apt-get install p7zip-full
descripion="
Programm dient zum backen der OpenMTBmap.
 
Folgende Parameter sind moeglich:
    -f               Force
    -m               Karten: openmtbmap
    -v               Karten: velomap
    -d               Debug
    -h               Dieser Hilfetext
 
"
debug="OFF"
force="aus"
geladen="0"
lang="de"
types="clas wide"
typ1=`echo ${types} | awk '{print $1}'`
karte="openmtbmap"
#karte="velomap"
work="fertig"
while getopts ":hfomvrtd" akt_opt
 do
  case ${akt_opt} in
    f)
        force="ein" ;;
    o)
        karte="allInOne" ;;
    m)
        karte="openmtbmap" ;;
    v)
        karte="velomap" ;;
    r)
        karte="Radfahrer"
        url="http://radkarte.formann.de/gmapsupp.img.zip"
        ;;
    t)
        karte="mtbnavi" ;;
    d)
        debug="ON"
        set -x
        ;;
    :)
        echo "Option $OPTARG benoetigt Argumente!"
        exit 1
        ;;
    *)
        IFS="
"
        for l in $descripion
          do
           echo $l
          done
        unset IFS
        exit 0
        ;;
   esac
 done
shift $((OPTIND- 1)) #Optionen loeschen 
echo "Waehle Karte ${karte}!"
 
if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
 
case ${karte} in
  openmtbmap )
        #s. http://openmtbmap. org/de/download/#europa
        #url01="http://openmtbmap.x-nation.de/maps/mtbgermany.7z.zip"
        urlde="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl/mtbgermany.exe"
        urlbe="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl/mtbbelgium.exe"
        urlnl="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl/mtbnetherlands.exe"
        urlpl="http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/odbl/mtbpoland.exe"
 
        #url02="http://openmtbmap.x-nation.de/maps/contourlines/openmtbmap_de_srtm.7z.zip"
        url02="http://openmtbmap.x-nation.de/maps/contourlines/openmtbmap_de_srtm.zip"
 
        urlleg="http://openmtbmap.x-nation.de/maps/legend.zip"
        url03="http://www.anpo.republika.pl/files/lgmt042a.zip"
        url04="http://openmtbmap.x-nation.de/maps/openmtbmap_style.zip"
        url05="http://www.mkgmap.org.uk/snapshots/mkgmap-latest.tar.gz"
        url06="http://www.mkgmap.org.uk/splitter/splitter-r123.tar.gz"
        url06="http://www.mkgmap.org.uk/splitter/splitter-latest.tar.gz"
 
        urls="${urlde} ${url02}"
        urls_b="${urlleg} ${url03} ${url04} ${url05} ${url06}"
 
        #Mirrir auf ftp://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/ :
        #urls="${urls} ${urls//http:\/\/openmtbmap.x-nation.de\/maps\//ftp://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/}"
        urls="${urls//http:\/\/openmtbmap.x-nation.de\/maps\//http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/}"
        urls_b="${urls_b//http:\/\/openmtbmap.x-nation.de\/maps\//http://ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap/}"
        work="backen"
        ;;
  velomap)
        #s. http://www.velomap.org/download/
        urlde="ftp://ftp5.gwdg.de/pub/misc/openstreetmap/download.openstreetmap.de/aio/velomap/gps_ready/velomap_germany.img.zip"
 
        urls="${urlde}"
        ;;
 esac
 
if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
referer='--referer="/blog/archives/14528"'
ua='--user-agent="Mozilla/5.0"'
 
tmpdir="/home/ftp/pub/google"
kartedir="/home/ftp/pub/google"
sdramdir_s="/misc/sdram0 /misc/mmcblk0p1 /media/disk /media/disk1 /media/disk-1 /media/disk-2 /media/disk-3"
#sdramdir="/tmp/uwe2"
gpsdir="/home/uwe/Daten/gps"
projektdir="/home/uwe/projekte/gps"
if [ "${force}" == "ein" ]
 then
  sdramdir_s="${sdramdir_s} /home/platz/garmin"
  #mkdir -p "/home/platz/garmin/Garmin"
  #tmpdir="/home/platz/garmin/tmp"
 fi
 
for pp in 7zr
 do
  if [ `which ${pp} 2>/dev/null | wc -l` -eq 0 ]
   then
    echo "Ich kann kein '${pp}' finden!"
    echo "Eventuell hilft ein 'apt-get install p7zip' ."
    exit
   fi
 done #for pp in 7zr java
if [ ! -d ${tmpdir} ]
 then
  mkdir -p ${tmpdir}
  chown 531.531 ${tmpdir}
 fi
FEHLER=0
 
if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
##cd ${gpsdir}/GarminTracksOrg || exit 9
echo "${HOSTNAME}"
kartedir="${kartedir}/${karte}"
if [ ! -d ${kartedir}/77 ]
 then
  mkdir -p ${kartedir}/77
 fi
cd ${kartedir}/ || exit 9
 
if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
for jj in `seq 1 2`
 do
    # Ein for-Schleife laesst sich schoen break-en
    # Zwei Durchgaenge maximal
    #
  if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
  if [ -d 77 ]
   then
    rm -rf 77 || break
   fi
  mkdir 77
  cd ${tmpdir}/
  for url in ${urls} ${urls_b}
   do
    #file="${sdramdir}/Garmin/${url##*/}"
    file="${tmpdir}/${url##*/}"
    #for dd in `seq 0 - 5` 
    #ddate=`date --date "${dd} day ago" '+%Y%m%d' `
    if [ "X${FEHLER}" == "Xkeiner" ]
     then
      FEHLER=0
      break
     fi
    if [ -f "${file}.test" ]
     then
      ktest="${file}.test"
     elif [ -f "${kartedir}/gmapsupp.img" ]
     then
      ktest="${kartedir}/gmapsupp.img"
     elif [ -f "${tmpdir}/../garmin/gmapsupp.img" ]
     then
      ktest="${tmpdir}/../garmin/gmapsupp.img"
     else
      ktest="${sdramdir}/Garmin/gmapsupp.img"
     fi
    if [ ! -f "${ktest}" ]
     then
      echo "Line: $LINENO: ERROR! ich konnte die Dateien nicht finden!:"
      echo "      ${kartedir}/gmapsupp.img"
      echo " oder ${file}"
      echo " oder ${sdramdir}/Garmin/gmapsupp.img"
      FEHLER="${FEHLER} $LINENO:0File"
      break
     fi
    echo "Durchlauf ${jj} File ${file}!"
    #wget --tries=4 --retr-symlinks ${ua} ${referer} --timestamping ${url} || break
    wget --continue --retr-symlinks --user-agent="Mozilla/5.0" --referer="/blog/archives/14528" --timestamping ${url} || break
    if [ ${file} -nt "${ktest}" ]
     then
      geladen=$[ geladen + 1 ]
     fi
    ls -l ${url##*/}
    if [ ! -s ${url##*/} ]
     then
      break
     fi
    pwd -P
    touch --reference=${url##*/} ${url##*/}.test || break
   done #for url in ${urls}
 done #for jj in `seq 0 1`
if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
if [ "${force}" == "ein" ]
 then
  geladen=$[ geladen + 1 ]
  #LastModified=`date '+%Y-%m-%d' --date '20 day ago'`
 fi
if [ $work == "backen" ]
 then
  if [ "${geladen}" -gt 0 ]
   then
    cd ${kartedir}
    rm 77/[67]*.[Ii][Mm][Gg] [67]*.[Ii][Mm][Gg] 77/*.TYP *.TYP 2>/dev/null
    for url in ${urls}
     do
      cd ${kartedir}/77 || break
      if [ "${url}" != "${url%7z.zip}" ]
       then
        7z -y e "${tmpdir}/${url##*/}" || break
       elif [ "${url}" != "${url%.exe}" ]
       then
        #unzip -o "${tmpdir}/${url##*/}" || break
        7z -y e "${tmpdir}/${url##*/}" || break
       elif [ "${url}" != "${url%.zip}" ]
       then
        7z -y e "${tmpdir}/${url##*/}" 2>/dev/null
       fi
      cd ..
     done #for url in ${urls}
    if [ "${debug}" != "ON" ] ; then set - ; fi
    if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set - ; fi
    if [ `ls -1 ./*/[67]*.[Ii][Mm][Gg] 2>/dev/null | wc -l` -gt 0 ]
     then
      mv -u ./*/* ./
     fi
    for ext in img typ
     do
      for f in *.${ext}
       do
        if [ -f "${f%.*}.${ext}" ]
         then
          extU=`echo ${ext} | tr 'a-z' 'A-Z'`
          mv -f "${f%.*}.${ext}" "${f%.*}.${extU}"
         fi
       done #for f in *.${ext}
     done #for ext in img typ
    if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x ; fi
    # wide*.TYP (optimized for Oregon/Colorado)
    # thin*.TYP (optimized for Gpsmap60/76 series)
    # clas*.TYP (optimized for Vista/Legend series)
    for typ in ${types}
     do
      cd ${kartedir} || break
      ls ${typ}*.TYP
      cp -p ${typ}${lang}.TYP 01002468.TYP || exit
      for ff1 in [Gg][Mm][Aa][Pp][Ss][Uu][Pp][Pp].[Ii][Mm][Gg] GMAPSUPP.IMG gmapsupp.IMG
       do
        if [ -f ${ff1} ]
         then
          if [ "${ff1}" != "gmapsupp.img" ]
           then
            if [ ! -f gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             elif [ ${ff1} -nt gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             fi
           fi
         fi
       done
      if [ ! -x ${projektdir}/gmt ]
       then
        cd ${projektdir}/
        wget --continue --retr-symlinks -N ${url03}
        unzip -o ${url03##*/}
        chmod 0755 gmt
        cd -
       fi #if [ ! -x ${projektdir}/gmt ]
      img6=""
      img7=""
      if [ -x ${projektdir}/gmt ]
       then
        if [ `ls -1 6*.IMG 2>/dev/null | grep -i IMG | wc -l` -gt 1 ]
         then
          img6="ein"
          echo "-- Kartendaten gefunden"
         fi
        if [ `ls -1 7*.IMG 2>/dev/null | grep -i IMG | wc -l` -gt 1 ]
         then
          img7="ein"
          echo "-- Hoehendaten gefunden"
         fi
        ls -ld `pwd`
        gmt_v=""
        if [ "${debug}" == "ON" ] ; then gmt_v=""; fi
        if [ "Xein" == "X${img6}" -a "Xein" != "X${img7}" ]
         then
          #:6
          echo "6"
          ${projektdir}/gmt -wy 7350 01002468.TYP
          ${projektdir}/gmt -j -o gmapsupp.img -f 7350 -m "openmtbmap" 6*.IMG 01002468.TYP
         elif [ "Xein" != "X${img6}" -a "Xein" == "X${img7}" ]
         then
          #:7
          echo "7"
          #${projektdir}/gmt -wy 7351 01002468.TYP
          #${projektdir}/gmt -j -o gmapsupp.img -f 7351 -m "openmtbmap_onlysrtm" 7*.IMG 01002468.TYP
          ${projektdir}/gmt -w -t 7*.IMG
          echo "Maps made transparent - this means that they will allways be visible on GPS on top of all other maps."
          ${projektdir}/gmt -j -o gmapsupp.img -f 7351 -m "openmtbmap_onlysrtm" 7*.IMG
         elif [ "Xein" == "X${img6}" -a "Xein" == "X${img7}" ]
         then
          #:76
          echo "76"
          ${projektdir}/gmt -wy 7352 01002468.TYP
          ${projektdir}/gmt -j -o gmapsupp.img -f 7352 -m "openmtbmap_srtm" 6*.IMG 7*.IMG 01002468.TYP
         fi
        ls -l gmapsupp.img
       fi #if [ -x ${projektdir}/gmt ]
      for ff1 in [Gg][Mm][Aa][Pp][Ss][Uu][Pp][Pp].[Ii][Mm][Gg] GMAPSUPP.IMG gmapsupp.IMG
       do
        if [ -f ${ff1} ]
         then
          if [ "${ff1}" != "gmapsupp.img" ]
           then
            if [ ! -f gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             elif [ ${ff1} -nt gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             fi
           fi
         fi
       done
      if [ ! -f gmapsupp.img ]
       then
        # Anderer Versuch
        java  -Xmx512M -jar /usr/share/mkgmap/mkgmap.jar --gmapsupp 6*.IMG 01002468.TYP || break
       fi
      for ff1 in [Gg][Mm][Aa][Pp][Ss][Uu][Pp][Pp].[Ii][Mm][Gg] GMAPSUPP.IMG gmapsupp.IMG
       do
        if [ -f ${ff1} ]
         then
          if [ "${ff1}" != "gmapsupp.img" ]
           then
            if [ ! -f gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             elif [ ${ff1} -nt gmapsupp.img ]
             then
              mv ${ff1} gmapsupp.img
             fi
           fi
         fi
       done
      if [ -f gmapsupp.img ]
       then
        gmap="gmapsupp.img.${karte}-${typ}-${lang}"
        touch --reference=${tmpdir}/${urlde##*/} ${kartedir}/gmapsupp.img || break
        cd ${kartedir} || break
        mv -f gmapsupp.img ${gmap} || break
        if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
        if [ "${typ}" == "${typ1}" ]
         then
          mv -fv ../gmapsupp.img ../gmapsupp.bak
          ln -f ${gmap} ../gmapsupp.img
          if [ -d ${sdramdir}/Garmin/ ]
           then
            cp -pfv ../gmapsupp.img ${sdramdir}/Garmin/gmapsupp.img || break
           fi
         fi #if [ "${typ}" == "${typ1}" ]
        touch --reference=${tmpdir}/${urlde##*/} ${tmpdir}/${urlde##*/}.test || break
        touch --reference=${tmpdir}/${urlde##*/} ${gmap} || break
        cd -
       fi #if [ -f gmapsupp.img ]
     done #for typ in ${types}
    rm [67]*.[Ii][Mm][Gg] *.TYP 2>/dev/null
    ls -hl ${tmpdir}/gmapsupp* ${tmpdir}/*/gmapsupp* \
      | perl -pi -e "s%${tmpdir}%https://usmith.dd.19q.eu/ftpuwe/google/%;" \
      | mail -s "$0:$LINENO, $geladen neue Files" uwe
   fi #if [ "${geladen}" -gt 0 ]
 
 
  if [ "$DEBUG" == "1x" ]
   then
    pwd -P
    echo "Line: $LINENO : Ausstieg!"
    exit
   fi
  FEHLER="keiner"
 elif [ $work == "fertig" ]
 then
  if [ "${debug}" == "ON" ] ; then echo "Line: $LINENO"; set -x; fi
  for url in ${urls}
   do
    cd ${karte} || break
    if [ "${url}" != "${url%7z.zip}" ]
     then
      7z -y e ../${url##*/} || break
     elif [ "${url}" != "${url%.exe}" ]
     then
      #unzip -o ../${url##*/} || break
      7z -y e ../${url##*/} || break
     elif [ "${url}" != "${url%.zip}" ]
     then
      7z -y e ../${url##*/} 2>/dev/null
     fi
    cd ..
   done #for url in ${urls}
 fi #if [ $work == "backen" ]
 
if [ "${debug}" != "ON" ] ; then set - ; fi | 
 
			
											
				 
													
[…] Das gravierendste Beispiel ist die ganz fehlende HOAG-Trasse. -Keine Gute Idee- /* Eigentlich sogar mega-ärgerlich. Was nutzt die geilste Routing-Funktionalität, wenn gerade solche Radwege fehlen? […]
Seit Montag hat mein Garmin plötzlich nur noch die Standardkarte im ‘Angebot’ und zeigt nicht mehr die gute OpenMtbMap-Karte an. Die SD-Ram ist okay und auf der Karte liegt ein großes gmapsupp.img-File. Trotzdem wollte das Garmin …
OpenMtbMap-Karte und Windows…
… Für Windows-User gibt es ja seit einer Weile einen schönen Installer, (was es Linux-Usern leider nicht leichter macht). Unter Windows allerdings braucht man nur die gewünschte Karten-Datei downloaden und als Administrator ausführen… …
Hallo,
das Skript ist ja nicht ganz komplett, wie die dots anzeigen. Gibt es eine Chance das ganze Skript zu bekommen? Dann müsste ich mir nicht mein eigenes schreiben.
Gruß,
Ralf
Ich habe jetzt mal den kompletten Script im Artikel.
Aber in der letzten Zeit habe ich immer wiedermal an dem Script herum gebastelt und dadurch ist er leider nicht übersichtlicher geworden… Bei mir läuft er aber so – also hoffe ich, er hilft Dir weiter.