1 /* opkg.c - the opkg package management system
3 Thomas Wood <thomas@openedhand.com>
5 Copyright (C) 2008 OpenMoko Inc
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
22 #include "opkg_conf.h"
25 #include "opkg_install.h"
26 #include "opkg_configure.h"
34 /** Private Functions ***/
38 opkg_configure_packages(opkg_conf_t
*conf
, char *pkg_name
)
45 all
= pkg_vec_alloc();
46 pkg_hash_fetch_available(&conf
->pkg_hash
, all
);
48 for (i
= 0; i
< all
->len
; i
++)
52 if (pkg_name
&& fnmatch(pkg_name
, pkg
->name
, 0))
55 if (pkg
->state_status
== SS_UNPACKED
)
57 r
= opkg_configure(conf
, pkg
);
60 pkg
->state_status
= SS_INSTALLED
;
61 pkg
->parent
->state_status
= SS_INSTALLED
;
62 pkg
->state_flag
&= ~SF_PREFER
;
84 opkg
= malloc (sizeof (opkg_t
));
85 args_init (opkg
->args
);
86 opkg_conf_init (opkg
->conf
, opkg
->args
);
91 opkg_free (opkg_t
*opkg
)
93 opkg_conf_deinit (opkg
->conf
);
94 args_deinit (opkg
->args
);
98 opkg_get_option (opkg_t
*opkg
, char *option
, void **value
)
103 opkg_set_option (opkg_t
*opkg
, char *option
, void *value
)
108 opkg_install_package (opkg_t
*opkg
, char *package_name
)
112 pkg_info_preinstall_check(opkg
->conf
);
114 if (opkg
->conf
->multiple_providers
)
116 err
= opkg_install_multi_by_name (opkg
->conf
, package_name
);
120 err
= opkg_install_by_name (opkg
->conf
, package_name
);
123 err
= opkg_configure_packages (opkg
->conf
, NULL
);
125 if (opkg
->conf
->noaction
)
128 opkg_conf_write_status_files (opkg
->conf
);
129 pkg_write_changed_filelists (opkg
->conf
);
135 opkg_remove_package (opkg_t
*opkg
, char *package_name
)
141 opkg_upgrade_package (opkg_t
*opkg
, char *package_name
)
147 opkg_upgrade_all (opkg_t
*opkg
)
153 opkg_update_package_lists (opkg_t
*opkg
)