PirateBox Laptop Mods

Most of the following HowTos apply to a Raspberry or other normal OS versions.

PirateBox 1.1.x mods

If not listed separately the documentation of 1.0.x applies.

Activate PHP

PHP should be ready to run. To activate PHP on PirateBox, you need to edit /opt/piratebox/conf/lighttpd/lighttpd.conf and remove the # in front of the last line: #include “/opt/piratebox/conf/lighttpd/fastcgi-php.conf”

The can be achieved with the following command, too:

 sed -i -e 's|^#include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|' \
   /opt/piratebox/conf/lighttpd/lighttpd.conf

Depending on you distribution, you need to check, if PHP path is limited to something. Search for the line doc_root = .

After this make a reboot. All .php files are processed, as long as these are placed in the /content/ folder. This folder is located in /opt/piratebox/share. In fastcgi-php.conf, the thread limit is 1, if you run on a multiple core system you may want to increase it.

Change SSID

Edit the file /opt/piratebox/conf/hostapd.conf and change the line

ssid=piratebox: free share

and restart your PirateBox-Scripts

Change of IP-Adresses

  • /opt/piratebox/conf/piratebox.conf - The following lines:
 #Network
 NET=192.168.77
 

And if you want to change the IP of your Box directly, you need to find this line and exchange the 1:

 #IP-SHORT (is stringed together)
 #  Which IP is your Box??  i.e. 1 => 192.168.77.1
 IP_SHORT=1

Small python Forum

For installing the pyForum named Forest, run:

/opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf pyForum

Files for the forum are stored in /opt/piratebox/forumspace (which should be Backuped before upgrading).

On scriptbased PirateBox you have to do the following additional steps:

  1. Edit /opt/piratebox/conf/piratebox.conf find the line starting with FORUM_LINK_HTML and uncomment the 2nd line.
  2. Restart the PirateBox

Imageboard

Ensure that the basic Perl-Packages are installed. Usually everything needed is in the basic install included, and if you encounter problems, you can find “dumps”/“Errors” of the board in /opt/piratebox/tmp/break.log

This installs the kareha Imageboard to you Piratebox. It will installed to /opt/piratebox/shared/board . Read your system specific stuff! The following command is required, to ensure everything is setup correctly:

  /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard 

If you made a mistake, you have to remove /opt/piratebox/share/board/init_done to get a fresh clean install.

Exchange Upload-Folder

Do you want, that your users uploads to a different directory than the default directory, where the “Browse” link points to? You can easily achieve this with editing /opt/piratebox/conf/piratebox.conf. Find this line and enter your new upload folder:

#Upload Folder
# Change this if you want to user uploaded data in a subfolder
#   Make sure the folder exists
# UPLOADFOLDER="$FOLDER/Upload"
UPLOADFOLDER=$FOLDER

Avoid special characters in directory-name and ensure the directory exists and has the correct permissions!

Disabling Shoutbox-Reset after reboot

On default, the Shoutbox is cleared on a new startup. To disable this, you need to set the following line in /opt/piratebox/conf/piratebox.conf to no

 # Reset Shoutbox on Startup?
 RESET_CHAT="yes"

Hostname

Simply run the following command

sudo /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf hostname my_new_hostname

Custom Directory Listing

How to customize your personall directory-listing is described on the Lighttpd wiki

Show connected clients

There is a script, which greps the needed informations from “iw”. It was designed to run on OpenWRT, but it might work on laptops, too. If you want to use this, run the following command:

  /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf station_cnt 
  

The makes an entry to your crontab of the current user. It updates a station_cnt.txt file in /opt/piratebox/www every 2 minutes. On OpenWRT you have to ensure, that the cron daemon runs:

 /etc/init.d/cron enable && /etc/init.d/cron start 

Calibre OPDS

FIXME create an Laptop RPi version of this

Some of our member wrote a great tutorial to get the software running: PirateBox + COPS (Calibre OPDS (and HTML) PHP Server)

OpenStreetMap on Piratebox

FIXME create an Laptop RPi version of this

PirateBox + OpenStreetMap

PHP for PirateBox

FIXME create an Laptop RPi version of this

FIXME php install routine

Then modify /opt/piratebox/conf/lighttpd/lighttpd.conf. Find this line

 
 $HTTP["url"] =~ "^/cgi-bin/" {
  	cgi.assign = ( ".py" => "/usr/bin/python" )
 } 
 

Add below

 $HTTP["url"] =~ "^/php/" {
  	cgi.assign = ( ".php" => "/usr/local/bin/php-cgi" )
 } 

and find

  static-file.exclude-extensions = ( ".php",".pl", ".fcgi" , ".cgi" , ".py" ) 

change to

  static-file.exclude-extensions = ( ".pl", ".fcgi" , ".cgi" , ".py" ) 

Find in /etc/php.ini

  doc_root = "/www" 

and change it to

  doc_root = "/opt/piratebox/www" 

Now every create a folder called “php” to your /opt/piratebox/www/

mkdir -p /opt/piratebox/www/php
chown -R nobody /opt/piratebox/www/php

You can lay down you php files there or in subfolders now. You can lay down your php stuff on the USB-device and link to it. For example a link to my wiki located on the usb device:

  ln -s /mnt/usb/PirateBox/wiki  /opt/piratebox/www/php/wiki