opkg_manager: Major overhaul of the package manager

- Contains more user interactions
- No disabled menu items, this allows getting package information
  for all items.
- Menu list is now divided into sections for updates, plugins and
  system packs, each sorted by installed or not installed.
- Install/reinstall and uninstall takes place via user dialogue
- Expert mode has been revised. Problematic packages may not be touched
  here either.
- Simplified progress display
- and some minor changes
This commit is contained in:
2023-03-07 10:34:02 +01:00
parent 8f9585b01f
commit 8211526e8e
6 changed files with 779 additions and 718 deletions

View File

@@ -2280,8 +2280,10 @@ nvodselector.subservice Perspektiven
opkg.button.expert_off Standard-Modus
opkg.button.expert_on Experten-Modus
opkg.button.info Paket-Informationen
opkg.button.install Paket installieren
opkg.button.uninstall Paket entfernen
opkg.button.install Installieren
opkg.button.reinstall Neu installieren
opkg.button.uninstall Deinstallieren
opkg.button.update.check Updateprüfung
opkg.enter.feed.address Bitte Adresse für Server-Feed oder lokalen Ordner eintragen!
opkg.enter.feed.address.example Beispiel: http://pkg.nevis.neutrino-hd.com
opkg.failure.install Installation fehlgeschlagen
@@ -2289,17 +2291,22 @@ opkg.failure.update Update fehlgeschlagen
opkg.failure.upgrade Upgrade fehlgeschlagen
opkg.feed.addresses Feed-Adressen
opkg.install.local.package Installiere lokales Paket
opkg.messagebox.please.wait Bitte warten...!
opkg.messagebox.reinstall %s erneut installieren?
opkg.messagebox.remove %s entfernen?
opkg.messagebox.size.error Nicht genügend freier Speicher für Paketinstallation verfügbar!
opkg.messagebox.updates.available Paket-Aktualisierung(en) verfügbar!
opkg.success.install Installation erfolgreich!\nNeustart von Neutrino kann erforderlich sein. Jetzt neu starten?
opkg.separator.packages.available verfügbare Pakete
opkg.separator.packages.installed installierte Pakete
opkg.separator.packages.available.plugins verfügbare Plugins
opkg.separator.packages.installed installiert
opkg.separator.packages.installed.plugins installierte Plugins
opkg.separator.upgrades.available Aktualisierungen
opkg.title Paketverwaltung
opkg.update.check Prüfe auf Updates ...
opkg.update.reading_lists Paketlisten werden eingelesen ...
opkg.upgrade Installierte Pakete aktualisieren
opkg.title.expert.mode Paketverwaltung - Experten-Modus
opkg.update.check Prüfe auf Aktualisierungen...
opkg.update.reading_lists Paketlisten werden eingelesen...
opkg.upgrade System aktualisieren
opkg.warning_3rdparty_packages Drittanbieter-Pakete könnten Ihr System beschädigen! Sind Sie sicher, dieses Paket zu installieren?
options.always immer
options.default Voreinstellungen benutzen

View File

@@ -2280,8 +2280,10 @@ nvodselector.subservice Select subservice
opkg.button.expert_off Standard mode
opkg.button.expert_on Expert mode
opkg.button.info Package information
opkg.button.install Install package
opkg.button.uninstall Uninstall package
opkg.button.install Install
opkg.button.reinstall Reinstall
opkg.button.uninstall Uninstall
opkg.button.update.check Update check
opkg.enter.feed.address Please enter address for server, local folder or share!
opkg.enter.feed.address.example Example: http://pkg.nevis.neutrino-hd.com
opkg.failure.install Install failed
@@ -2289,17 +2291,22 @@ opkg.failure.update Update failed
opkg.failure.upgrade Upgrade failed
opkg.feed.addresses Feed addresses
opkg.install.local.package Install local package
opkg.messagebox.please.wait Please wait...!
opkg.messagebox.reinstall Re-install %s?
opkg.messagebox.remove Remove %s?
opkg.messagebox.size.error Not enough free memory available for this package!
opkg.messagebox.updates.available Package update(s) available!
opkg.success.install Install successful!\n restart of Neutrino might be required. Restart now?
opkg.separator.packages.available available packages
opkg.separator.packages.installed installed packages
opkg.success.install Install successful!\n Restart of Neutrino might be required. Restart now?
opkg.separator.packages.available Available packages
opkg.separator.packages.available.plugins Available plugins
opkg.separator.packages.installed Installed
opkg.separator.packages.installed.plugins Installed plugins
opkg.separator.upgrades.available Updates
opkg.title Package Management
opkg.update.check Checking for updates ...
opkg.update.reading_lists Reading package lists ...
opkg.upgrade Upgrade installed packages
opkg.title.expert.mode Package Management - Expert mode
opkg.update.check Checking for updates...
opkg.update.reading_lists Reading package lists...
opkg.upgrade System update
opkg.warning_3rdparty_packages 3rd party packages could damage your system! Are you sure install this package?
options.always always
options.default Reset to defaults

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
OPKG-Manager Class for Neutrino-GUI
Implementation:
Copyright (C) 2012-2021 T. Graf 'dbt'
Copyright (C) 2012-2023 T. Graf 'dbt'
Adaptions:
Copyright (C) 2013 martii
@@ -30,12 +30,15 @@
#ifndef __OPKG_MANAGER__
#define __OPKG_MANAGER__
#include <gui/widget/menue.h>
#include <configfile.h>
#include <string>
#include <vector>
#include <map>
#include <mutex>
#include <string>
#include <vector>
#include "widget/hintbox.h"
#include "widget/menue.h"
#define OPKG_MAX_FEEDS 10
#define HAS_PKG_UPDATE_FLAGFILE "/tmp/.has_pkg_updates"
@@ -53,23 +56,56 @@ class COPKGManager : public CMenuTarget, public COPKGManagerExtra
private:
struct pkg {
std::string name;
std::string version;
std::string desc;
std::string name,
version,
desc,
section,
priority,
recommends,
status,
architecture,
maintainer,
md5sum,
size,
filename,
source,
homepage,
license,
installed_size,
installed_time,
hint;
bool installed;
bool upgradable;
CMenuForwarder *forwarder;
pkg() { }
pkg(std::string &_name, std::string &_version, std::string &_desc)
: name(_name), version(_version), desc(_desc), installed(false), upgradable(false) { }
pkg(std::string &_name)
: name(_name),
version(""),
desc(""),
section(""),
priority(""),
recommends(""),
status(""),
architecture(""),
maintainer(""),
md5sum(""),
size(""),
filename(""),
source(""),
homepage(""),
license(""),
installed_size(""),
installed_time(""),
hint(""),
installed(false),
upgradable(false),
forwarder(NULL) { }
};
struct pkg;
std::map<std::string,pkg> pkg_map;
std::vector<pkg*> pkg_vec;
int width;
int is_wizard;
std::string tmp_str;
std::string terminal_str;
CConfigFile opkg_conf;
void init(int wizard_mode);
bool silent; // Controls some screen messages, eg, avoids unintended or disturbing messages on update checks at background.
@@ -78,13 +114,13 @@ class COPKGManager : public CMenuTarget, public COPKGManagerExtra
std::vector<std::string> v_bad_pattern, v_good_pattern;
CMenuWidget *menu;
CMenuForwarder *upgrade_forwarder;
bool list_installed_done;
bool list_upgradeable_done;
bool menu_used;
bool installed;
bool expert_mode;
std::string *local_dir;
CLoaderHint *hintBox;
bool has_err;
typedef struct OPKG_error_data_t
{
@@ -119,10 +155,8 @@ class COPKGManager : public CMenuTarget, public COPKGManagerExtra
int execCmd(std::string cmdstr, int verbose_mode = 0) {
return execCmd(cmdstr.c_str(), verbose_mode);
};
void getPkgData(const int pkg_content_id);
std::string getBlankPkgName(const std::string& line);
bool isInstalled(const std::string& pkg_name);
bool isUpgradable(const std::string& pkg_name);
void pullPkgData();
std::string getBlankPkgName(const std::string &line);
void handleUpdateFlagFile();
void initUpdateMessage(bool enable_message = true);
@@ -130,22 +164,16 @@ class COPKGManager : public CMenuTarget, public COPKGManagerExtra
std::mutex opk_mutex;
/*!
* Gets an info from opkg command info or status from a package via keywords as std::string
* Gets an info from from a package via keywords as std::string
* 1st parameter is name of package as string eg. "gdb", without file extension or version data
* 2nd parameter needs a keyword like:
* Package, Version, Depends, Status, Section, Architecture, Maintainer, MD5Sum, Size, Filename, Source, Description
* Version, Depends, Status, Section, Architecture, Maintainer, MD5Sum, Size, Filename, Source, Description
* These kewords are to find in the control package inside of the opkg package file and the package list.
* 3rd parameter sets the sub command status or info. For more details, take a look to the opkg commands via command line.
*/
std::string getPkgInfo(const std::string& pkg_name, const std::string& pkg_key = std::string(), bool current_status = false);
std::string getPkgInfo(const std::string &pkg_name, const std::string &pkg_key = "");
//Does the same like getPkgInfo(), but only for status
std::string getPkgStatus(const std::string& pkg_name, const std::string& pkg_key){return getPkgInfo(pkg_name, pkg_key, true);}
std::string getKeyInfo(const std::string& input, const std::string& pkg_info_key, const std::string& delimiters);
int showMenu();
int initMenu();
void updateMenu();
void refreshMenu();
typedef enum
{
@@ -182,27 +210,22 @@ class COPKGManager : public CMenuTarget, public COPKGManagerExtra
bool isGoodPackage(std::string &package_name);
bool isPermittedPackage(std::string &package_name);
void showError(const char* local_msg, char* err_msg = NULL, const std::string& additional_text = std::string());
void showError(const char* local_msg, char* err_msg = NULL, const std::string &additional_text = std::string());
int doUpdate();
void handleShellOutput(std::string* cur_line, int* res, bool* ok);
std::string getInfoDir();
std::string getPkgDetails(std::string pkgName, std::string pkgKeyword, std::string pkgDesc = "");
std::string getPkgDescription(std::string pkgName, std::string pkgDesc = "");
int num_updates;
public:
COPKGManager(int wizard_mode = SNeutrinoSettings::WIZARD_OFF);
~COPKGManager();
void setWizardMode(int mode) {is_wizard = mode;}
int exec(CMenuTarget* parent, const std::string & actionKey);
int exec(CMenuTarget* parent, const std::string &actionKey);
static bool hasOpkgSupport();
bool checkUpdates(const std::string & package_name = std::string(), bool show_progress = false);
int getNumUpdates(bool show_progress = false) {if (!num_updates) checkUpdates("", show_progress); return num_updates;}
bool checkUpdates(bool show_progress = false);
int getNumUpdates();
void setUpdateCheckResult(bool enable_message = true);
bool installPackage(const std::string& pkg_name, std::string options = std::string(), bool force_configure = false);
bool checkSize(const std::string& pkg_name);
bool installPackage(const std::string &pkg_name, std::string options = std::string(), bool force_configure = false);
};
#endif

View File

@@ -2309,7 +2309,9 @@ typedef enum
LOCALE_OPKG_BUTTON_EXPERT_ON,
LOCALE_OPKG_BUTTON_INFO,
LOCALE_OPKG_BUTTON_INSTALL,
LOCALE_OPKG_BUTTON_REINSTALL,
LOCALE_OPKG_BUTTON_UNINSTALL,
LOCALE_OPKG_BUTTON_UPDATE_CHECK,
LOCALE_OPKG_ENTER_FEED_ADDRESS,
LOCALE_OPKG_ENTER_FEED_ADDRESS_EXAMPLE,
LOCALE_OPKG_FAILURE_INSTALL,
@@ -2317,14 +2319,19 @@ typedef enum
LOCALE_OPKG_FAILURE_UPGRADE,
LOCALE_OPKG_FEED_ADDRESSES,
LOCALE_OPKG_INSTALL_LOCAL_PACKAGE,
LOCALE_OPKG_MESSAGEBOX_PLEASE_WAIT,
LOCALE_OPKG_MESSAGEBOX_REINSTALL,
LOCALE_OPKG_MESSAGEBOX_REMOVE,
LOCALE_OPKG_MESSAGEBOX_SIZE_ERROR,
LOCALE_OPKG_MESSAGEBOX_UPDATES_AVAILABLE,
LOCALE_OPKG_SUCCESS_INSTALL,
LOCALE_OPKG_SEPARATOR_PACKAGES_AVAILABLE,
LOCALE_OPKG_SEPARATOR_PACKAGES_AVAILABLE_PLUGINS,
LOCALE_OPKG_SEPARATOR_PACKAGES_INSTALLED,
LOCALE_OPKG_SEPARATOR_PACKAGES_INSTALLED_PLUGINS,
LOCALE_OPKG_SEPARATOR_UPGRADES_AVAILABLE,
LOCALE_OPKG_TITLE,
LOCALE_OPKG_TITLE_EXPERT_MODE,
LOCALE_OPKG_UPDATE_CHECK,
LOCALE_OPKG_UPDATE_READING_LISTS,
LOCALE_OPKG_UPGRADE,

View File

@@ -2309,7 +2309,9 @@ const char * locale_real_names[] =
"opkg.button.expert_on",
"opkg.button.info",
"opkg.button.install",
"opkg.button.reinstall",
"opkg.button.uninstall",
"opkg.button.update.check",
"opkg.enter.feed.address",
"opkg.enter.feed.address.example",
"opkg.failure.install",
@@ -2317,14 +2319,19 @@ const char * locale_real_names[] =
"opkg.failure.upgrade",
"opkg.feed.addresses",
"opkg.install.local.package",
"opkg.messagebox.please.wait",
"opkg.messagebox.reinstall",
"opkg.messagebox.remove",
"opkg.messagebox.size.error",
"opkg.messagebox.updates.available",
"opkg.success.install",
"opkg.separator.packages.available",
"opkg.separator.packages.available.plugins",
"opkg.separator.packages.installed",
"opkg.separator.packages.installed.plugins",
"opkg.separator.upgrades.available",
"opkg.title",
"opkg.title.expert.mode",
"opkg.update.check",
"opkg.update.reading_lists",
"opkg.upgrade",