#!/bin/bash # # ------------------------------------------------------------------ # made by sputnick in da FreAkY lApPy lAb (c) 2009 # gilles.quenot gmail com # Idea from smecher. # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License published by the Free Software Foundation. # (see http://www.gnu.org/licenses/gpl.html). # ------------------------------------------------------------------ # ,,_ # o" )@ # '''' # ------------------------------------------------------------------ # # vim:ts=4:sw=4 # # # Version 0.2 # # # Script permettant de lancer un serveur web en dialog zenity a la volee dans le dossier courrant. # Il affiche les IP:PORT interne et externes qui seront disponibles. # ( Si vous etes derriere un routeur, il faut le configurer pour que le port 8000 # soit forwarde vers votre adresse IP locale. # # Questions et infos : http://forum.ubuntu-fr.org/viewtopic.php?id=364489 # # Prerequis: # zenity # # iface=eth0 # Votre interface reseau : iface=ra0, iface=wlan0 etc... # ne plus modifier # -----8<-------------------------------------------------------------------------------- DIR=${1:-$PWD} if nc -z -w2 localhost 8000; then zenity --error --title="error:" --text="Le port localhost:8000 bind deja !\n\nSeeYa..." exit 1 fi zenity --question --text="\"$DIR\" sera accessible dans votre navigateur a l'adresse: public: $(wget -O - -q http://sputnick-area.net/ip):8000 prive: $(ifconfig $iface | awk '/inet/{gsub(" *inet add?r:","");print $1;exit}'):8000 Continuer?" || exit 0 python -m SimpleHTTPServer & pro=$! while true; do zenity --notification --text="Appuyer pour eteindre le serveur" if zenity --question --title="Confirmation?" --text="T'es sur ? Ca va trancher cherie !"; then kill $pro exit $? fi done