#include "opkg.h"
#include "opkg_configure.h"
+#include "opkg_state.h"
int opkg_configure(opkg_conf_t *conf, pkg_t *pkg)
{
end of opkg_install(). Do we care? */
/* DPKG_INCOMPATIBILITY:
dpkg actually includes a version number to this script call */
+
+ char *pkgid;
+ sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
+ opkg_set_current_state (OPKG_STATE_CONFIGURING_PKG, pkgid);
+ free (pkgid);
+
err = pkg_run_script(conf, pkg, "postinst", "configure");
if (err) {
printf("ERROR: %s.postinst returned %d\n", pkg->name, err);
}
opkg_state_changed++;
+ opkg_set_current_state (OPKG_STATE_NONE, NULL);
return 0;
}
{
int err;
char *url;
+ char *pkgid;
if (pkg->src == NULL) {
opkg_message(conf,OPKG_ERROR, "ERROR: Package %s (parent %s) is not available from any configured src.\n",
return -1;
}
+ sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
+ opkg_set_current_state (OPKG_STATE_DOWNLOADING_PKG, pkgid);
+ free (pkgid);
+
sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
/* XXX: BUG: The pkg->filename might be something like
err = opkg_download(conf, url, pkg->local_filename);
free(url);
+ opkg_set_current_state (OPKG_STATE_NONE, NULL);
return err;
}
#include "opkg_utils.h"
#include "opkg_message.h"
+#include "opkg_state.h"
#include "sprintf_alloc.h"
#include "file_util.h"
abstract_pkg_t *ab_pkg = NULL;
int old_state_flag;
char* file_md5;
+ char *pkgid;
if ( from_upgrade )
replacees = pkg_vec_alloc();
pkg_get_installed_replacees(conf, pkg, replacees);
+ sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, pkg->architecture);
+ opkg_set_current_state (OPKG_STATE_INSTALLING_PKG, pkgid);
+ free (pkgid);
+
/* this next section we do with SIGINT blocked to prevent inconsistency between opkg database and filesystem */
{
sigset_t newset, oldset;
return err;
}
+ opkg_set_current_state (OPKG_STATE_NONE, NULL);
}
static int prerm_upgrade_old_pkg(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
*/
#include "libopkg.h"
+#include "opkg_state.h"
+
+
+static char *state_strings[] =
+{
+ "None",
+ "Downloading Package",
+ "Installing Package",
+ "Configuring Package",
+ "Upgrading Package",
+ "Removing Package",
+ "Downloading Repository",
+ "Verifying Repository Signature"
+};
+
+
opkg_state_changed_callback opkg_cb_state;
{
if (opkg_state_data)
free (opkg_state_data);
- opkg_state_data = malloc (strlen (data));
- strcpy (opkg_state_data, data);
+ if (data)
+ {
+ opkg_state_data = malloc (strlen (data));
+ strcpy (opkg_state_data, data);
+ }
+ else
+ {
+ opkg_state_data = NULL;
+ }
opkg_state = state;
+
+ printf ("opkg state set to %s: %s\n", state_strings[state], data);
}
void
General Public License for more details.
*/
-
+#ifndef OPKG_STATE_H
+#define OPKG_STATE_H
typedef enum _opkg_state {
OPKG_STATE_NONE,
OPKG_STATE_UPGRADING_PKG,
OPKG_STATE_REMOVING_PKG,
OPKG_STATE_DOWNLOADING_REPOSITORY,
- OPKG_STATE_VERIFYING_REPOSITORY_SIGNITURE
+ OPKG_STATE_VERIFYING_REPOSITORY_SIGNATURE
} opkg_state_t;
+#endif /* OPKG_STATE_H */