Embedded-Bash 2008/Asus WRT: Unterschied zwischen den Versionen
(Kommentiert) |
|||
| (2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
OpenWRT auf dem Asus WL 500 gP | OpenWRT auf dem Asus WL 500 gP | ||
| − | Wie man Linux auf seinen Router bekommt, weiß inzwischen fast Aber neben SSH und schicken Web-basierten Konfigurationen kann man | + | Wie man Linux auf seinen Router bekommt, weiß inzwischen fast jeder. Aber neben SSH und schicken Web-basierten Konfigurationen kann man noch viel mehr damit machen: Tor-Anonymisierung, BitTorrent, Printserver, Mailserver, Fileserver, Jukebox, IPv6. Dieser Beitrag soll einige der Use-Cases demonstrieren, und deren Vor- und Nachteile aufzeigen. |
| + | === Scripts === | ||
| + | <nowiki> | ||
| + | #!/bin/sh | ||
| − | + | CACHEDIR="/mnt/ext/cache/" | |
| + | TORRENTURLCACHE="${CACHEDIR}/url.cache" | ||
| + | TORRENTFILECACHE="${CACHEDIR}/file.cache" | ||
| + | HASH="/opt/bin/md5deep" | ||
| + | RSSTAIL="/opt/bin/rsstail" | ||
| + | GREP="/bin/grep" | ||
| + | MD5SUM="/usr/bin/md5sum" | ||
| + | WGET="/usr/bin/wget" | ||
| − | + | [ ! -f "${TORRENTURLCACHE}" ] && touch ${TORRENTURLCACHE} | |
| + | [ ! -f "${TORRENTFILECACHE}" ] && touch ${TORRENTFILECACHE} | ||
| − | + | cd "${CACHEDIR}" | |
| + | |||
| + | # call: with | ||
| + | # download "RSSURL" "target_dir" "REGEX_to_filter" | ||
| + | download() { | ||
| + | RSSFILE=$1 | ||
| + | TARGET=$2 | ||
| + | REGEX=$3 | ||
| + | |||
| + | ${RSSTAIL} -1 -l -u ${RSSFILE} | ${GREP} -i -E "${REGEX}" -A1 | ||
| + | URLS=`${RSSTAIL} -1 -l -u ${RSSFILE} | ${GREP} -i -E "${REGEX}" -A1 | ${GREP} -o http://.*` | ||
| + | |||
| + | for url in ${URLS} ; do | ||
| + | URLHASH=`echo ${url} | ${HASH}` | ||
| + | if ${GREP} ${URLHASH} ${TORRENTURLCACHE} > /dev/null ; then | ||
| + | echo "Already downloaded: ${url}" | ||
| + | else | ||
| + | echo "New torrent: ${url}" | ||
| + | ${WGET} ${url} -O ${URLHASH}.torrent && echo ${URLHASH} >> ${TORRENTURLCACHE} | ||
| + | MD5=`$MD5SUM ${URLHASH}.torrent | cut -d ' ' -f 1` | ||
| + | if ${GREP} ${MD5} ${TORRENTFILECACHE} > /dev/null ; then | ||
| + | rm ${URLHASH}.torrent | ||
| + | else | ||
| + | echo $MD5 >> $TORRENTFILECACHE | ||
| + | chown rt ${URLHASH}.torrent | ||
| + | mv ${URLHASH}.torrent /mnt/cambot/torrents/queue/${TARGET} | ||
| + | fi | ||
| + | fi | ||
| + | done | ||
| + | |||
| + | } | ||
| + | |||
| + | download "http://www.jamendo.com/get/album/list/album/p2p/rss2/?o=release_date_desc&n=54&p2pnet=bittorrent&are=mp32" "" "" | ||
| + | </nowiki> | ||
| + | |||
| + | === Links === | ||
| + | |||
| + | * Kamikaze Installation und Asus WL 500g | ||
| + | ** http://wiki.x-wrt.org/index.php/Kamikaze_Installation | ||
| + | ** http://wiki.openwrt.org/OpenWrtDocs/Hardware/Asus/WL500GP | ||
| + | |||
| + | * Optware | ||
| + | ** http://wiki.openwrt.org/Optware | ||
| + | ** http://www.nslu2-linux.org/wiki/Optware/Packages | ||
| + | |||
| + | * Freie Musik bei Jamendo | ||
| + | ** http://www.jamendo.com/ | ||
| + | ** [http://developer.jamendo.com/ Developer API] | ||
Aktuelle Version vom 18. November 2008, 19:41 Uhr
OpenWRT auf dem Asus WL 500 gP
Wie man Linux auf seinen Router bekommt, weiß inzwischen fast jeder. Aber neben SSH und schicken Web-basierten Konfigurationen kann man noch viel mehr damit machen: Tor-Anonymisierung, BitTorrent, Printserver, Mailserver, Fileserver, Jukebox, IPv6. Dieser Beitrag soll einige der Use-Cases demonstrieren, und deren Vor- und Nachteile aufzeigen.
Scripts
#!/bin/sh
CACHEDIR="/mnt/ext/cache/"
TORRENTURLCACHE="${CACHEDIR}/url.cache"
TORRENTFILECACHE="${CACHEDIR}/file.cache"
HASH="/opt/bin/md5deep"
RSSTAIL="/opt/bin/rsstail"
GREP="/bin/grep"
MD5SUM="/usr/bin/md5sum"
WGET="/usr/bin/wget"
[ ! -f "${TORRENTURLCACHE}" ] && touch ${TORRENTURLCACHE}
[ ! -f "${TORRENTFILECACHE}" ] && touch ${TORRENTFILECACHE}
cd "${CACHEDIR}"
# call: with
# download "RSSURL" "target_dir" "REGEX_to_filter"
download() {
RSSFILE=$1
TARGET=$2
REGEX=$3
${RSSTAIL} -1 -l -u ${RSSFILE} | ${GREP} -i -E "${REGEX}" -A1
URLS=`${RSSTAIL} -1 -l -u ${RSSFILE} | ${GREP} -i -E "${REGEX}" -A1 | ${GREP} -o http://.*`
for url in ${URLS} ; do
URLHASH=`echo ${url} | ${HASH}`
if ${GREP} ${URLHASH} ${TORRENTURLCACHE} > /dev/null ; then
echo "Already downloaded: ${url}"
else
echo "New torrent: ${url}"
${WGET} ${url} -O ${URLHASH}.torrent && echo ${URLHASH} >> ${TORRENTURLCACHE}
MD5=`$MD5SUM ${URLHASH}.torrent | cut -d ' ' -f 1`
if ${GREP} ${MD5} ${TORRENTFILECACHE} > /dev/null ; then
rm ${URLHASH}.torrent
else
echo $MD5 >> $TORRENTFILECACHE
chown rt ${URLHASH}.torrent
mv ${URLHASH}.torrent /mnt/cambot/torrents/queue/${TARGET}
fi
fi
done
}
download "http://www.jamendo.com/get/album/list/album/p2p/rss2/?o=release_date_desc&n=54&p2pnet=bittorrent&are=mp32" "" ""
Links
- Kamikaze Installation und Asus WL 500g
- Freie Musik bei Jamendo