/* * install2.c * * This is the second half of the install. It is exec'd from the first half * once the secondary media has been mounted. It does a bunch of argv * processing to figure out what the first half did. It's a bit of a hack, but * it gives us a nice install as far as the user can see. * * Erik Troan (ewt@redhat.com) * * Copyright 1998 Red Hat Software * * This software may be freely redistributed under the terms of the GNU * public license. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * We assume the following: * * /usr/bin -> any binaries we might need * * it's up to the first stage installer to make sure this happens. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "commands.h" #include "config.h" #include "devices.h" #include "doit.h" #include "fs.h" #include "fsedit.h" #include "hd.h" #include "otherinsmod.h" #include "install.h" #include "intl.h" #include "hints.h" #include "kbd.h" #include "kernel.h" #include "kickstart.h" #include "lang.h" #include "libfdisk/libfdisk.h" #include "lilo.h" #include "log.h" #include "methods.h" #include "mkswap.h" #include "net.h" #include "pkgs.h" #include "printercfg.h" #include "run.h" #include "scsi.h" #include "upgrade.h" #include "windows.h" int testing = 0; int expert = 0; int kickstart = 0; static int exitOnSuspend; #define STEP_FIRST 0 #define STEP_PATH 0 #define STEP_CLASS 1 #define STEP_SCSI 2 #define STEP_FDISKMTAB 3 #define STEP_SWAP 4 #define STEP_FINDPKGS 5 #define STEP_FORMAT 6 #define STEP_PICKPKGS 7 #define STEP_DOIT 8 #define STEP_FINISHNET 9 #define STEP_TIMECONFIG 10 #define STEP_SERVICES 11 #define STEP_PRINTER 12 #define STEP_ROOTPW 13 #define STEP_BOOTDISK 14 #define STEP_LILO 15 #define STEP_UPG_SCSI 1 #define STEP_UPG_PKGS 2 #define STEP_UPG_MTAB 3 #define STEP_UPG_FFILES 4 #define STEP_UPG_DOIT 5 #define STEP_UPG_BOOTDISK 6 #define STEP_UPG_LILO 7 #define STEP_DONE 1000 struct installState { int isUpgrade, lastChoice, direction, isLocal; char * pcmcia, * kernel, * keyboard; struct partitionTable table; struct fstab fstab; struct pkgSet ps; struct componentSet cs; struct installMethod * method; struct intfInfo intf, intfFinal; struct netInfo netc, netcFinal; struct driversLoaded * dl; struct installStep * steps; char * rootPath; struct hints hints; } ; typedef int (*installStepFn)(struct installState * state); /* hack */ int rmmod_main(int argc, char ** argv); static int selectInstallClass(); struct installStep { char * name; int prev, next; installStepFn fn; int skipOnCancel, completed; int skipOnLocal; }; /* partition layout for a server */ static struct attemptedPartition serverPartitioning[] = { #if defined(__i386__) { "/boot", 16, LINUX_NATIVE_PARTITION, 0, -1 }, #elif defined(__alpha__) { "/dos", 2, DOS_PRIMARY_lt32MEG_PARTITION, 0, 1 }, #endif { "/", 256, LINUX_NATIVE_PARTITION, 0, -1 }, { "/usr", 512, LINUX_NATIVE_PARTITION, 1, -1 }, { "/var", 256, LINUX_NATIVE_PARTITION, 0, -1 }, { "/home", 512, LINUX_NATIVE_PARTITION, 1, -1 }, { "Swap-auto", 64, LINUX_SWAP_PARTITION, 0, -1 }, { NULL, 0, 0, 0 } }; static int selectInstallClass() { int rc, i; static int choice = 0; char * choices[] = { N_("Custom"), N_("FermiStandAlone"), N_("CDF"), N_("CDFonline"), N_("D0"), N_("ODS"), N_("OSS"), N_("Theory"), N_("Astro"), N_("SDSS"), N_("Farms"), N_("RIP"), N_("FOCUS"), N_("ConsoleServer"), NULL }; char * transChoices[sizeof(choices) / sizeof(*choices)]; for (i = 0; choices[i]; i++) transChoices[i] = _(choices[i]); transChoices[i] = NULL; rc = newtWinMenu(_("Installation Class"), _("What type of machine are you installing? For " "maximum flexibility, choose \"Custom\"."), 40, 20, 10, 10, transChoices, &choice, _("Ok"), _("Back"), NULL); } void doSuspend(void) { pid_t pid; int status; if (exitOnSuspend) { newtFinished(); exit(1); } newtSuspend(); if (!(pid = fork())) { printf(_("\n\nType to return to the install program.\n\n")); execl("/bin/sh", "-/bin/sh", NULL); perror("error execing /bin/sh"); sleep(5); exit(1); } waitpid(pid, &status, 0); newtResume(); } int main(int argc, char ** argv) { char ** argptr; int step = STEP_FIRST; int rc = 0; struct installState state; int i; int isForce = 0; int len = strlen(argv[0]); char * spaces; DIR * dir; struct dirent * ent; char * kickstartFile = NULL; int localInstall = 0; spaces = strdup(" "); newtSetSuspendCallback(doSuspend); newtInit(); newtCls(); newtDrawRootText(0, 0, "Red Hat Linux (C) 1998 Red Hat Software"); newtPushHelpLine(_(" / between elements | selects | next screen ")); newtDrawRootText(0 - i, 0, spaces); spaces[i] = ' '; selectInstallClass(); newtFinished(); return 0; }