static int set_network(struct menudesc *menu, void *arg) { network_up = 0; if (config_network()) mnt_net_config(); return 0; }
static int do_config_network(void) { int ret; while ((ret = config_network()) <= 0) { if (ret < 0) return (-1); msg_display(MSG_netnotup); process_menu(MENU_yesno, NULL); if (!yesno) { msg_display(MSG_netnotup_continueanyway); process_menu(MENU_yesno, NULL); if (!yesno) return -1; network_up = 1; break; } } return 0; }
static int set_binpkg(struct menudesc *menu, void *arg) { configinfo **confp = arg; char pattern[STRSIZE]; /* binary pkg config requires network at this point, so if it's not already configured, do it. */ if (network_up == 0) { if (config_network()) mnt_net_config(); } process_menu(MENU_binpkg, NULL); make_url(pkgpath, &pkg, pkg_dir); if ( run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, "pkg_add %s/pkgin", pkgpath) != 0) { msg_display(MSG_pkgin_failed); process_menu(MENU_ok, NULL); confp[menu->cursel]->setting = MSG_failed; return 0; } /* configure pkgin to use $pkgpath as a repository */ snprintf(pattern, STRSIZE, "s,^[^#].*$,%s,", pkgpath); replace("/usr/pkg/etc/pkgin/repositories.conf", pattern); run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, "/usr/pkg/bin/pkgin -y update"); msg_display(MSG_binpkg_installed); process_menu(MENU_ok, NULL); confp[menu->cursel]->setting = MSG_DONE; return 0; }