--------------------------------Linux Guide---------------------------------- by Ingo Blechschmidt (c) 2002 ----------------------------------------------------------------------------- ------------------------- Internet on a floppy ------------------------- Die Jul 31 13:08:51 MEST 2000 ------------------------- Internet floppy überformatiert Diskette wget quota while du ----------------------------------------------------------------------------- Sie haben zwei Computer, einen mit und einen ohne Internet-Anschluss, und wollen einige Webseiten auf Diskette kopieren. get_inet.sh hilft dabei. ----------------------------------------------------------------------------- Das Skript, siehe <"down/get_inet.sh">Download: --------CODE--------: get_inet.sh #!/bin/bash$ $ # get_inet.sh - Holt Webseiten aus dem Internet und speichert sie auf Diskette.$ # Copyright (C) Mon Jul 30 20:53:44 MEST 2001 by Ingo Blechschmidt$ #$ # This program is free software; you can redistribute it and/or modify$ # it under the terms of the GNU General Public License as published by$ # the Free Software Foundation; either version 2 of the License, or$ # (at your option) any later version.$ #$ # This program is distributed in the hope that it will be useful,$ # but WITHOUT ANY WARRANTY; without even the implied warranty of$ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ # GNU General Public License for more details.$ #$ # You should have received a copy of the GNU General Public License$ # along with this program; if not, write to the Free Software$ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.$ #$ # Ingo Blechschmidt$ # Arberstraße 5$ # 86179 Augsburg$ # E-Mail: iblech@web.de, http://www.way.to/uselinux/$ # Tel.: +49 / 821 882955$ #$ # $ $ echo get_inet.sh - Holt Webseiten aus dem Internet und speichert sie auf Diskette.$ echo Copyright '(C)' Mon Jul 30 20:53:44 MEST 2001 by Ingo Blechschmidt$ echo$ echo This program is free software\; you can redistribute it and/or modify$ echo it under the terms of the GNU General Public License as published by$ echo the Free Software Foundation\; either version 2 of the License, or$ echo '(at your option)' any later version.$ echo$ echo This program is distributed in the hope that it will be useful,$ echo but WITHOUT ANY WARRANTY\; without even the implied warranty of$ echo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ echo GNU General Public License for more details.$ echo$ echo You should have received a copy of the GNU General Public License$ echo along with this program\; if not, write to the Free Software$ echo Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.$ echo$ echo Ingo Blechschmidt$ echo Arberstraße 5$ echo 86179 Augsburg$ echo E-Mail: iblech@web.de, http://www.way.to/uselinux/$ echo$ echo $ $ $ WEBSITES="http://gnome.org/todo http://sources.redhat.com/gsl$ http://www.linux-magazin.de/ausgabe/1998/08/Pouder/pouder.html$ http://www.gnu.org/manual/make/html_chapter/make_toc.html$ http://www.gnu.org/manual/sharutils-4.2/html_chapter/sharutils_toc.html"$ # List of websites to get,$ # whitespace separated.$ # my datas:$ # COMP_RATE="11" # Compression rate of tar.bz2.$ # MAX_SIZE="1722" # Maximum space of a$ # # "over-formatted" floppy.$ SIZE_PER_SITE="150" # Size per site, in kb.$ $ [ -e /tmp/get_inet ] || mkdir /tmp/get_inet/ # Crating temporary directory.$ cd /tmp/get_inet/$ $ # start of the request loop,$ # get files until a$ # over-formatted floppy is$ # full.$ while$ [ "$[`du -skc /tmp/get_inet/ | tail -n 1 | gawk '{ print $1; }'`<1500]" = "1" ]$ do$ for i in $WEBSITES; do # for-loop.$ echo ">> $0: Getting $i..."$ # Getting the files, except$ # image-, video- and$ # sound-files.$ HOST=`echo $i | gawk -F / '{ print $3; }'` # Host-limitation.$ wget -nv -k -nc -D $HOST -c -r -Q ${SIZE_PER_SITE}k -R "jpeg,jpg,gif,png,avi,mpg,wav,mp3" $i$ done$ done$ $ mount /mnt2 # Mounting the floppy,$ # /dev/fd0u1722.$ # Saving and compressing the$ # web.$ # mount -t ext2 /dev/fd0u1722 /mnt2$ $ echo "Packe..."$ $ tar cvvvIf /mnt2/maze/get_inet.tar.bz2 /tmp/get_inet/ && rm -r /tmp/get_inet/$ umount /mnt2 & # U-mounting the floppy, as a$ # background job (the &),$ # therewith the next line is$ # being started immediate.$ # rm -r /tmp/get_inet$ --------/CODE--------
    * Dokumentation zu get_inet.sh
      * Einleitung get_inet.sh lädt Webseiten aus dem Internet auf die Diskette, mit tar.bz2 komprimiert. Damit passen ca. 5 MB HTML-Dateien auf eine überformatierte Diskette. get_inet.sh funktioniert voll automatisch, d.h. es lädt die Dateien herunter, komprimiert sie und speichert sie auf einer überformatierten Diskette ohne weitere Benutzereingaben zu fordern. * Abhängigkeiten Damit get_inet.sh funktioniert, müssen folgende Programme installiert sein:
        * bash - Bourne Again SHell, auf jeder Linux-Distribution zu finden, * du - Disk Usage, ebenfalls auf jeder Distribution vorhanden, und * wget - WebGet, sollte auf einem Linux-System nicht fehlen, wenn doch: Unter siehe <"http://www.gnu.org">http://www.gnu.org können Sie es herunterladen. * Arbeit mit get_inet.sh
          * Eine Diskette überformatieren Als erstes muss (nur einmal) eine Diskette überformatiert werden. Der Befehl (einzugeben als root) lautet: --------CODE--------: Überformatierenmke2fs -c /dev/fd0u1722--------/CODE-------- Der Mounten der Diskette erfolgt dann mit --------CODE--------: Mountenmount -t ext2 /dev/fd0u1722 /mnt--------/CODE-------- Wenn Sie des Öfteren überformatierte Disketten benutzen, empfiehlt sich folgender Eintrag in der Datei /etc/fstab (ist Vorraussezung für die Arbeit mit dem Skript): --------CODE--------: /etc/fstab /dev/fd0u1722 /mnt2 auto noauto,user 0 0 --------/CODE-------- Außerdem ist noch folgender Befehl notwendig, ebenfalls einzugeben als Superuser: --------CODE--------: mkdir[ -e /mnt2 ] || mkdir /mnt2--------/CODE-------- * Das Skript modifizieren Dann muss das Skript modifiziert werden, die Webseiten müssen in die Variable WEBSITES eingetragen werden, getrennt durch einen Abstand (). Mehr Arbeit ist nicht notwendig. * Das Skript starten Auf dem Rechner mit Internet muss dann nur noch das Skript gestartet werden (nach vorherigem Mounten), mit /get_inet.sh. * Arbeitsweise von get_inet.sh get_inet.sh lädt von einer Website immer 150 Kilobytes (zu modifizieren in der Variable SIZE_PER_SITE) aus dem Internet herunter, und fährt dann mit der nächsten Website fort. Wenn von allen Websites 150 Kilobytes heruntergeladen sind, prüft das Skript, ob noch genug Platz zur Verfügung steht (nur Schätzung), und lädt weitere 150 Kilobytes von jeder Website herunter. Hinweis: Zum Herunterladen der Dateien benutzt das Skript wget. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- This document is distributed under the terms of the GNU Free Documentation License.