Link Search Menu Expand Document

WiFi Pineapple Python Opkg Helpers

Table of contents

  1. Introduction
  2. Classes
  3. Functions

Introduction

Python API

Classes

class OpkgJob(Job[bool])
A job to be used with the background JobManager that installs or uninstalls dependencies.

Methods

def do_work(self, logger: Logger) -> bool
If `self.package` is a List: Attempt to install each every package in the list. If a single package fails to install then this method will return False.

Parameters

  • logger: An optional instance of logger to log output from opkg as debug.

Returns

  • bool: True if no errors, False if error.
def stop(self)
Kill the opkg process if it is running.

Functions

def update_repository(logger: Optional[Logger] = None) -> Tuple[bool, str]
Update the opkg package repository.

Parameters

  • logger: Optional instance of logger to log output from opkg as debug.

Returns

  • bool: True if successful, False if it was not.
  • str: Empty if successful, error message if it was not.

def check_if_installed(package: str, logger: Optional[Logger] = None) -> bool
Check if a package is already installed via opkg.

Parameters

  • package: The name of the package to search for.
  • logger: An optional instance of logger to log output from opkg as debug.

Returns

  • bool: True if package installed, False if it is not.

def install_dependency(package: str, logger: Optional[Logger] = None, skip_repo_update: bool = False) -> [bool, str]
Install a package via opkg if its not currently installed.

Parameters

  • package: The name of the package to install.
  • logger: An optional instance of logger to log output from opkg as debug.
  • skip_repo_update: True to skip running `opkg update`. An internet connection will still be checked for.

Returns

  • bool: True if the package was installed, False if it as not.
  • str: Empty if successful, error message if it was not.

def uninstall_dependency(package: str, logger: Optional[Logger] = None) -> [bool, str]
Uninstall a package via opkg if its currently installed.

Parameters

  • package: The name of the package to install.
  • logger: An optional instance of logger to log output from opkg as debug.

Returns

  • bool: True if the package was installed, False if it as not.
  • str: Empty if successful, error message if it was not.