Skip to content

How does mkPiratebox work?

MaStr edited this page Apr 6, 2012 · 1 revision

The following steps are processed while install of the PirateBox package postinst:

  1. Mount USB Drive

  2. Stop & Disable running uhttpd & luci stuff

  3. Enable Piratebox for startup

  4. run piratebox-setup

  5. run piratebox-init

  6. run piratebox-update

  7. restart firewall

  8. (restart dnsmasq - removed in 0.3.3 )

  9. reload wifi

  10. start Piratebox

piratebox-setup

  1. usbconfig ⇒ Create entry in /etc/config/fstab for mounting /dev/sda1 to /mnt/usb

  2. netconfig ⇒ Set hostname, IP, do some /etc/config/network , enable wireless, set SSID ; stop dnsmasq

piratebox-init

  1. mount /mnt/usb

  2. create special swap device & activate it (function pb_mkswap )

  3. create image file for /usr/local (called ext. loop image) ⇒ Unzip /usr/share/piratebox/OpenWRT.gz to usb and mount it. Do the /etc/config/fstab entries.

  4. create piratebox-image (see pb_mkpbimg )

  5. create opkg-destination in /etc/opkg.conf

  6. Link external Image to /usr/local and do some other linking stuff.

piratebox-update

  1. Take care that external Image is mounted

  2. disable DNS redirection ( currently unproved function by cr )

  3. remove opkg.lock if exits (Hack for running in postinst )

  4. Check if libffi python python-mini exists on USB device and install it from there

  5. if not; use internet, update opkg list and install python to external device

  6. Undo opkg.lock Hack

  7. link python to /usr/bin/

piratebox-start

  1. Take care, that all needed loop imaged (ext, pb) and swap space is mounted

  2. Expand PATH and LD_LIBARY_PATH with /usr/local

  3. Create Share-Folder, if needed.

  4. Start scripts located in /opt/piratebox/init.d/piratebox_router

pb_mkpbimg

  1. if Piratebox-Image is mounted, unmount

  2. take care, that USB is mounted

  3. create mountpoint /opt/piratebox

  4. if piratebox_img.gz exists on /mnt/usb use this file, if not, do wget and fetch the file

  5. Unzip the file

  6. Do /etc/config/fstab