GithubHelp home page GithubHelp logo

dennisdebel / offlineart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mastr/offlineart

1.0 2.0 0.0 154 KB

Source Repository for Aram Bartholl's OFFLINEART project. More information at http://www.offlineart.net (we be filled later)

Shell 99.64% PHP 0.36%

offlineart's Introduction


------------------------------------------------------------------------------                   
///////////////////////////////////////////////////////////////////////////////
-------------------------------------------------------------------------------                   

      *******   ******** ******** **       ** ****     ** ********
     **/////** /**///// /**///// /**      /**/**/**   /**/**///// 
    **     //**/**      /**      /**      /**/**//**  /**/**      
   /**      /**/******* /******* /**      /**/** //** /**/******* 
   /**      /**/**////  /**////  /**      /**/**  //**/**/**////  
   //**     ** /**      /**      /**      /**/**   //****/**      
    //*******  /**      /**      /********/**/**    //***/********
     ///////   //       //       //////// // //      /// //////// 
                        **     *******   **********
                       ****   /**////** /////**/// 
                      **//**  /**   /**     /**    
                     **  //** /*******      /**    
                    **********/**///**      /**    
                   /**//////**/**  //**     /**    
                   /**     /**/**   //**    /**    
                   //      // //     //     //    

-------------------------------------------------------------------------------                   
///////////////////////////////////////////////////////////////////////////////
-------------------------------------------------------------------------------  


   Idea & Sponsored by:  Aram Bartholl     < bartholl_at_datenform.de >       http://datenform.de/
   Package written  by:  Matthias Strubel  < [email protected] >   

   The whole OFFLINEART Package is licenced unter GPL-3 !

   Changes:
     2013-01-15   MaStr   Introduction & Release preparetions


   1. Introduction

 Inspired by David Darts' PirateBox, the OFFLINEART brings digital Art to your home. 
 It consists of a router, and USB-stick and some software.
    More about OFFLINEART in general:  http://www.offlineart.net

 Matthias' Sidenote: This github Project may be used as a idea how to customize a PirateBox
image.

   x. Technical notes about the project..

This project is some sort of a fork form the original PirateBox sources. It reuses the 
implemented - so called "Hooks" to interfere in the normal PirateBox startup. 
Combinded with the customized WRT-Package it deployes the special PirateBox image and 
offers new possibilities for changing partical settings without locking into the hardware
and to customization with a terminal.

There is currently no laptop support!

     xx. The modified OpenWRT - Package.

Beside some modification on the Makefile  (compared to the MaStr/mkPirateBox ) the main 
modifications are done on wrt_package/src/data/etc/piratebox.common 

These modifications are:
    #  Change in default $pb_pb_srcImg_url  to the future downloade image (containing several 
          scripts and original PirateBox stuff
    #  Change in default $pb_pb_srcImg to a new dataset name
    #  Change in default folder for USB-Stuff in $pb_usbdir  to "offlineArt"
    #  Change in default $pb_wireless_ssid and $pb_hostname to "offlineArt" and "offlineArt.lan"
    #  Inserted new variables starting with oa_   These are described in piratebox.common
    #  Removed not hostname generation ( in 0.6. it wasn't optional)
    #  Encapsuled setup of hostname & SSID in functions
    #  Inerted a uci-set for txpower  to wifi-device[0]  (it set to 25)
    #  Added folder creation to pb_init() (see below)
    #  Enabling rc.local (currently overwriting) with check of config-folder
    #  Added even more packages that are getting installed during pb_update. These packages are
    ####  lighttpd-mod-accesslog
    ####  lighttpd-mod-simple-vhost  (not used at all)
    ####  php5
    ####  php5-cgi
    ####  php5-mod-json
    ####  php5-mod-gd
    ####  php5-http
    # Added preparing for php.ini (linking and modifing for modules)
    # Added several functions for analyzing & filling up config folder.
    # Every $$$$.txt file got a oa_config_set_$$$$ function  (these functions are called dynamically 
        in oa_config_lookup_and_set_step() )  

Beside of these changes above, there are customization in etc/init.d/piratebox to call config & config_change
from console.. and rc.local.

During the installation of the OpenWRT there are several things done:

    # Created /usr/local        - (PirateBox default for ext root)
    #         /opt/piratebox    - (PirateBox default for PirateBox' image file)
    # Installed & setup PHP & Python
    # Activated www folder on the USB stick  
    # initialized rc.local 
    # Switched  hostname & SSID - (PirateBox default)
    # Enabled wifi              - (PirateBox default)
    # TXPower is set to my know maximum 
    # Initial config status is written

In the end of the normal install you should end up with the following directories on your 
USB Sticks:

    offlineArt/                 - main directory;
    offlineArt/config           - keeps the current configuration
    offlineArt/config/set       - empty; move changeable configs down there
    offlineArt/ext_www          - lighttpd base directory for www stuff
    offlineArt/ext_www/content  - There the artFiles should be located
    offlineArt/Shared           - not used
    offlineArt/tmp              - used by lighttpd in case you want to use upload (on your side)

The following files are getting generated on the USB drive

    offlineArt/config/           
                      txpower.txt   - current txpower of wifi card 0
                      ssid.txt      - current ssid of wifi interface 0
                      hostname.txt  - current hostname set on the system
                                        is used later for redirection
                      channel.txt   - current channel of wifi card 0


During startup the following folder will be read:

    offlineArt/config/set

Is the folder containing any files machting to the name pattern above, then the configuration 
will be applied:

    1. reading the $$$$$.txt file
    2. setting the paramter via uci or custom function 
    3. removing the file
    4. Puking out the current configurations
    5. rebooting system after all changes are done


There is a logfile, which is always written during bootup and doing changes, which you can find
on the USB Stick:

   offlineArt/apply_config.log 

Currently there is no valuation of the stuff you are entering in the .txt files. Keep it clean 
and avoid a carrige return at the end of the line and special characters in hostname&SSID . 

   x.x. Modifications in PirateBox image

The modification of the PirateBox uses hooks introduced in PirateBoxScripts_Webserver 0.3.2 . 
These are empty .sh files called during the phases like initialisation, startup, stop etc.
Hooks and files that replaces current are located in the repository-folder 

	custom_image/mod_data

The directory structure looks like the structure you find in /opt/piratebox .  All the files
are copied over to the mounted original PirateBox-image during a "make". 

Because in the PirateBoxScripts_WebServer 0.6 there are some limitations, because "stock"
have to overwritten during make

        bin/shoutbox_stuff.sh          - emptied out to disable chat relevant stuff
        conf/lighttpd/lighttpd.conf    - Replaced; disables a few configuration

New:
        conf/lighttpd/offlineArt_mod  - includes configuration for .php files
                                        Includes "include" for generated lighttpd file 
						"offlineArt_mod_gen" (will be discussed later)
                                                     
                                         
While this make following Changes are made in 
		piratebox.conf

  # disable Droopy
  # disable chat resetting


OFFLINEART uses only one hook:  "hook_piratebox_start.sh" which is called during startup.

In this hook the offlineArt_mod_gen include member for lighttpd is written. After this is 
done the hook also generates a new redirect.html and index.html based on the hostname.
This happens on  _____ every startup _____  ... if you want to modify these; you have to 
customize /opt/piratebox/bin/hook_piratebox_start.sh

   x.x.x offlineArt_mod_gen 

This file is responsible for different behavior depending on the entered hostname. 
The hostname is resolved during a uci command. Then the behaviour differs into

    entered URL(host) =! hostname
       ---> use /opt/piratebox/www  as document root (linked to <usb>/offlineArt/ext_www during first init)
       ---> for 404 errors  use /redirect.html  for redirecting to http://$hostname/
       ---> write access-log :   <usb>/offlineArt/general_access.log 

    entered URL(host) == hostname 
       ---> use /opt/piratebox/www/content  as document root 
       ---> deliver a 404
       ---> write access-log :   <usb>/offlineArt/content_access.log

In addition, the break.log & error.log of lighttpd is reconfigured to

    <usb>/offlineArt/lighttpd_error.log
    <usb>/offlineArt/lighttpd_break.log

These logfiles are useful, if you encouter problems with php scripts and so on.


   x. Tested on devices

The following devices were used for the first implementation. These aren't the only one where the 
package can run. Added "Working USB Sticks" because, it seems that the Cruzer Fit performs quite well 
(other USB sticks are working, too) .

   Device                  OpenWRT                         Results
   ---------               -------                         ---------
   TPLink MR3020           trunk-r33003                    works. txpower has no effect
   TPLink WR842ND          AA 12.09-beta ( r33312 )        works. txpower seems to work.
   Buffalo WZR-HP-AG 300h  AA 12.09-beta ( r33312 )	   worked quite normal (first box had some trouble)
							   txpower seems to work
   Linksys WRT160NL        AA 12.09-beta2 ( r33883)        works. txpower, not sure.
   TPLink  WR1043ND(Ger)   AA 12.09-beta2 ( r33883)        works

  
   Workin USB Sticks
   -----------------
   SanDisk  Cruzer Fit 16GB
   Kingston DTSE9H 16GB 
 
   ... but every other USB Stick with a good read-performance should work too


   x. Install steps

	xx. Installing on the TP-Link WR842ND v1.0
		
		xxx. Preparing the USB stick
		The content of your offlineArt router is 'hosted' on a USB stick that goes into the offlineArt router. This needs to be prepared first:

		- cd into a tmp folder on your (linux) computer
		- clone the offlineArt repo in here and make the USB stick image:
			 $ git clone [email protected]:MaStr/OFFLINEART.git
		 	 $ cd OFFLINEART/custom_image/
			 $ make
			 
		After building is finished, copy the file 'offlineArt_0.1_img.gz' located in 'OFFLINEART/custom_image/' to your single-partition FAT32 formatted USB stick.
		- put the USB stick in your router.


		xxx. Preparing your router
		- download the following router firmware:
			http://downloads.openwrt.org/attitude_adjustment/12.09-beta/ar71xx/generic/openwrt-ar71xx-generic-tl-wr842n-v1-squashfs-factory.bin

		- turn of computer wireless, and connect the router via ethernet.
		- open browser, goto 192.168.1.1, username:pass > admin:admin
		- upgrade the firmware with the file you downloaded above
		- the router now reboots, again go 192.168.1.1 and set a password.
		- now you can ssh into the router via terminal
		- make the router internet ready > open terminal type: 
			ssh [email protected]
			vi /etc/config/network
			press 'i' to edit, and ONLY change the 'lan' interface settings as below:
			config interface 'lan'                                                                    
       			option ifname 'eth0'                                                              
       			option type 'bridge'                                                              
        		option proto 'static'                                                             
        		option ipaddr '192.168.2.111'                                                       
        		option netmask '255.255.255.0'                                                    
        		option gateway '192.168.2.1'                                                     
        		list dns '192.168.2.1'                                                           
        		list dns '8.8.8.8'

			make sure the gateway and first list dns ip's are your internet modem/routers ip!
			the 'ipaddr' should be different from your internet modem/router's 
			make sure both the offlineArt router and your internet modem/router are on the same subnet ('2' in the example above)
		
		- connect your internet modem/router from a 'lan'/'switch' port to your offlineArt routers 'wan'/'internet' port with a network cable.
		- reboot your offlineArt router (type reboot in the terminal)
		- wait, connect to the offlineArt router again via the ip set above (option ipaddr '192.168.2.111' in the example).
		- when connected, try if you can ping google by typing 'ping google.com' in the terminal. If it can reach google, your set! Next:
			
		
		- type: 
			opkg update
			opkg install http://piratebox.aod-rpg.de/offlineArt_0.1.2_all.ipk
		- ignore any 'chown' ownership errors and follow the instructions (remove wan cable, reboot)
		- done!
				

		

   x. Customization hints                    

     ... to be filled up ...

   x. FAQ

   xx. How & Where put the art files to?

Switch your artbox offline and take the USB stick to your computer. You will find an folder called:

    <device>/offlineArt/ext_www/content

Leave the content of ext_www untouched, because it is responsible for fixing issues with iOs devices.



To be done
---

* Fill up the README file
* Prepare downloadble packages
* Remove Bug with reverse-Hostname lookup (not sooo important)
* Insert a "please don't cache" instruction to redirect page (causes trouble, If you have a lot of boxes and the user does 
stupid reloads ( I did and broke my browser's cache )

offlineart's People

Contributors

dennisdebel avatar mastr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.