Create Custom Installer

Posted by carthax 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Create Custom Installer
June 20, 2017 12:45AM
I am working on an application of PirateBox that would be used by a non-profit, and I would need to create a minimum of 10 fully-functioning WR3040 routers right off the bat. In the future, I will be selling the WR3040 and thumbdrive to individuals who might have zero knowledge of computers.

What I'd like to end up with is a firmware and install folder on a thumbdrive that will set up the system for complete newbies -- so all they have to do is plug in the thumb drive, turn on the router, wait till it stops flashing, then have it ready to go with the correct SSID and all of our information on it.

Can anyone point me in the right direction to do that?

Regards,
Carthax
Re: Create Custom Installer
June 23, 2017 05:25AM
Hi,
yes I can.

The easiest way is to fork PirateBox-Dev/PirateBoxScripts_Webserver . This is the minimum if you do not necessarily need to add new packages.

Create a branch, which is based on master (then you can merge things back to your branch and get proper diffs after a new PirateBox release is out).

Adjust the configuration in piratebox/piratebox/conf/piratebox.conf
As the SSID is OpenWrt based, it is a bit more difficult. I recommend the easisest option first:
add your custom adjustments using uci in piratebox/piratebox/bin/hooks/hook_pre_openwrt_init.sh
This script is executed before PirateBox initialization is done. You can add normal shell script commands here.
For changing the SSID, a simple:

Language: PHP
uci set wireless.@wifi-iface[0].ssid="my SSID" uci commit wireless

is enough.

Other things, for example piratebox configuration, should be placed in
piratebox/piratebox/bin/hooks/hook_post_init.sh
Here you can add a change for the hostname, for example:

/opt/piratebox/bin/install_piratebox.sh $1 hostname "12v.offline"

The UI is placed in piratebox/piratebox/www_content/ , remember, it will only copied into place after you removed the content folder on the USB stick.

If you are done with your customizations, then you will continue with creating an img file for the piratebox package. The steps are:

make clean
make shortimage

After this you get piratebox_ws_1.1_img.tar.gz which you can exchange with piratebox_ws_1.1_img.tar.gz inside the install.zip. OR you can test it on an already working image. Replace the file with the file in <usb>/install ,
then login and perform the following commands (assuming minidlna is not running):

/etc/init.d/piratebox stop
/etc/init.d/piratebox updatePB
/etc/init.d/piratebox start
Within the next start step, the pre_openwrt_init step and later the post_init step are executed.

Hope that helps, let me know if you need further assistance,

best regards
Matthias


This is only my signature.