Package: ezboot
Automatically configure aBoot2GeckoDevice. It’s so ez!This is a command line script for the convenience of
developing on B2G such that you need to flash new builds
to your device periodically and begin hacking ASAP.Features:Automatically downloads the latest build and flashes itConfigures WiFi on your devicePre-installs apps that you commonly needPuts custom prefs on your deviceEasy, intuitive command lineYou can use a config file for everythingFrictionless convention over configurationDo you really need this? Probably not!ezbootis intended for B2G platform developers.
If you are a B2Gappdeveloper you should try theFirefox OS Simulatorfirst because that will have
better features for you (such as Push To Device).Requirements:Mac or Linux.On Mac you might need to install XCode with Command Line Tools
fromhttps://developer.apple.com/downloads/Windows could be supported but prepare to send patches.Youmustuse a build of B2G that has Marionette enabled.
More details below.Python 2.7 or greater (Python 3 isn’t suported yet)Thepipcommand to install Python packagesThe best way to set up Python andpipon Mac is to usehomebrew. Once homebrew is installed typebrew install python. This will give you thepipcommand.adbneeds to be on your$PATH.
Get it from theAndroid SDK.Some additional Python modules will be installed as dependenciesCaveats:You should not enable the Remote Debugging setting on B2G when
Marionette is enabled. This will create conflicting debugger listeners.
Seehttps://bugzilla.mozilla.org/show_bug.cgi?id=764913for info.Contents:InstallSourceMarionetteFirst TimersUsageUsing Ezboot To Work With Marketplace PaymentsConfig fileCommandsbinddesktopdlflashhttpinstallinstall_mktkillloginmkt_certsreflashrecsssetupWhy?InstallYou needpipto install ezboot.
For B2G versions 1.2 and greater, install the current version:pip install ezbootFor older B2G versions, install the 1.0 version:pip install ezboot1The installation process pulls in some dependencies so you may want to
use a commonvirtualenvand adjust your$PATHso you can
useezbootfor any project,
e.g./path/to/.virtualenvs/ezboot/bin.WARNING: If you want to run bothezboot1andezbooton your system
you must install each within avirtualenv.To install from source:git clone git://github.com/kumar303/ezboot.git
cd ezboot
python setup.py developSourceThe source is available athttps://github.com/kumar303/ezboot/MarionetteFor this script to work youmustflash your device with a B2G build that
hasMarionetteenabled. The flash command will do
that for you.Read thisif you want to build various flavors of
B2G with Marionette support yourself.First TimersYou’ll try anything at least once, right? The veryfirsttime you runezboot flashyou probably need to enable Remote Debugging first by
digging into
Settings > Device Information > More Information > Developer.
Otherwise,adbwon’t be able to connect.
This only applies if you had flashed with a B2G build that did not have
Marionette enabled.
If you’ve never installed B2G at all then you need to enable debugger
connections on Android.UsageRun this for a quick reference:ezboot --helpUsing Ezboot To Work With Marketplace PaymentsTo whet your appetite, here is a full example of ezboot’s intended use.
Thisdocumentationshows you how to make a local config file and use ezboot to quickly prepare a B2G
device for hacking on the Firefox Marketplace payments system.Config fileYou can set defaults for all argument values by creating anezboot.inifile in the working directory. Make a section
for each sub command with long argument names as keys.
For example:[setup]
wifi_ssid = mywifi
wifi_key = WPA-PSK
wifi_pass = my secure password with spaces
apps = https://marketplace-dev.allizom.org/manifest.webapp
       https://marketplace.allizom.org/manifest.webapp

[flash]
flash_user = ...
flash_pass = ...Using a config file greatly simplifies ezboot because you won’t have to set
commonly used option values.CommandsbindThis binds a hostname on your B2G device to the local IP address of the
workstation that you are running ezboot from. Reference:ezboot bind --helpThe use case here is that you want to connect tohttp://fireplace.localor some URL on your phone and access a development server running athttp://0.0.0.0:80/on your workstation.If you have trouble connecting make sure your mobile device is on the same
network (you probably need WiFi for that) and that your development
server is bound to your public IP.
If it’s a Django app, make sure you start with something like this:python manage.py runserver 0.0.0.0:8000because the default, such as:python manage.py runserver localhost:8000will not bind to your public IP.If you have multiple interfacesezboot bindwill show you the possibilities
so you can choose one from the list of options.Should you want to always use a specific interface then you can use:ezboot bind --bind_int=...Alternatively if you want to set a specific IP you can do so like this:ezboot bind --bind_ip=...and the same for host:ezboot bind --bind_host=...desktopThis downloads a fresh desktop B2G build and installs it for use.
Here is a full reference:ezboot desktop --helpWith the default args it will grab the latest B2G18 build.
If you need to install a different build just set the platform
specific URL. For example, if you are on a Mac and you want to get 1.0.1,
set this:ezboot desktop --mac64-url http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-b2g18_v1_0_1/b2g-18.0.multi.mac64.dmgdlThis downloads a device build and saves the Zip file to a custom directory.
The build will not be flashed to a
device and any subsequentreflashcommand will not attempt to use
it. This is just a convenient way to grab a build without logging in;
the same user/pass options fromflashapply here.Here is a full reference:ezboot dl --helpYou can set a custom location withezboot dl--location=....
By default it will save builds to~/Downloads.flashThis downloads a device build and flashes it to your device.
Here is a full reference:ezboot flash --helpYou will have to specify which device you want to flash since every device has
a separate build that must be used to flash it. You can do that like so:ezboot flash --flash_device unagior, if you have the URL of your build, then do it like so:ezboot flash --flash_url http://pvtbuilds.mozilla.org/...You can also set these in yourezboot.iniconfig file:[flash]
flash_device = unagi/inarior:[flash]
flash_url = http://pvtbuilds.mozilla.org/...Note, that if you set bothflash_urlandflash_device, the value
provided forflash_urlwill override the default URL for the device
value you have provided. Please refer to the full reference.Rest of the defaults will probably work for you. If you don’t want
to be prompted for your username/password each time, you can save
them in anezboot.iniconfig file:[flash]
flash_user = the_user
flash_pass = secret$passwordCaptain Obvious says don’t commit your password to a public repo.httpThis restarts your phone with HTTP loggingtemporarilyenabled.
Here is the full reference:ezboot http --helpThis runs B2G on the device until you interrupt it (^C). After you’re
finished the console will tell you where to find a log of all HTTP
requests/responses. When you view the file it might warn you that it
has binary content but that’s typically just at the beginning of the file.
Keep paging.installInstall an app from the Firefox Marketplace.ezboot install --helpThis is an alternative to specifying manifest URLs insetupand will let
you install an app by name. Example:ezboot install --app 'Sliding Puzzle' --browserinstall_mktInstall a pre-production version of thepackaged Marketplaceapp.
This requires you to runmkt_certsfirst.ezboot install_mkt --helpExample:ezboot install_mkt --devBecause some bootstrapping is necessary this will install the app from your
B2G browser.killThis kills all running apps which may be useful when you need to reload
styles, js or other assets.ezboot kill --helpTherecsscommand might be faster.loginMake sure aPersonascreen is open on the device then typeezboot login. Here is a reference:ezboot login --helpThis lets you type the username / password to a new Persona account from
your nice desktop keyboard instead of the device keypad. In a real world
situation this wouldn’t be as annoying since Persona remembers who you are
but for development you’ll be typing new accounts all the time for testing.mkt_certsThis pushes the cert files to your device so that you can install the
Marketplace packaged app (dev version) with elevated privileges and install
signed apps from that Marketplace. You obviously don’t need this if you simply
want to use the production version of Marketplace that is pre-installed on
device.ezboot mkt_certs --helpAsk someone for a cert file
(seethis issue),
download it, and unzip it.
You can install certs for the Marketplace dev packaged app like this:ezboot mkt_certs --dev --certs_path ~/Downloads/certdb.tmp/This command requires a device id unless you are using a unagi.
You can configure this like so:[flash]
flash_device = <device>
flash_device_id = <whatever is reported by adb devices>If you’re using an inari or if the device identifier looks like a mac address it
will likely fail. If you have problems, run:adb devices-land use
the string prefixed withusb:as theflash_device_id. For example:ezboot mkt_certs --flash_device_id 'usb:1D111300' --dev --certs_path ~/Downloads/certdb.tmp/reflashThis flashes the last downloaded build without downloading a new one.
This is an easy way to clear cookies and other saved artifacts on device.ezboot reflash --helpSee theflashcommand for more info.recssThis reloads all stylesheets on the current frame. More info:ezboot recss --helpsetupThis sets up your flashed device for usage. Here is the full reference:ezboot setup --helpIt can do the following:configure WiFipre-install some appsput custom prefs on the deviceThe--appsargument takes multiple values. In a config file, add them
one per line in anezboot.iniconfig file like this:[setup]
apps = https://marketplace-dev.allizom.org/manifest.webapp
       https://marketplace.allizom.org/manifest.webapp
wifi_ssid = ...
wifi_key = WPA-PSK
wifi_pass = ...By convention, if you put a custom prefs file in./ezboot/custom-prefs.jswhere dot is the working directory then it will be pushed to/data/local/user.json the device. Any existing custom prefs are not
preserved.Why?While automated functional tests are fantastic I also want to make sure
developers are testing their changes manually on real devices with the
latest builds. It’s a pain to maintain a development device yourself
so this created an itch that had to be scratched.
There is plenty of prior art on B2G scripts but each had different goals or
they were done with cryptic bash magic.