1 /* opkg_conf.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.
19 #include "opkg_conf.h"
20 #include "opkg_error.h"
23 #include "sprintf_alloc.h"
25 #include "opkg_message.h"
26 #include "file_util.h"
30 #include "opkg_defines.h"
32 #include <sys/types.h>
36 extern char *conf_file_dir
;
38 static int opkg_conf_parse_file(opkg_conf_t
*conf
, const char *filename
,
39 pkg_src_list_t
*pkg_src_list
,
40 nv_pair_list_t
*tmp_dest_nv_pair_list
,
41 char **tmp_lists_dir
);
42 static int opkg_conf_set_option(const opkg_option_t
*options
,
43 const char *name
, const char *value
);
44 static int opkg_conf_set_default_dest(opkg_conf_t
*conf
,
45 const char *default_dest_name
);
46 static int set_and_load_pkg_src_list(opkg_conf_t
*conf
,
47 pkg_src_list_t
*nv_pair_list
);
48 static int set_and_load_pkg_dest_list(opkg_conf_t
*conf
,
49 nv_pair_list_t
*nv_pair_list
, char * lists_dir
);
51 int opkg_init_options_array(const opkg_conf_t
*conf
, opkg_option_t
**options
)
53 opkg_option_t tmp
[] = {
54 { "cache", OPKG_OPT_TYPE_STRING
, &conf
->cache
},
55 { "force_defaults", OPKG_OPT_TYPE_BOOL
, &conf
->force_defaults
},
56 { "force_maintainer", OPKG_OPT_TYPE_BOOL
, &conf
->force_maintainer
},
57 { "force_depends", OPKG_OPT_TYPE_BOOL
, &conf
->force_depends
},
58 { "force_overwrite", OPKG_OPT_TYPE_BOOL
, &conf
->force_overwrite
},
59 { "force_downgrade", OPKG_OPT_TYPE_BOOL
, &conf
->force_downgrade
},
60 { "force_reinstall", OPKG_OPT_TYPE_BOOL
, &conf
->force_reinstall
},
61 { "force_space", OPKG_OPT_TYPE_BOOL
, &conf
->force_space
},
62 { "check_signature", OPKG_OPT_TYPE_INT
, &conf
->check_signature
},
63 { "ftp_proxy", OPKG_OPT_TYPE_STRING
, &conf
->ftp_proxy
},
64 { "http_proxy", OPKG_OPT_TYPE_STRING
, &conf
->http_proxy
},
65 { "no_proxy", OPKG_OPT_TYPE_STRING
, &conf
->no_proxy
},
66 { "test", OPKG_OPT_TYPE_INT
, &conf
->noaction
},
67 { "noaction", OPKG_OPT_TYPE_INT
, &conf
->noaction
},
68 { "nodeps", OPKG_OPT_TYPE_BOOL
, &conf
->nodeps
},
69 { "offline_root", OPKG_OPT_TYPE_STRING
, &conf
->offline_root
},
70 { "offline_root_path", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_path
},
71 { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_post_script_cmd
},
72 { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_pre_script_cmd
},
73 { "proxy_passwd", OPKG_OPT_TYPE_STRING
, &conf
->proxy_passwd
},
74 { "proxy_user", OPKG_OPT_TYPE_STRING
, &conf
->proxy_user
},
75 { "query-all", OPKG_OPT_TYPE_BOOL
, &conf
->query_all
},
76 { "verbosity", OPKG_OPT_TYPE_BOOL
, &conf
->verbosity
},
80 *options
= (opkg_option_t
*)calloc(1, sizeof(tmp
));
81 if ( options
== NULL
){
82 fprintf(stderr
,"%s: Unable to allocate memory\n",__FUNCTION__
);
86 memcpy(*options
, tmp
, sizeof(tmp
));
90 static void opkg_conf_override_string(char **conf_str
, char *arg_str
)
96 *conf_str
= strdup(arg_str
);
100 static void opkg_conf_free_string(char **conf_str
)
108 int opkg_conf_init(opkg_conf_t
*conf
, const args_t
*args
)
112 nv_pair_list_t tmp_dest_nv_pair_list
;
113 char *lists_dir
= NULL
, *lock_file
= NULL
;
115 char *etc_opkg_conf_pattern
;
116 char *pending_dir
= NULL
;
118 memset(conf
, 0, sizeof(opkg_conf_t
));
120 pkg_src_list_init(&conf
->pkg_src_list
);
122 nv_pair_list_init(&tmp_dest_nv_pair_list
);
123 pkg_dest_list_init(&conf
->pkg_dest_list
);
125 nv_pair_list_init(&conf
->arch_list
);
127 conf
->restrict_to_default_dest
= 0;
128 conf
->default_dest
= NULL
;
130 /* check for lock file */
131 if (args
->offline_root
)
132 sprintf_alloc (&lock_file
, "%s/%s/lock", args
->offline_root
, OPKG_STATE_DIR_PREFIX
);
134 sprintf_alloc (&lock_file
, "%s/lock", OPKG_STATE_DIR_PREFIX
);
136 conf
->lock_fd
= creat (lock_file
, S_IRUSR
| S_IWUSR
| S_IRGRP
);
137 err
= lockf (conf
->lock_fd
, F_TLOCK
, 0);
143 opkg_message (conf
, OPKG_ERROR
, "Could not obtain administrative lock\n");
144 return OPKG_CONF_ERR_LOCK
;
148 tmp_dir_base
= args
->tmp_dir
;
150 tmp_dir_base
= getenv("TMPDIR");
151 sprintf_alloc(&conf
->tmp_dir
, "%s/%s",
152 tmp_dir_base
? tmp_dir_base
: OPKG_CONF_DEFAULT_TMP_DIR_BASE
,
153 OPKG_CONF_TMP_DIR_SUFFIX
);
154 conf
->tmp_dir
= mkdtemp(conf
->tmp_dir
);
155 if (conf
->tmp_dir
== NULL
) {
156 fprintf(stderr
, "%s: Failed to create temporary directory `%s': %s\n",
157 __FUNCTION__
, conf
->tmp_dir
, strerror(errno
));
158 return OPKG_CONF_ERR_TMP_DIR
;
161 pkg_hash_init("pkg-hash", &conf
->pkg_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
162 hash_table_init("file-hash", &conf
->file_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
163 hash_table_init("obs-file-hash", &conf
->obs_file_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
164 lists_dir
=(char *)malloc(1);
166 if (args
->conf_file
) {
167 struct stat stat_buf
;
168 err
= stat(args
->conf_file
, &stat_buf
);
170 if (opkg_conf_parse_file(conf
, args
->conf_file
,
171 &conf
->pkg_src_list
, &tmp_dest_nv_pair_list
,&lists_dir
)<0) {
172 /* Memory leakage from opkg_conf_parse-file */
173 return OPKG_CONF_ERR_PARSE
;
177 if (strlen(lists_dir
)<=1 ){
178 lists_dir
= realloc(lists_dir
,strlen(OPKG_CONF_LISTS_DIR
)+2);
179 sprintf (lists_dir
,"%s",OPKG_CONF_LISTS_DIR
);
182 if (args
->offline_root
) {
184 sprintf_alloc(&tmp
, "%s/%s",args
->offline_root
,lists_dir
);
189 pending_dir
= calloc(1, strlen(lists_dir
)+strlen("/pending")+5);
190 snprintf(pending_dir
,strlen(lists_dir
)+strlen("/pending") ,"%s%s",lists_dir
,"/pending");
192 conf
->lists_dir
= strdup(lists_dir
);
193 conf
->pending_dir
= strdup(pending_dir
);
195 if (args
->offline_root
)
196 sprintf_alloc(&etc_opkg_conf_pattern
, "%s/etc/opkg/*.conf", args
->offline_root
);
198 sprintf_alloc(&etc_opkg_conf_pattern
, "%s/*.conf", conf_file_dir
);
199 memset(&globbuf
, 0, sizeof(globbuf
));
200 err
= glob(etc_opkg_conf_pattern
, 0, NULL
, &globbuf
);
201 free (etc_opkg_conf_pattern
);
204 for (i
= 0; i
< globbuf
.gl_pathc
; i
++) {
205 if (globbuf
.gl_pathv
[i
])
206 if ( opkg_conf_parse_file(conf
, globbuf
.gl_pathv
[i
],
207 &conf
->pkg_src_list
, &tmp_dest_nv_pair_list
,&lists_dir
)<0) {
208 /* Memory leakage from opkg_conf_parse-file */
209 return OPKG_CONF_ERR_PARSE
;
215 /* if no architectures were defined, then default all, noarch, and host architecture */
216 if (nv_pair_list_empty(&conf
->arch_list
)) {
217 nv_pair_list_append(&conf
->arch_list
, "all", "1");
218 nv_pair_list_append(&conf
->arch_list
, "noarch", "1");
219 nv_pair_list_append(&conf
->arch_list
, HOST_CPU_STR
, "10");
222 /* Even if there is no conf file, we'll need at least one dest. */
223 if (nv_pair_list_empty(&tmp_dest_nv_pair_list
)) {
224 nv_pair_list_append(&tmp_dest_nv_pair_list
,
225 OPKG_CONF_DEFAULT_DEST_NAME
,
226 OPKG_CONF_DEFAULT_DEST_ROOT_DIR
);
229 /* After parsing the file, set options from command-line, (so that
230 command-line arguments take precedence) */
231 /* XXX: CLEANUP: The interaction between args.c and opkg_conf.c
232 really needs to be cleaned up. There is so much duplication
233 right now it is ridiculous. Maybe opkg_conf_t should just save
234 a pointer to args_t (which could then not be freed), rather
235 than duplicating every field here? */
236 if (args
->autoremove
) {
237 conf
->autoremove
= 1;
239 if (args
->force_depends
) {
240 conf
->force_depends
= 1;
242 if (args
->force_defaults
) {
243 conf
->force_defaults
= 1;
245 if (args
->force_maintainer
) {
246 conf
->force_maintainer
= 1;
248 if (args
->force_overwrite
) {
249 conf
->force_overwrite
= 1;
251 if (args
->force_downgrade
) {
252 conf
->force_downgrade
= 1;
254 if (args
->force_reinstall
) {
255 conf
->force_reinstall
= 1;
257 if (args
->force_removal_of_dependent_packages
) {
258 conf
->force_removal_of_dependent_packages
= 1;
260 if (args
->force_removal_of_essential_packages
) {
261 conf
->force_removal_of_essential_packages
= 1;
266 if (args
->noaction
) {
269 if (args
->query_all
) {
272 if (args
->verbosity
!= conf
->verbosity
) {
273 conf
->verbosity
= args
->verbosity
;
276 opkg_conf_override_string(&conf
->offline_root
,
278 opkg_conf_override_string(&conf
->offline_root_path
,
279 args
->offline_root_path
);
280 opkg_conf_override_string(&conf
->offline_root_pre_script_cmd
,
281 args
->offline_root_pre_script_cmd
);
282 opkg_conf_override_string(&conf
->offline_root_post_script_cmd
,
283 args
->offline_root_post_script_cmd
);
285 opkg_conf_override_string(&conf
->cache
, args
->cache
);
287 /* Pigi: added a flag to disable the checking of structures if the command does not need to
288 read anything from there.
290 if ( !(args
->nocheckfordirorfile
)){
291 /* need to run load the source list before dest list -Jamey */
292 if ( !(args
->noreadfeedsfile
))
293 set_and_load_pkg_src_list(conf
, &conf
->pkg_src_list
);
295 /* Now that we have resolved conf->offline_root, we can commit to
296 the directory names for the dests and load in all the package
298 set_and_load_pkg_dest_list(conf
, &tmp_dest_nv_pair_list
,lists_dir
);
301 err
= opkg_conf_set_default_dest(conf
, args
->dest
);
303 return OPKG_CONF_ERR_DEFAULT_DEST
;
307 nv_pair_list_deinit(&tmp_dest_nv_pair_list
);
314 void opkg_conf_deinit(opkg_conf_t
*conf
)
316 #ifdef OPKG_DEBUG_NO_TMP_CLEANUP
318 fprintf(stderr
, "%s: Not cleaning up %s since opkg compiled "
319 "with OPKG_DEBUG_NO_TMP_CLEANUP\n",
320 __FUNCTION__
, conf
->tmp_dir
);
324 err
= rmdir(conf
->tmp_dir
);
326 if (errno
== ENOTEMPTY
) {
328 sprintf_alloc(&cmd
, "rm -fr %s\n", conf
->tmp_dir
);
333 fprintf(stderr
, "WARNING: Unable to remove temporary directory: %s: %s\n", conf
->tmp_dir
, strerror(errno
));
335 #endif /* OPKG_DEBUG_NO_TMP_CLEANUP */
337 free(conf
->tmp_dir
); /*XXX*/
338 free(conf
->lists_dir
);
339 free(conf
->pending_dir
);
341 pkg_src_list_deinit(&conf
->pkg_src_list
);
342 pkg_dest_list_deinit(&conf
->pkg_dest_list
);
343 nv_pair_list_deinit(&conf
->arch_list
);
345 pkg_hash_deinit(&conf
->pkg_hash
);
346 if (&conf
->file_hash
)
347 hash_table_deinit(&conf
->file_hash
);
348 if (&conf
->obs_file_hash
)
349 hash_table_deinit(&conf
->obs_file_hash
);
351 opkg_conf_free_string(&conf
->offline_root
);
352 opkg_conf_free_string(&conf
->offline_root_path
);
353 opkg_conf_free_string(&conf
->offline_root_pre_script_cmd
);
354 opkg_conf_free_string(&conf
->offline_root_post_script_cmd
);
356 opkg_conf_free_string(&conf
->cache
);
358 if (conf
->verbosity
> 1) {
360 hash_table_t
*hashes
[] = {
363 &conf
->obs_file_hash
};
364 for (i
= 0; i
< 3; i
++) {
365 hash_table_t
*hash
= hashes
[i
];
369 for (j
= 0; j
< hash
->n_entries
; j
++) {
371 hash_entry_t
*e
= &hash
->entries
[j
];
374 while (e
&& e
->key
) {
381 opkg_message(conf
, OPKG_DEBUG
, "hash_table[%s] n_buckets=%d n_elements=%d max_conflicts=%d n_conflicts=%d\n",
382 hash
->name
, hash
->n_entries
, hash
->n_elements
, c
, n_conflicts
);
383 hash_table_deinit(hash
);
388 static int opkg_conf_set_default_dest(opkg_conf_t
*conf
,
389 const char *default_dest_name
)
391 pkg_dest_list_elt_t
*iter
;
394 for (iter
= void_list_first(&conf
->pkg_dest_list
); iter
; iter
= void_list_next(&conf
->pkg_dest_list
, iter
)) {
395 dest
= (pkg_dest_t
*)iter
->data
;
396 if (strcmp(dest
->name
, default_dest_name
) == 0) {
397 conf
->default_dest
= dest
;
398 conf
->restrict_to_default_dest
= 1;
403 fprintf(stderr
, "ERROR: Unknown dest name: `%s'\n", default_dest_name
);
408 static int set_and_load_pkg_src_list(opkg_conf_t
*conf
, pkg_src_list_t
*pkg_src_list
)
410 pkg_src_list_elt_t
*iter
;
414 for (iter
= void_list_first(pkg_src_list
); iter
; iter
= void_list_next(pkg_src_list
, iter
)) {
415 src
= (pkg_src_t
*)iter
->data
;
420 sprintf_alloc(&list_file
, "%s/%s",
421 conf
->restrict_to_default_dest
? conf
->default_dest
->lists_dir
: conf
->lists_dir
,
424 if (file_exists(list_file
)) {
425 pkg_hash_add_from_file(conf
, list_file
, src
, NULL
, 0);
433 static int set_and_load_pkg_dest_list(opkg_conf_t
*conf
, nv_pair_list_t
*nv_pair_list
, char *lists_dir
)
435 nv_pair_list_elt_t
*iter
;
440 for (iter
= nv_pair_list_first(nv_pair_list
); iter
; iter
= nv_pair_list_next(nv_pair_list
, iter
)) {
441 nv_pair
= (nv_pair_t
*)iter
->data
;
443 if (conf
->offline_root
) {
444 sprintf_alloc(&root_dir
, "%s%s", conf
->offline_root
, nv_pair
->value
);
446 root_dir
= strdup(nv_pair
->value
);
448 dest
= pkg_dest_list_append(&conf
->pkg_dest_list
, nv_pair
->name
, root_dir
, lists_dir
);
453 if (conf
->default_dest
== NULL
) {
454 conf
->default_dest
= dest
;
456 if (file_exists(dest
->status_file_name
)) {
457 pkg_hash_add_from_file(conf
, dest
->status_file_name
,
465 static int opkg_conf_parse_file(opkg_conf_t
*conf
, const char *filename
,
466 pkg_src_list_t
*pkg_src_list
,
467 nv_pair_list_t
*tmp_dest_nv_pair_list
,
471 opkg_option_t
* options
;
472 FILE *file
= fopen(filename
, "r");
473 regex_t valid_line_re
, comment_re
;
474 #define regmatch_size 12
475 regmatch_t regmatch
[regmatch_size
];
477 if (opkg_init_options_array(conf
, &options
)<0)
481 fprintf(stderr
, "%s: failed to open %s: %s\n",
482 __FUNCTION__
, filename
, strerror(errno
));
486 opkg_message(conf
, OPKG_NOTICE
, "loading conf file %s\n", filename
);
488 err
= xregcomp(&comment_re
,
489 "^[[:space:]]*(#.*|[[:space:]]*)$",
495 err
= xregcomp(&valid_line_re
, "^[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))([[:space:]]+([^[:space:]]+))?[[:space:]]*$", REG_EXTENDED
);
504 char *type
, *name
, *value
, *extra
;
506 line
= file_read_line_alloc(file
);
514 if (regexec(&comment_re
, line
, 0, 0, 0) == 0) {
518 if (regexec(&valid_line_re
, line
, regmatch_size
, regmatch
, 0) == REG_NOMATCH
) {
520 fprintf(stderr
, "%s:%d: Ignoring invalid line: `%s'\n",
521 filename
, line_num
, line
);
525 /* This has to be so ugly to deal with optional quotation marks */
526 if (regmatch
[2].rm_so
> 0) {
527 type
= strndup(line
+ regmatch
[2].rm_so
,
528 regmatch
[2].rm_eo
- regmatch
[2].rm_so
);
530 type
= strndup(line
+ regmatch
[3].rm_so
,
531 regmatch
[3].rm_eo
- regmatch
[3].rm_so
);
533 if (regmatch
[5].rm_so
> 0) {
534 name
= strndup(line
+ regmatch
[5].rm_so
,
535 regmatch
[5].rm_eo
- regmatch
[5].rm_so
);
537 name
= strndup(line
+ regmatch
[6].rm_so
,
538 regmatch
[6].rm_eo
- regmatch
[6].rm_so
);
540 if (regmatch
[8].rm_so
> 0) {
541 value
= strndup(line
+ regmatch
[8].rm_so
,
542 regmatch
[8].rm_eo
- regmatch
[8].rm_so
);
544 value
= strndup(line
+ regmatch
[9].rm_so
,
545 regmatch
[9].rm_eo
- regmatch
[9].rm_so
);
548 if (regmatch
[11].rm_so
> 0) {
549 extra
= strndup (line
+ regmatch
[11].rm_so
,
550 regmatch
[11].rm_eo
- regmatch
[11].rm_so
);
553 /* We use the tmp_dest_nv_pair_list below instead of
554 conf->pkg_dest_list because we might encounter an
555 offline_root option later and that would invalidate the
556 directories we would have computed in
557 pkg_dest_list_init. (We do a similar thing with
558 tmp_src_nv_pair_list for sake of symmetry.) */
559 if (strcmp(type
, "option") == 0) {
560 opkg_conf_set_option(options
, name
, value
);
561 } else if (strcmp(type
, "src") == 0) {
562 if (!nv_pair_list_find((nv_pair_list_t
*) pkg_src_list
, name
)) {
563 pkg_src_list_append (pkg_src_list
, name
, value
, extra
, 0);
565 opkg_message(conf
, OPKG_ERROR
, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
568 } else if (strcmp(type
, "src/gz") == 0) {
569 if (!nv_pair_list_find((nv_pair_list_t
*) pkg_src_list
, name
)) {
570 pkg_src_list_append (pkg_src_list
, name
, value
, extra
, 1);
572 opkg_message(conf
, OPKG_ERROR
, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
575 } else if (strcmp(type
, "dest") == 0) {
576 nv_pair_list_append(tmp_dest_nv_pair_list
, name
, value
);
577 } else if (strcmp(type
, "lists_dir") == 0) {
578 *lists_dir
= realloc(*lists_dir
,strlen(value
)+1);
579 if (*lists_dir
== NULL
) {
580 opkg_message(conf
, OPKG_ERROR
, "ERROR: Not enough memory\n");
584 sprintf (*lists_dir
,"%s",value
);
585 } else if (strcmp(type
, "arch") == 0) {
586 opkg_message(conf
, OPKG_INFO
, "supported arch %s priority (%s)\n", name
, value
);
588 opkg_message(conf
, OPKG_NOTICE
, "defaulting architecture %s priority to 10\n", name
);
589 value
= strdup("10");
591 nv_pair_list_append(&conf
->arch_list
, name
, value
);
593 fprintf(stderr
, "WARNING: Ignoring unknown configuration "
594 "parameter: %s %s %s\n", type
, name
, value
);
610 regfree(&comment_re
);
611 regfree(&valid_line_re
);
617 static int opkg_conf_set_option(const opkg_option_t
*options
,
618 const char *name
, const char *value
)
621 while (options
[i
].name
) {
622 if (strcmp(options
[i
].name
, name
) == 0) {
623 switch (options
[i
].type
) {
624 case OPKG_OPT_TYPE_BOOL
:
625 *((int *)options
[i
].value
) = 1;
627 case OPKG_OPT_TYPE_INT
:
629 *((int *)options
[i
].value
) = atoi(value
);
632 printf("%s: Option %s need an argument\n",
636 case OPKG_OPT_TYPE_STRING
:
638 *((char **)options
[i
].value
) = strdup(value
);
641 printf("%s: Option %s need an argument\n",
650 fprintf(stderr
, "%s: Unrecognized option: %s=%s\n",
651 __FUNCTION__
, name
, value
);
655 int opkg_conf_write_status_files(opkg_conf_t
*conf
)
662 FILE * status_file
=NULL
;
667 dest
= (pkg_dest_t
*)void_list_first(&conf
->pkg_dest_list
)->data
;
668 status_file
= fopen(dest
->status_file_tmp_name
, "w");
669 if (status_file
== NULL
) {
670 fprintf(stderr
, "%s: Can't open status file: %s for writing: %s\n",
671 __FUNCTION__
, dest
->status_file_tmp_name
, strerror(errno
));
674 all
= pkg_vec_alloc();
675 pkg_hash_fetch_available(&conf
->pkg_hash
, all
);
677 for(i
= 0; i
< all
->len
; i
++) {
679 /* We don't need most uninstalled packages in the status file */
680 if (pkg
->state_status
== SS_NOT_INSTALLED
681 && (pkg
->state_want
== SW_UNKNOWN
682 || pkg
->state_want
== SW_DEINSTALL
683 || pkg
->state_want
== SW_PURGE
)) {
687 fprintf(stderr
, "Null package\n");
689 if (pkg
->dest
== NULL
) {
690 fprintf(stderr
, "%s: ERROR: Can't write status for "
691 "package %s since it has a NULL dest\n",
692 __FUNCTION__
, pkg
->name
);
696 pkg_print_status(pkg
, status_file
);
703 err
= ferror(status_file
);
706 file_move(dest
->status_file_tmp_name
, dest
->status_file_name
);
708 fprintf(stderr
, "%s: ERROR: An error has occurred writing %s, "
709 "retaining old %s\n", __FUNCTION__
,
710 dest
->status_file_tmp_name
, dest
->status_file_name
);
718 char *root_filename_alloc(opkg_conf_t
*conf
, char *filename
)
721 sprintf_alloc(&root_filename
, "%s%s", (conf
->offline_root
? conf
->offline_root
: ""), filename
);
722 return root_filename
;