Installing Your Firmware

Your packed firmware needs to be uploaded to your system (fussy does not provide this functionality). Once uploaded, you need to arrange to call the fussy-install script. Keep in mind that this script likely needs to be called as root (in order to allow it to properly set ownership and start/restart services).

To install a package into the default /opt/firmware/ location:

$ fussy-install /tmp/fussy-iHUyhV-pack/sample-setup.tar.gz.gpg
$ fussy-clean

this will update the /opt/firmware/current link to point to the unpacked version of the firmware and run the .pre-install and .post-install scripts with the final location of the firmware as their first argument.

If you install the same firmware twice, the firmware’s directory name will be altered to have a trailing integer suffix.

If the installation fails, then the previous current installation will be re-installed (i.e. will be linked, then have its pre and post-install scripts run.

fussy-install

fussy-install unpacks the firmware into a temporary directory, rsyncs it into the firmware target directory, runs the .pre-install script, if present, then “fixates” the version by linking current to the new version, and finally runs the .post-install script, if present.

$ fussy-install --help
Usage: fussy-install [options]

Options:
  -h, --help            show this help message and exit
  -f FILE, --file=FILE  The firmware archive to unpack, must be a .tar.gz.gpg
                        or a .tar.gz.asc
  -k KEYRING, --keyring=KEYRING
                        GPG keyring to use for verification/decryption
                        (default /etc/fussy/keys)
  -t TARGET, --target=TARGET
                        Directory into which to rsync the firmware (default
                        /opt/firmware)

fussy-clean

$ fussy-clean --help
Usage: fussy-clean [options]

Options:
  -h, --help            show this help message and exit
  -t TARGET, --target=TARGET
                        Directory into which to rsync the firmware (default
                        /opt/firmware)

Module: fussy.install

Install a given firmware package onto the file system (commands fussy-install and fussy-clean)

Major TODO items:

  • TODO: error handling for all of the big issues (disk-space, memory, script failures)
fussy.install.clean(target='/opt/firmware', protected=None)[source]

Naive cleaning implementation

Removes all names in target which are not in protected, paths in protected must be full path names, as returned by glob. The target of the current link is protected.

fussy.install.clean_main()[source]

Main entry-point for fussy-clean script

Steps taken:

  • parses arguments
  • launches clean()
fussy.install.enable(final_target, current)[source]

Attempt to enable final_target as the current release

Steps taken:

  • runs final_target/.pre-install final_target (iff .pre-install is present)
  • (atomically) swaps the link current for a link that points to final_target
  • runs final_target/.post-install final_target (iff .post-install is present)
  • if a failure occurs before swap-link completes, deletes final_target

returns None raises Exceptions on lots of failure cases

Ensure that current is a link (not a directory)

fussy.install.final_path(link)[source]

Get the final path of the given link

raises IOError if link target does not exist, or the target is not a directory

returns normalized real target path of the link

fussy.install.get_options()[source]

Creates the OptionParser used in main()

fussy.install.install(filename, keyring='/etc/fussy/keys', target='/opt/firmware')[source]

Install given firmware <filename> into given target directory

Steps taken:

returns (error_code (0 is success), path name of the installed package)

fussy.install.install_bytes(filename, keyring='/etc/fussy/keys', target='/opt/firmware')[source]

Install the packaged bytes into a final target directory

Steps taken:

  • unpack firmware using fussy.unpack.unpack()

  • rsync new_firmware into /opt/firmware (target)
    • if CURRENT_LINK (current) is present in target, will hard-link shared files between the new firmware and current to reduce disk use (using rsync parameter –link-dest)
  • removes the temporary directory where unpacking was performed

returns full path to sub-directory of target where new firmware was installed

raises Errors on most failures, including disk-full, failed commands, missing executables, etc

fussy.install.main()[source]

Main entry-point for the fussy-install script

Steps taken:

Swap current link to point to final_target

Steps taken:

  • if there is an existing tmp link, remove it
  • create a tmp link to the final target
  • rename tmp link to current

returns None

Project Versions

Table Of Contents

Previous topic

Packing Your Firmware

Next topic

Contributing to Fussy

This Page