#pragma implementation #include #include #include #include "installconf.h" #include "installconf.m" MODULE_DEFINE_VERSION(installconf); static HELP_FILE help_installconf ("installconf","intro"); PUBLIC MODULE_installconf::MODULE_installconf() : LINUXCONF_MODULE("installconf") { linuxconf_loadmsg ("installconf",PACKAGE_REV); } static const char *keymenu=NULL; PUBLIC void MODULE_installconf::setmenu ( DIALOG &dia, MENU_CONTEXT context) { if (context == MENU_MISCSERV){ keymenu = MSG_U(M_installconf,"Installation tasks"); dia.new_menuitem ("installconf","",keymenu); } } static void installconf_menu(const char *pkgbase, const char *root) { static const char *hard = MSG_U(M_HARDWARE,"Hardware components"); static const char *pkgs = MSG_U(M_SOFTPKG,"Software packages"); static const char *disks = MSG_U(M_DISKS,"Disk drives and partitions"); static const char *tbopt[]={ "", hard, "", pkgs, "", disks, NULL }; DIALOG_MENU dia; dia.new_menuitems (tbopt); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_R(M_installconf) ,"" ,help_installconf ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else if (dialog_mode == DIALOG_TREE || perm_rootaccess(MSG_U(P_INSTALLCONF ,"To perform installation tasks"))){ const char *sel = dia.getmenustr(nof); if (sel == hard){ }else if (sel == pkgs){ comps_menu(pkgbase,root); }else if (sel == disks){ } } } } PUBLIC int MODULE_installconf::domenu ( MENU_CONTEXT context, const char *key) { if (context == MENU_MISCSERV){ if (key == keymenu){ installconf_menu("/mnt/cdrom/RedHat",NULL); } } return 0; } PUBLIC int MODULE_installconf::dohtml (const char *key) { int ret = LNCF_NOT_APPLICABLE; if (strcmp(key,"installconf")==0){ // ### Insert any menu and dialog here ret = 0; } return ret; } static void usage() { xconf_error (MSG_U(T_USAGE ,"linuxconf --modulemain installconf usage\n" "\n" "--pkgbase path\n" " Sets the directory where are located the RPMS and base\n" " directories, normally /mnt/cdrom/RedHat\n" "--root path\n" " Sets the base directory for the linux installation\n" "\n" " Without argument, start the main menu\n") ); } PUBLIC void MODULE_installconf::usage (SSTRINGS &tb) { tb.add (new SSTRING (MSG_R(T_USAGE))); } PUBLIC int MODULE_installconf::execmain (int argc , char *argv[], bool standalone) { int ret = LNCF_NOT_APPLICABLE; const char *pt = strrchr(argv[0],'/'); if (pt != NULL){ pt++; }else{ pt = argv[0]; } if (strcmp(pt,"installconf")==0){ ret = -1; if (netconf_rootaccess()){ const char *root = NULL; const char *pkgbase = "/mnt/cdrom/RedHat"; int i; for (i=1; i