1 /* opkg_install.c - the opkg package management system
5 Copyright (C) 2001 University of Southern California
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.
27 #include "pkg_extract.h"
29 #include "opkg_install.h"
30 #include "opkg_configure.h"
31 #include "opkg_download.h"
32 #include "opkg_remove.h"
34 #include "opkg_utils.h"
35 #include "opkg_message.h"
37 #include "opkg_defines.h"
39 #include "sprintf_alloc.h"
40 #include "file_util.h"
44 #include "libbb/libbb.h"
47 satisfy_dependencies_for(opkg_conf_t
*conf
, pkg_t
*pkg
)
50 pkg_vec_t
*depends
= pkg_vec_alloc();
52 char **unresolved
= NULL
;
55 ndepends
= pkg_hash_fetch_unsatisfied_dependencies(conf
,
60 opkg_message(conf
, OPKG_ERROR
,
61 "%s: Cannot satisfy the following dependencies for %s:\n\t",
62 conf
->force_depends
? "Warning" : "ERROR", pkg
->name
);
64 opkg_message(conf
, OPKG_ERROR
, " %s", *unresolved
);
67 opkg_message(conf
, OPKG_ERROR
, "\n");
68 if (! conf
->force_depends
) {
69 opkg_message(conf
, OPKG_INFO
,
70 "This could mean that your package list is out of date or that the packages\n"
71 "mentioned above do not yet exist (try 'opkg update'). To proceed in spite\n"
72 "of this problem try again with the '-force-depends' option.\n");
73 pkg_vec_free(depends
);
74 return OPKG_PKG_DEPS_UNSATISFIED
;
79 pkg_vec_free(depends
);
83 /* Mark packages as to-be-installed */
84 for (i
=0; i
< depends
->len
; i
++) {
85 /* Dependencies should be installed the same place as pkg */
86 if (depends
->pkgs
[i
]->dest
== NULL
) {
87 depends
->pkgs
[i
]->dest
= pkg
->dest
;
89 depends
->pkgs
[i
]->state_want
= SW_INSTALL
;
92 for (i
= 0; i
< depends
->len
; i
++) {
93 dep
= depends
->pkgs
[i
];
94 /* The package was uninstalled when we started, but another
95 dep earlier in this loop may have depended on it and pulled
96 it in, so check first. */
97 if ((dep
->state_status
!= SS_INSTALLED
)
98 && (dep
->state_status
!= SS_UNPACKED
)) {
99 opkg_message(conf
, OPKG_DEBUG2
,"Function: %s calling opkg_install_pkg \n",__FUNCTION__
);
100 err
= opkg_install_pkg(conf
, dep
,0);
101 /* mark this package as having been automatically installed to
102 * satisfy a dependancy */
103 dep
->auto_installed
= 1;
105 pkg_vec_free(depends
);
111 pkg_vec_free(depends
);
117 check_conflicts_for(opkg_conf_t
*conf
, pkg_t
*pkg
)
120 pkg_vec_t
*conflicts
= NULL
;
123 if (conf
->force_depends
) {
131 if (!conf
->force_depends
)
132 conflicts
= (pkg_vec_t
*)pkg_hash_fetch_conflicts(&conf
->pkg_hash
, pkg
);
135 opkg_message(conf
, level
,
136 "%s: The following packages conflict with %s:\n\t", prefix
, pkg
->name
);
138 while (i
< conflicts
->len
)
139 opkg_message(conf
, level
, " %s", conflicts
->pkgs
[i
++]->name
);
140 opkg_message(conf
, level
, "\n");
141 pkg_vec_free(conflicts
);
142 return OPKG_PKG_DEPS_UNSATISFIED
;
148 update_file_ownership(opkg_conf_t
*conf
, pkg_t
*new_pkg
, pkg_t
*old_pkg
)
150 str_list_t
*new_list
= pkg_get_installed_files(conf
, new_pkg
);
151 str_list_elt_t
*iter
, *niter
;
153 for (iter
= str_list_first(new_list
), niter
= str_list_next(new_list
, iter
);
155 iter
= niter
, niter
= str_list_next(new_list
, niter
)) {
156 char *new_file
= (char *)iter
->data
;
157 pkg_t
*owner
= file_hash_get_file_owner(conf
, new_file
);
159 opkg_message(conf
, OPKG_ERROR
, "Null new_file for new_pkg=%s\n", new_pkg
->name
);
160 if (!owner
|| (owner
== old_pkg
))
161 file_hash_set_file_owner(conf
, new_file
, new_pkg
);
164 str_list_t
*old_list
= pkg_get_installed_files(conf
, old_pkg
);
165 for (iter
= str_list_first(old_list
), niter
= str_list_next(old_list
, iter
);
167 iter
= niter
, niter
= str_list_next(old_list
, niter
)) {
168 char *old_file
= (char *)iter
->data
;
169 pkg_t
*owner
= file_hash_get_file_owner(conf
, old_file
);
170 if (owner
== old_pkg
) {
172 hash_table_insert(&conf
->obs_file_hash
, old_file
, old_pkg
);
175 pkg_free_installed_files(old_pkg
);
177 pkg_free_installed_files(new_pkg
);
182 verify_pkg_installable(opkg_conf_t
*conf
, pkg_t
*pkg
)
184 /* XXX: FEATURE: Anything else needed here? Maybe a check on free space? */
186 /* sma 6.20.02: yup; here's the first bit */
188 * XXX: BUG easy for cworth
189 * 1) please point the call below to the correct current root destination
190 * 2) we need to resolve how to check the required space for a pending pkg,
191 * my diddling with the .opk file size below isn't going to cut it.
192 * 3) return a proper error code instead of 1
194 int comp_size
, blocks_available
;
197 if (!conf
->force_space
&& pkg
->installed_size
!= NULL
) {
198 root_dir
= pkg
->dest
? pkg
->dest
->root_dir
: conf
->default_dest
->root_dir
;
199 blocks_available
= get_available_blocks(root_dir
);
201 comp_size
= strtoul(pkg
->installed_size
, NULL
, 0);
202 /* round up a blocks count without doing fancy-but-slow casting jazz */
203 comp_size
= (int)((comp_size
+ 1023) / 1024);
205 if (comp_size
>= blocks_available
) {
206 opkg_message(conf
, OPKG_ERROR
,
207 "Only have %d available blocks on filesystem %s, pkg %s needs %d\n",
208 blocks_available
, root_dir
, pkg
->name
, comp_size
);
216 unpack_pkg_control_files(opkg_conf_t
*conf
, pkg_t
*pkg
)
219 char *conffiles_file_name
;
221 FILE *conffiles_file
;
223 sprintf_alloc(&pkg
->tmp_unpack_dir
, "%s/%s-XXXXXX", conf
->tmp_dir
, pkg
->name
);
225 pkg
->tmp_unpack_dir
= mkdtemp(pkg
->tmp_unpack_dir
);
226 if (pkg
->tmp_unpack_dir
== NULL
) {
227 opkg_message(conf
, OPKG_ERROR
,
228 "%s: Failed to create temporary directory '%s': %s\n",
229 __FUNCTION__
, pkg
->tmp_unpack_dir
, strerror(errno
));
233 err
= pkg_extract_control_files_to_dir(pkg
, pkg
->tmp_unpack_dir
);
238 /* XXX: CLEANUP: There might be a cleaner place to read in the
239 conffiles. Seems like I should be able to get everything to go
240 through pkg_init_from_file. If so, maybe it would make sense to
241 move all of unpack_pkg_control_files to that function. */
243 /* Don't need to re-read conffiles if we already have it */
244 if (!nv_pair_list_empty(&pkg
->conffiles
)) {
248 sprintf_alloc(&conffiles_file_name
, "%s/conffiles", pkg
->tmp_unpack_dir
);
249 if (! file_exists(conffiles_file_name
)) {
250 free(conffiles_file_name
);
254 conffiles_file
= fopen(conffiles_file_name
, "r");
255 if (conffiles_file
== NULL
) {
256 fprintf(stderr
, "%s: failed to open %s: %s\n",
257 __FUNCTION__
, conffiles_file_name
, strerror(errno
));
258 free(conffiles_file_name
);
261 free(conffiles_file_name
);
265 char *cf_name_in_dest
;
267 cf_name
= file_read_line_alloc(conffiles_file
);
268 if (cf_name
== NULL
) {
272 if (cf_name
[0] == '\0') {
276 /* Prepend dest->root_dir to conffile name.
277 Take pains to avoid multiple slashes. */
278 root_dir
= pkg
->dest
->root_dir
;
279 if (conf
->offline_root
)
280 /* skip the offline_root prefix */
281 root_dir
= pkg
->dest
->root_dir
+ strlen(conf
->offline_root
);
282 sprintf_alloc(&cf_name_in_dest
, "%s%s", root_dir
,
283 cf_name
[0] == '/' ? (cf_name
+ 1) : cf_name
);
285 /* Can't get an md5sum now, (file isn't extracted yet).
286 We'll wait until resolve_conffiles */
287 conffile_list_append(&pkg
->conffiles
, cf_name_in_dest
, NULL
);
290 free(cf_name_in_dest
);
293 fclose(conffiles_file
);
299 * Remove packages which were auto_installed due to a dependency by old_pkg,
300 * which are no longer a dependency in the new (upgraded) pkg.
303 pkg_remove_orphan_dependent(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
305 int i
, j
, k
, l
, found
;
308 struct compound_depend
*cd0
, *cd1
;
309 abstract_pkg_t
**dependents
;
311 int count0
= old_pkg
->pre_depends_count
+
312 old_pkg
->depends_count
+
313 old_pkg
->recommends_count
+
314 old_pkg
->suggests_count
;
315 int count1
= pkg
->pre_depends_count
+
317 pkg
->recommends_count
+
320 for (i
=0; i
<count0
; i
++) {
321 cd0
= &old_pkg
->depends
[i
];
322 if (cd0
->type
!= DEPEND
)
324 for (j
=0; j
<cd0
->possibility_count
; j
++) {
328 for (k
=0; k
<count1
; k
++) {
329 cd1
= &pkg
->depends
[i
];
330 if (cd1
->type
!= DEPEND
)
332 for (l
=0; l
<cd1
->possibility_count
; l
++) {
333 if (cd0
->possibilities
[j
]
334 == cd1
->possibilities
[l
]) {
347 * old_pkg has a dependency that pkg does not.
349 p
= pkg_hash_fetch_installed_by_name (&conf
->pkg_hash
,
350 cd0
->possibilities
[j
]->pkg
->name
);
355 if (!p
->auto_installed
)
358 n_deps
= pkg_has_installed_dependents(conf
, NULL
, p
,
360 n_deps
--; /* don't count old_pkg */
363 opkg_message (conf
, OPKG_NOTICE
,
364 "%s was autoinstalled and is "
365 "now orphaned, removing.\n",
368 /* p has one installed dependency (old_pkg),
369 * which we need to ignore during removal. */
370 p
->state_flag
|= SF_REPLACE
;
372 opkg_remove_pkg(conf
, p
, 0);
374 opkg_message(conf
, OPKG_INFO
,
375 "%s was autoinstalled and is "
376 "still required by %d "
377 "installed packages.\n",
386 /* returns number of installed replacees */
388 pkg_get_installed_replacees(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_vec_t
*installed_replacees
)
390 abstract_pkg_t
**replaces
= pkg
->replaces
;
391 int replaces_count
= pkg
->replaces_count
;
393 for (i
= 0; i
< replaces_count
; i
++) {
394 abstract_pkg_t
*ab_pkg
= replaces
[i
];
395 pkg_vec_t
*pkg_vec
= ab_pkg
->pkgs
;
397 for (j
= 0; j
< pkg_vec
->len
; j
++) {
398 pkg_t
*replacee
= pkg_vec
->pkgs
[j
];
399 if (!pkg_conflicts(pkg
, replacee
))
401 if (replacee
->state_status
== SS_INSTALLED
) {
402 pkg_vec_insert(installed_replacees
, replacee
);
407 return installed_replacees
->len
;
411 pkg_remove_installed_replacees(opkg_conf_t
*conf
, pkg_vec_t
*replacees
)
414 int replaces_count
= replacees
->len
;
415 for (i
= 0; i
< replaces_count
; i
++) {
416 pkg_t
*replacee
= replacees
->pkgs
[i
];
418 replacee
->state_flag
|= SF_REPLACE
; /* flag it so remove won't complain */
419 err
= opkg_remove_pkg(conf
, replacee
,0);
426 /* to unwind the removal: make sure they are installed */
428 pkg_remove_installed_replacees_unwind(opkg_conf_t
*conf
, pkg_vec_t
*replacees
)
431 int replaces_count
= replacees
->len
;
432 for (i
= 0; i
< replaces_count
; i
++) {
433 pkg_t
*replacee
= replacees
->pkgs
[i
];
434 if (replacee
->state_status
!= SS_INSTALLED
) {
435 opkg_message(conf
, OPKG_DEBUG2
,"Function: %s calling opkg_install_pkg \n",__FUNCTION__
);
436 err
= opkg_install_pkg(conf
, replacee
,0);
444 /* compares versions of pkg and old_pkg, returns 0 if OK to proceed with installation of pkg, 1 otherwise */
446 opkg_install_check_downgrade(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
, int message
)
449 char message_out
[15];
450 char *old_version
= pkg_version_str_alloc(old_pkg
);
451 char *new_version
= pkg_version_str_alloc(pkg
);
452 int cmp
= pkg_compare_versions(old_pkg
, pkg
);
455 memset(message_out
,'\x0',15);
456 strncpy (message_out
,"Upgrading ",strlen("Upgrading "));
457 if ( (conf
->force_downgrade
==1) && (cmp
> 0) ){ /* We've been asked to allow downgrade and version is precedent */
458 cmp
= -1 ; /* then we force opkg to downgrade */
459 strncpy (message_out
,"Downgrading ",strlen("Downgrading ")); /* We need to use a value < 0 because in the 0 case we are asking to */
460 /* reinstall, and some check could fail asking the "force-reinstall" option */
464 opkg_message(conf
, OPKG_NOTICE
,
465 "Not downgrading package %s on %s from %s to %s.\n",
466 old_pkg
->name
, old_pkg
->dest
->name
, old_version
, new_version
);
468 } else if (cmp
< 0) {
469 opkg_message(conf
, OPKG_NOTICE
,
470 "%s%s on %s from %s to %s...\n",
471 message_out
, pkg
->name
, old_pkg
->dest
->name
, old_version
, new_version
);
472 pkg
->dest
= old_pkg
->dest
;
474 } else /* cmp == 0 */ {
475 if (conf
->force_reinstall
) {
476 opkg_message(conf
, OPKG_NOTICE
,
477 "Reinstalling %s (%s) on %s...\n",
478 pkg
->name
, new_version
, old_pkg
->dest
->name
);
479 pkg
->dest
= old_pkg
->dest
;
482 opkg_message(conf
, OPKG_NOTICE
,
483 "Not installing %s (%s) on %s -- already installed.\n",
484 pkg
->name
, new_version
, old_pkg
->dest
->name
);
492 char message_out
[15] ;
493 memset(message_out
,'\x0',15);
495 strncpy( message_out
,"Upgrading ",strlen("Upgrading ") );
497 strncpy( message_out
,"Installing ",strlen("Installing ") );
498 char *version
= pkg_version_str_alloc(pkg
);
500 opkg_message(conf
, OPKG_NOTICE
,
501 "%s%s (%s) to %s...\n", message_out
,
502 pkg
->name
, version
, pkg
->dest
->name
);
510 prerm_upgrade_old_pkg(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
512 /* DPKG_INCOMPATIBILITY:
513 dpkg does some things here that we don't do yet. Do we care?
515 1. If a version of the package is already installed, call
516 old-prerm upgrade new-version
517 2. If the script runs but exits with a non-zero exit status
518 new-prerm failed-upgrade old-version
519 Error unwind, for both the above cases:
520 old-postinst abort-upgrade new-version
526 prerm_upgrade_old_pkg_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
528 /* DPKG_INCOMPATIBILITY:
529 dpkg does some things here that we don't do yet. Do we care?
530 (See prerm_upgrade_old_package for details)
536 prerm_deconfigure_conflictors(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_vec_t
*conflictors
)
538 /* DPKG_INCOMPATIBILITY:
539 dpkg does some things here that we don't do yet. Do we care?
540 2. If a 'conflicting' package is being removed at the same time:
541 1. If any packages depended on that conflicting package and
542 --auto-deconfigure is specified, call, for each such package:
543 deconfigured's-prerm deconfigure \
544 in-favour package-being-installed version \
545 removing conflicting-package version
547 deconfigured's-postinst abort-deconfigure \
548 in-favour package-being-installed-but-failed version \
549 removing conflicting-package version
551 The deconfigured packages are marked as requiring
552 configuration, so that if --install is used they will be
553 configured again if possible.
554 2. To prepare for removal of the conflicting package, call:
555 conflictor's-prerm remove in-favour package new-version
557 conflictor's-postinst abort-remove in-favour package new-version
563 prerm_deconfigure_conflictors_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_vec_t
*conflictors
)
565 /* DPKG_INCOMPATIBILITY: dpkg does some things here that we don't
566 do yet. Do we care? (See prerm_deconfigure_conflictors for
572 preinst_configure(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
578 char *old_version
= pkg_version_str_alloc(old_pkg
);
579 sprintf_alloc(&preinst_args
, "upgrade %s", old_version
);
581 } else if (pkg
->state_status
== SS_CONFIG_FILES
) {
582 char *pkg_version
= pkg_version_str_alloc(pkg
);
583 sprintf_alloc(&preinst_args
, "install %s", pkg_version
);
586 preinst_args
= xstrdup("install");
589 err
= pkg_run_script(conf
, pkg
, "preinst", preinst_args
);
591 opkg_message(conf
, OPKG_ERROR
,
592 "Aborting installation of %s\n", pkg
->name
);
602 preinst_configure_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
604 /* DPKG_INCOMPATIBILITY:
605 dpkg does the following error unwind, should we?
606 pkg->postrm abort-upgrade old-version
607 OR pkg->postrm abort-install old-version
608 OR pkg->postrm abort-install
614 backup_filename_alloc(const char *file_name
)
618 sprintf_alloc(&backup
, "%s%s", file_name
, OPKG_BACKUP_SUFFIX
);
625 backup_make_backup(opkg_conf_t
*conf
, const char *file_name
)
630 backup
= backup_filename_alloc(file_name
);
631 err
= file_copy(file_name
, backup
);
633 opkg_message(conf
, OPKG_ERROR
,
634 "%s: Failed to copy %s to %s\n",
635 __FUNCTION__
, file_name
, backup
);
644 backup_exists_for(const char *file_name
)
649 backup
= backup_filename_alloc(file_name
);
651 ret
= file_exists(backup
);
659 backup_remove(const char *file_name
)
663 backup
= backup_filename_alloc(file_name
);
671 backup_modified_conffiles(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
674 conffile_list_elt_t
*iter
;
677 if (conf
->noaction
) return 0;
679 /* Backup all modified conffiles */
681 for (iter
= nv_pair_list_first(&old_pkg
->conffiles
); iter
; iter
= nv_pair_list_next(&old_pkg
->conffiles
, iter
)) {
685 cf_name
= root_filename_alloc(conf
, cf
->name
);
687 /* Don't worry if the conffile is just plain gone */
688 if (file_exists(cf_name
) && conffile_has_been_modified(conf
, cf
)) {
689 err
= backup_make_backup(conf
, cf_name
);
698 /* Backup all conffiles that were not conffiles in old_pkg */
699 for (iter
= nv_pair_list_first(&pkg
->conffiles
); iter
; iter
= nv_pair_list_next(&pkg
->conffiles
, iter
)) {
701 cf
= (conffile_t
*)iter
->data
;
702 cf_name
= root_filename_alloc(conf
, cf
->name
);
703 /* Ignore if this was a conffile in old_pkg as well */
704 if (pkg_get_conffile(old_pkg
, cf
->name
)) {
708 if (file_exists(cf_name
) && (! backup_exists_for(cf_name
))) {
709 err
= backup_make_backup(conf
, cf_name
);
721 backup_modified_conffiles_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
723 conffile_list_elt_t
*iter
;
726 for (iter
= nv_pair_list_first(&old_pkg
->conffiles
); iter
; iter
= nv_pair_list_next(&old_pkg
->conffiles
, iter
)) {
727 backup_remove(((nv_pair_t
*)iter
->data
)->name
);
731 for (iter
= nv_pair_list_first(&pkg
->conffiles
); iter
; iter
= nv_pair_list_next(&pkg
->conffiles
, iter
)) {
732 backup_remove(((nv_pair_t
*)iter
->data
)->name
);
740 check_data_file_clashes(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
742 /* DPKG_INCOMPATIBILITY:
743 opkg takes a slightly different approach than dpkg at this
744 point. dpkg installs each file in the new package while
745 creating a backup for any file that is replaced, (so that it
746 can unwind if necessary). To avoid complexity and redundant
747 storage, opkg doesn't do any installation until later, (at the
748 point at which dpkg removes the backups.
750 But, we do have to check for data file clashes, since after
751 installing a package with a file clash, removing either of the
752 packages involved in the clash has the potential to break the
755 str_list_t
*files_list
;
756 str_list_elt_t
*iter
, *niter
;
760 files_list
= pkg_get_installed_files(conf
, pkg
);
761 for (iter
= str_list_first(files_list
), niter
= str_list_next(files_list
, iter
);
763 iter
= niter
, niter
= str_list_next(files_list
, iter
)) {
765 char *filename
= (char *) iter
->data
;
766 root_filename
= root_filename_alloc(conf
, filename
);
767 if (file_exists(root_filename
) && (! file_is_dir(root_filename
))) {
770 /* Pre-existing conffiles are OK */
771 /* @@@@ should have way to check that it is a conffile -Jamey */
772 if (backup_exists_for(root_filename
)) {
776 /* Pre-existing files are OK if force-overwrite was asserted. */
777 if (conf
->force_overwrite
) {
778 /* but we need to change who owns this file */
779 file_hash_set_file_owner(conf
, filename
, pkg
);
783 owner
= file_hash_get_file_owner(conf
, filename
);
785 /* Pre-existing files are OK if owned by the pkg being upgraded. */
786 if (owner
&& old_pkg
) {
787 if (strcmp(owner
->name
, old_pkg
->name
) == 0) {
792 /* Pre-existing files are OK if owned by a package replaced by new pkg. */
794 opkg_message(conf
, OPKG_DEBUG2
, "Checking for replaces for %s in package %s\n", filename
, owner
->name
);
795 if (pkg_replaces(pkg
, owner
)) {
798 /* If the file that would be installed is owned by the same package, ( as per a reinstall or similar )
799 then it's ok to overwrite. */
800 if (strcmp(owner
->name
,pkg
->name
)==0){
801 opkg_message(conf
, OPKG_INFO
, "Replacing pre-existing file %s owned by package %s\n", filename
, owner
->name
);
806 /* Pre-existing files are OK if they are obsolete */
807 obs
= hash_table_get(&conf
->obs_file_hash
, filename
);
809 opkg_message(conf
, OPKG_INFO
, "Pre-exiting file %s is obsolete. obs_pkg=%s\n", filename
, obs
->name
);
813 /* We have found a clash. */
814 opkg_message(conf
, OPKG_ERROR
,
815 "Package %s wants to install file %s\n"
816 "\tBut that file is already provided by package ",
817 pkg
->name
, filename
);
819 opkg_message(conf
, OPKG_ERROR
,
820 "%s\n", owner
->name
);
822 opkg_message(conf
, OPKG_ERROR
,
823 "<no package>\nPlease move this file out of the way and try again.\n");
829 pkg_free_installed_files(pkg
);
835 check_data_file_clashes_change(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
837 /* Basically that's the worst hack I could do to be able to change ownership of
838 file list, but, being that we have no way to unwind the mods, due to structure
839 of hash table, probably is the quickest hack too, whishing it would not slow-up thing too much.
840 What we do here is change the ownership of file in hash if a replace ( or similar events
842 Only the action that are needed to change name should be considered.
843 @@@ To change after 1.0 release.
845 str_list_t
*files_list
;
846 str_list_elt_t
*iter
, *niter
;
848 char *root_filename
= NULL
;
852 files_list
= pkg_get_installed_files(conf
, pkg
);
853 for (iter
= str_list_first(files_list
), niter
= str_list_next(files_list
, iter
);
855 iter
= niter
, niter
= str_list_next(files_list
, niter
)) {
856 char *filename
= (char *) iter
->data
;
859 root_filename
= NULL
;
861 root_filename
= root_filename_alloc(conf
, filename
);
862 if (file_exists(root_filename
) && (! file_is_dir(root_filename
))) {
865 owner
= file_hash_get_file_owner(conf
, filename
);
867 if (conf
->force_overwrite
) {
868 /* but we need to change who owns this file */
869 file_hash_set_file_owner(conf
, filename
, pkg
);
874 /* Pre-existing files are OK if owned by a package replaced by new pkg. */
876 if (pkg_replaces(pkg
, owner
)) {
877 /* It's now time to change the owner of that file.
878 It has been "replaced" from the new "Replaces", then I need to inform lists file about that. */
879 opkg_message(conf
, OPKG_INFO
, "Replacing pre-existing file %s owned by package %s\n", filename
, owner
->name
);
880 file_hash_set_file_owner(conf
, filename
, pkg
);
889 root_filename
= NULL
;
891 pkg_free_installed_files(pkg
);
897 check_data_file_clashes_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
899 /* Nothing to do since check_data_file_clashes doesn't change state */
904 postrm_upgrade_old_pkg(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
906 /* DPKG_INCOMPATIBILITY: dpkg does the following here, should we?
907 1. If the package is being upgraded, call
908 old-postrm upgrade new-version
909 2. If this fails, attempt:
910 new-postrm failed-upgrade old-version
911 Error unwind, for both cases:
912 old-preinst abort-upgrade new-version */
917 postrm_upgrade_old_pkg_unwind(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
919 /* DPKG_INCOMPATIBILITY:
920 dpkg does some things here that we don't do yet. Do we care?
921 (See postrm_upgrade_old_pkg for details)
927 remove_obsolesced_files(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
930 str_list_t
*old_files
;
932 str_list_t
*new_files
;
934 hash_table_t new_files_table
;
936 if (old_pkg
== NULL
) {
940 old_files
= pkg_get_installed_files(conf
, old_pkg
);
941 new_files
= pkg_get_installed_files(conf
, pkg
);
943 new_files_table
.entries
= NULL
;
944 hash_table_init("new_files" , &new_files_table
, 20);
945 for (nf
= str_list_first(new_files
); nf
; nf
= str_list_next(new_files
, nf
)) {
947 hash_table_insert(&new_files_table
, nf
->data
, nf
->data
);
950 for (of
= str_list_first(old_files
); of
; of
= str_list_next(old_files
, of
)) {
953 old
= (char *)of
->data
;
954 new = (char *) hash_table_get (&new_files_table
, old
);
958 if (file_is_dir(old
)) {
961 owner
= file_hash_get_file_owner(conf
, old
);
962 if (owner
!= old_pkg
) {
963 /* in case obsolete file no longer belongs to old_pkg */
967 /* old file is obsolete */
968 opkg_message(conf
, OPKG_INFO
,
969 " removing obsolete file %s\n", old
);
970 if (!conf
->noaction
) {
973 opkg_message(conf
, OPKG_ERROR
, " Warning: remove %s failed: %s\n", old
,
979 hash_table_deinit(&new_files_table
);
980 pkg_free_installed_files(old_pkg
);
981 pkg_free_installed_files(pkg
);
987 install_maintainer_scripts(opkg_conf_t
*conf
, pkg_t
*pkg
, pkg_t
*old_pkg
)
992 sprintf_alloc(&prefix
, "%s.", pkg
->name
);
993 ret
= pkg_extract_control_files_to_dir_with_prefix(pkg
,
1001 remove_disappeared(opkg_conf_t
*conf
, pkg_t
*pkg
)
1003 /* DPKG_INCOMPATIBILITY:
1004 This is a fairly sophisticated dpkg operation. Shall we
1007 /* Any packages all of whose files have been overwritten during the
1008 installation, and which aren't required for dependencies, are
1009 considered to have been removed. For each such package
1010 1. disappearer's-postrm disappear overwriter overwriter-version
1011 2. The package's maintainer scripts are removed
1012 3. It is noted in the status database as being in a sane state,
1013 namely not installed (any conffiles it may have are ignored,
1014 rather than being removed by dpkg). Note that disappearing
1015 packages do not have their prerm called, because dpkg doesn't
1016 know in advance that the package is going to vanish.
1022 install_data_files(opkg_conf_t
*conf
, pkg_t
*pkg
)
1026 /* opkg takes a slightly different approach to data file backups
1027 than dpkg. Rather than removing backups at this point, we
1028 actually do the data file installation now. See comments in
1029 check_data_file_clashes() for more details. */
1031 opkg_message(conf
, OPKG_INFO
,
1032 " extracting data files to %s\n", pkg
->dest
->root_dir
);
1033 err
= pkg_extract_data_files_to_dir(pkg
, pkg
->dest
->root_dir
);
1038 /* XXX: BUG or FEATURE : We are actually loosing the Essential flag,
1039 so we can't save ourself from removing important packages
1040 At this point we (should) have extracted the .control file, so it
1041 would be a good idea to reload the data in it, and set the Essential
1042 state in *pkg. From now on the Essential is back in status file and
1043 we can protect again.
1044 We should operate this way:
1045 fopen the file ( pkg->dest->root_dir/pkg->name.control )
1046 check for "Essential" in it
1047 set the value in pkg->essential.
1048 This new routine could be useful also for every other flag
1050 set_flags_from_control(conf
, pkg
) ;
1052 opkg_message(conf
, OPKG_DEBUG
, " Calling pkg_write_filelist from %s\n", __FUNCTION__
);
1053 err
= pkg_write_filelist(conf
, pkg
);
1057 /* XXX: FEATURE: opkg should identify any files which existed
1058 before installation and which were overwritten, (see
1059 check_data_file_clashes()). What it must do is remove any such
1060 files from the filelist of the old package which provided the
1061 file. Otherwise, if the old package were removed at some point
1062 it would break the new package. Removing the new package will
1063 also break the old one, but this cannot be helped since the old
1064 package's file has already been deleted. This is the importance
1065 of check_data_file_clashes(), and only allowing opkg to install
1066 a clashing package with a user force. */
1072 user_prefers_old_conffile(const char *file_name
, const char *backup
)
1075 const char *short_file_name
;
1077 short_file_name
= strrchr(file_name
, '/');
1078 if (short_file_name
) {
1081 short_file_name
= file_name
;
1085 response
= get_user_response(" Configuration file '%s'\n"
1086 " ==> File on system created by you or by a script.\n"
1087 " ==> File also in package provided by package maintainer.\n"
1088 " What would you like to do about it ? Your options are:\n"
1089 " Y or I : install the package maintainer's version\n"
1090 " N or O : keep your currently-installed version\n"
1091 " D : show the differences between the versions (if diff is installed)\n"
1092 " The default action is to keep your current version.\n"
1093 " *** %s (Y/I/N/O/D) [default=N] ? ", file_name
, short_file_name
);
1095 if (response
== NULL
)
1098 if (strcmp(response
, "y") == 0
1099 || strcmp(response
, "i") == 0
1100 || strcmp(response
, "yes") == 0) {
1105 if (strcmp(response
, "d") == 0) {
1106 const char *argv
[] = {"diff", "-u", backup
, file_name
, NULL
};
1108 printf(" [Press ENTER to continue]\n");
1109 response
= file_read_line_alloc(stdin
);
1120 resolve_conffiles(opkg_conf_t
*conf
, pkg_t
*pkg
)
1122 conffile_list_elt_t
*iter
;
1127 if (conf
->noaction
) return 0;
1129 for (iter
= nv_pair_list_first(&pkg
->conffiles
); iter
; iter
= nv_pair_list_next(&pkg
->conffiles
, iter
)) {
1130 char *root_filename
;
1131 cf
= (conffile_t
*)iter
->data
;
1132 root_filename
= root_filename_alloc(conf
, cf
->name
);
1134 /* Might need to initialize the md5sum for each conffile */
1135 if (cf
->value
== NULL
) {
1136 cf
->value
= file_md5sum_alloc(root_filename
);
1139 if (!file_exists(root_filename
)) {
1140 free(root_filename
);
1144 cf_backup
= backup_filename_alloc(root_filename
);
1147 if (file_exists(cf_backup
)) {
1148 /* Let's compute md5 to test if files are changed */
1149 md5sum
= file_md5sum_alloc(cf_backup
);
1150 if (md5sum
&& cf
->value
&& strcmp(cf
->value
,md5sum
) != 0 ) {
1151 if (conf
->force_maintainer
) {
1152 opkg_message(conf
, OPKG_NOTICE
, "Conffile %s using maintainer's setting.\n", cf_backup
);
1153 } else if (conf
->force_defaults
1154 || user_prefers_old_conffile(root_filename
, cf_backup
) ) {
1155 rename(cf_backup
, root_filename
);
1164 free(root_filename
);
1172 opkg_install_by_name(opkg_conf_t
*conf
, const char *pkg_name
)
1176 char *old_version
, *new_version
;
1178 opkg_message(conf
, OPKG_DEBUG2
, " Getting old from pkg_hash_fetch \n" );
1179 old
= pkg_hash_fetch_installed_by_name(&conf
->pkg_hash
, pkg_name
);
1181 opkg_message(conf
, OPKG_DEBUG2
, " Old versions from pkg_hash_fetch %s \n", old
->version
);
1183 opkg_message(conf
, OPKG_DEBUG2
, " Getting new from pkg_hash_fetch \n" );
1184 new = pkg_hash_fetch_best_installation_candidate_by_name(conf
, pkg_name
, &err
);
1186 opkg_message(conf
, OPKG_DEBUG2
, " New versions from pkg_hash_fetch %s \n", new->version
);
1188 /* Pigi Basically here is broken the version stuff.
1189 What's happening is that nothing provide the version to differents
1190 functions, so the returned struct is always the latest.
1191 That's why the install by name don't work.
1193 opkg_message(conf
, OPKG_DEBUG2
, " Versions from pkg_hash_fetch in %s ", __FUNCTION__
);
1196 opkg_message(conf
, OPKG_DEBUG2
, " old %s ", old
->version
);
1198 opkg_message(conf
, OPKG_DEBUG2
, " new %s ", new->version
);
1199 opkg_message(conf
, OPKG_DEBUG2
, " \n");
1205 return OPKG_PKG_HAS_NO_CANDIDATE
;
1208 new->state_flag
|= SF_USER
;
1210 old_version
= pkg_version_str_alloc(old
);
1211 new_version
= pkg_version_str_alloc(new);
1213 cmp
= pkg_compare_versions(old
, new);
1214 if ( (conf
->force_downgrade
==1) && (cmp
> 0) ){ /* We've been asked to allow downgrade and version is precedent */
1215 opkg_message(conf
, OPKG_DEBUG
, " Forcing downgrade \n");
1216 cmp
= -1 ; /* then we force opkg to downgrade */
1217 /* We need to use a value < 0 because in the 0 case we are asking to */
1218 /* reinstall, and some check could fail asking the "force-reinstall" option */
1220 opkg_message(conf
, OPKG_DEBUG
,
1221 "Comparing visible versions of pkg %s:"
1222 "\n\t%s is installed "
1223 "\n\t%s is available "
1224 "\n\t%d was comparison result\n",
1225 pkg_name
, old_version
, new_version
, cmp
);
1226 if (cmp
== 0 && !conf
->force_reinstall
) {
1227 opkg_message(conf
, OPKG_NOTICE
,
1228 "Package %s (%s) installed in %s is up to date.\n",
1229 old
->name
, old_version
, old
->dest
->name
);
1233 } else if (cmp
> 0) {
1234 opkg_message(conf
, OPKG_NOTICE
,
1235 "Not downgrading package %s on %s from %s to %s.\n",
1236 old
->name
, old
->dest
->name
, old_version
, new_version
);
1240 } else if (cmp
< 0) {
1241 new->dest
= old
->dest
;
1242 old
->state_want
= SW_DEINSTALL
; /* Here probably the problem for bug 1277 */
1248 /* XXX: CLEANUP: The error code of opkg_install_by_name is really
1249 supposed to be an opkg_error_t, but opkg_install_pkg could
1250 return any kind of integer, (might be errno from a syscall,
1251 etc.). This is a real mess and will need to be cleaned up if
1252 anyone ever wants to make a nice libopkg. */
1254 opkg_message(conf
, OPKG_DEBUG2
,"Function: %s calling opkg_install_pkg \n",__FUNCTION__
);
1255 return opkg_install_pkg(conf
, new,0);
1259 * @brief Really install a pkg_t
1262 opkg_install_pkg(opkg_conf_t
*conf
, pkg_t
*pkg
, int from_upgrade
)
1266 pkg_t
*old_pkg
= NULL
;
1267 pkg_vec_t
*replacees
;
1268 abstract_pkg_t
*ab_pkg
= NULL
;
1276 message
= 1; /* Coming from an upgrade, and should change the output message */
1279 opkg_message(conf
, OPKG_ERROR
,
1280 "INTERNAL ERROR: null pkg passed to opkg_install_pkg\n");
1281 return OPKG_INSTALL_ERR_INTERNAL
;
1284 opkg_message(conf
, OPKG_DEBUG2
, "Function: %s calling pkg_arch_supported %s \n", __FUNCTION__
, __FUNCTION__
);
1286 if (!pkg_arch_supported(conf
, pkg
)) {
1287 opkg_message(conf
, OPKG_ERROR
, "INTERNAL ERROR: architecture %s for pkg %s is unsupported.\n",
1288 pkg
->architecture
, pkg
->name
);
1289 return OPKG_INSTALL_ERR_INTERNAL
;
1291 if (pkg
->state_status
== SS_INSTALLED
&& conf
->force_reinstall
== 0 && conf
->nodeps
== 0) {
1292 err
= satisfy_dependencies_for(conf
, pkg
);
1293 if (err
) { return OPKG_INSTALL_ERR_DEPENDENCIES
; }
1295 opkg_message(conf
, OPKG_NOTICE
,
1296 "Package %s is already installed in %s.\n",
1297 pkg
->name
, pkg
->dest
->name
);
1301 if (pkg
->dest
== NULL
) {
1302 pkg
->dest
= conf
->default_dest
;
1305 old_pkg
= pkg_hash_fetch_installed_by_name(&conf
->pkg_hash
, pkg
->name
);
1307 err
= opkg_install_check_downgrade(conf
, pkg
, old_pkg
, message
);
1308 if (err
) { return OPKG_INSTALL_ERR_NO_DOWNGRADE
; }
1310 pkg
->state_want
= SW_INSTALL
;
1312 old_pkg
->state_want
= SW_DEINSTALL
; /* needed for check_data_file_clashes of dependences */
1316 /* Abhaya: conflicts check */
1317 err
= check_conflicts_for(conf
, pkg
);
1318 if (err
) { return OPKG_INSTALL_ERR_CONFLICTS
; }
1320 /* this setup is to remove the upgrade scenario in the end when
1321 installing pkg A, A deps B & B deps on A. So both B and A are
1322 installed. Then A's installation is started resulting in an
1323 uncecessary upgrade */
1324 if (pkg
->state_status
== SS_INSTALLED
1325 && conf
->force_reinstall
== 0) return 0;
1327 err
= verify_pkg_installable(conf
, pkg
);
1328 if (err
) { return OPKG_INSTALL_ERR_NO_SPACE
; }
1330 if (pkg
->local_filename
== NULL
) {
1331 err
= opkg_download_pkg(conf
, pkg
, conf
->tmp_dir
);
1333 opkg_message(conf
, OPKG_ERROR
,
1334 "Failed to download %s. Perhaps you need to run 'opkg update'?\n",
1336 return OPKG_INSTALL_ERR_DOWNLOAD
;
1340 /* check that the repository is valid */
1341 #if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
1342 char *list_file_name
, *sig_file_name
, *lists_dir
;
1344 /* check to ensure the package has come from a repository */
1345 if (conf
->check_signature
&& pkg
->src
)
1347 sprintf_alloc (&lists_dir
, "%s",
1348 (conf
->restrict_to_default_dest
)
1349 ? conf
->default_dest
->lists_dir
1351 sprintf_alloc (&list_file_name
, "%s/%s", lists_dir
, pkg
->src
->name
);
1352 sprintf_alloc (&sig_file_name
, "%s/%s.sig", lists_dir
, pkg
->src
->name
);
1354 if (file_exists (sig_file_name
))
1356 if (opkg_verify_file (conf
, list_file_name
, sig_file_name
)){
1357 opkg_message(conf
, OPKG_ERROR
, "Failed to verify the signature of: %s\n",
1359 return OPKG_INSTALL_ERR_SIGNATURE
;
1362 opkg_message(conf
, OPKG_ERROR
, "Signature file is missing. "
1363 "Perhaps you need to run 'opkg update'?\n");
1364 return OPKG_INSTALL_ERR_SIGNATURE
;
1368 free (list_file_name
);
1369 free (sig_file_name
);
1373 /* Check for md5 values */
1376 file_md5
= file_md5sum_alloc(pkg
->local_filename
);
1377 if (file_md5
&& strcmp(file_md5
, pkg
->md5sum
))
1379 opkg_message(conf
, OPKG_ERROR
,
1380 "Package %s md5sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
1383 return OPKG_INSTALL_ERR_MD5
;
1390 /* Check for sha256 value */
1393 file_sha256
= file_sha256sum_alloc(pkg
->local_filename
);
1394 if (file_sha256
&& strcmp(file_sha256
, pkg
->sha256sum
))
1396 opkg_message(conf
, OPKG_ERROR
,
1397 "Package %s sha256sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
1400 return OPKG_INSTALL_ERR_SHA256
;
1407 if (pkg
->tmp_unpack_dir
== NULL
) {
1408 unpack_pkg_control_files(conf
, pkg
);
1411 /* We should update the filelist here, so that upgrades of packages that split will not fail. -Jamey 27-MAR-03 */
1412 /* Pigi: check if it will pass from here when replacing. It seems to fail */
1413 /* That's rather strange that files don't change owner. Investigate !!!!!!*/
1414 err
= update_file_ownership(conf
, pkg
, old_pkg
);
1415 if (err
) { return OPKG_ERR_UNKNOWN
; }
1417 if (conf
->nodeps
== 0) {
1418 err
= satisfy_dependencies_for(conf
, pkg
);
1419 if (err
) { return OPKG_INSTALL_ERR_DEPENDENCIES
; }
1420 if (pkg
->state_status
== SS_UNPACKED
)
1421 /* Circular dependency has installed it for us. */
1425 replacees
= pkg_vec_alloc();
1426 pkg_get_installed_replacees(conf
, pkg
, replacees
);
1428 /* this next section we do with SIGINT blocked to prevent inconsistency between opkg database and filesystem */
1430 sigset_t newset
, oldset
;
1432 sigemptyset(&newset
);
1433 sigaddset(&newset
, SIGINT
);
1434 sigprocmask(SIG_BLOCK
, &newset
, &oldset
);
1436 opkg_state_changed
++;
1437 pkg
->state_flag
|= SF_FILELIST_CHANGED
;
1440 pkg_remove_orphan_dependent(conf
, pkg
, old_pkg
);
1442 /* XXX: BUG: we really should treat replacement more like an upgrade
1443 * Instead, we're going to remove the replacees
1445 err
= pkg_remove_installed_replacees(conf
, replacees
);
1446 if (err
) goto UNWIND_REMOVE_INSTALLED_REPLACEES
;
1448 err
= prerm_upgrade_old_pkg(conf
, pkg
, old_pkg
);
1449 if (err
) goto UNWIND_PRERM_UPGRADE_OLD_PKG
;
1451 err
= prerm_deconfigure_conflictors(conf
, pkg
, replacees
);
1452 if (err
) goto UNWIND_PRERM_DECONFIGURE_CONFLICTORS
;
1454 err
= preinst_configure(conf
, pkg
, old_pkg
);
1455 if (err
) goto UNWIND_PREINST_CONFIGURE
;
1457 err
= backup_modified_conffiles(conf
, pkg
, old_pkg
);
1458 if (err
) goto UNWIND_BACKUP_MODIFIED_CONFFILES
;
1460 err
= check_data_file_clashes(conf
, pkg
, old_pkg
);
1461 if (err
) goto UNWIND_CHECK_DATA_FILE_CLASHES
;
1463 err
= postrm_upgrade_old_pkg(conf
, pkg
, old_pkg
);
1464 if (err
) goto UNWIND_POSTRM_UPGRADE_OLD_PKG
;
1466 if (conf
->noaction
) return 0;
1468 /* point of no return: no unwinding after this */
1469 if (old_pkg
&& !conf
->force_reinstall
) {
1470 old_pkg
->state_want
= SW_DEINSTALL
;
1472 if (old_pkg
->state_flag
& SF_NOPRUNE
) {
1473 opkg_message(conf
, OPKG_INFO
,
1474 " not removing obsolesced files because package marked noprune\n");
1476 opkg_message(conf
, OPKG_INFO
,
1477 " removing obsolesced files\n");
1478 remove_obsolesced_files(conf
, pkg
, old_pkg
);
1480 /* removing files from old package, to avoid ghost files */
1481 remove_data_files_and_list(conf
, old_pkg
);
1482 /* Pigi : It should be better to remove also maintainer and postrem scripts here, just in case*/
1483 remove_maintainer_scripts_except_postrm(conf
, old_pkg
);
1484 remove_postrm(conf
, old_pkg
);
1490 opkg_message(conf
, OPKG_INFO
,
1491 " installing maintainer scripts\n");
1492 install_maintainer_scripts(conf
, pkg
, old_pkg
);
1494 /* the following just returns 0 */
1495 remove_disappeared(conf
, pkg
);
1497 opkg_message(conf
, OPKG_INFO
,
1498 " installing data files\n");
1499 install_data_files(conf
, pkg
);
1501 /* read comments from function for detail but I will execute this here as all other tests are ok.*/
1502 err
= check_data_file_clashes_change(conf
, pkg
, old_pkg
);
1504 opkg_message(conf
, OPKG_INFO
,
1505 " resolving conf files\n");
1506 resolve_conffiles(conf
, pkg
);
1508 pkg
->state_status
= SS_UNPACKED
;
1509 old_state_flag
= pkg
->state_flag
;
1510 pkg
->state_flag
&= ~SF_PREFER
;
1511 opkg_message(conf
, OPKG_DEBUG
, " pkg=%s old_state_flag=%x state_flag=%x\n", pkg
->name
, old_state_flag
, pkg
->state_flag
);
1513 if (old_pkg
&& !conf
->force_reinstall
) {
1514 old_pkg
->state_status
= SS_NOT_INSTALLED
;
1517 time(&pkg
->installed_time
);
1519 ab_pkg
= pkg
->parent
;
1521 ab_pkg
->state_status
= pkg
->state_status
;
1523 opkg_message(conf
, OPKG_INFO
, "Done.\n");
1525 sigprocmask(SIG_UNBLOCK
, &newset
, &oldset
);
1526 pkg_vec_free (replacees
);
1530 UNWIND_POSTRM_UPGRADE_OLD_PKG
:
1531 postrm_upgrade_old_pkg_unwind(conf
, pkg
, old_pkg
);
1532 UNWIND_CHECK_DATA_FILE_CLASHES
:
1533 check_data_file_clashes_unwind(conf
, pkg
, old_pkg
);
1534 UNWIND_BACKUP_MODIFIED_CONFFILES
:
1535 backup_modified_conffiles_unwind(conf
, pkg
, old_pkg
);
1536 UNWIND_PREINST_CONFIGURE
:
1537 preinst_configure_unwind(conf
, pkg
, old_pkg
);
1538 UNWIND_PRERM_DECONFIGURE_CONFLICTORS
:
1539 prerm_deconfigure_conflictors_unwind(conf
, pkg
, replacees
);
1540 UNWIND_PRERM_UPGRADE_OLD_PKG
:
1541 prerm_upgrade_old_pkg_unwind(conf
, pkg
, old_pkg
);
1542 UNWIND_REMOVE_INSTALLED_REPLACEES
:
1543 pkg_remove_installed_replacees_unwind(conf
, replacees
);
1545 opkg_message(conf
, OPKG_INFO
,
1548 sigprocmask(SIG_UNBLOCK
, &newset
, &oldset
);
1550 pkg_vec_free (replacees
);
1551 return OPKG_ERR_UNKNOWN
;