⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loader.c~

📁 linux 安装程序
💻 C~
📖 第 1 页 / 共 5 页
字号:
#if defined(__powerpc__)  /* hack for pcspkr breaking ppc right now */    mlLoadModuleSet("cramfs:vfat:nfs:loop:isofs:floppy:edd:squashfs:ext3:ext2",                    modLoaded, modDeps, modInfo);#else    mlLoadModuleSet("cramfs:vfat:nfs:loop:isofs:floppy:edd:pcspkr:squashfs:ext3:ext2",                    modLoaded, modDeps, modInfo);#endif    /* IPv6 support is conditional */    ipv6Setup(modLoaded, modDeps, modInfo);    /* now let's do some initial hardware-type setup */    ideSetup(modLoaded, modDeps, modInfo);    scsiSetup(modLoaded, modDeps, modInfo);    dasdSetup(modLoaded, modDeps, modInfo);    spufsSetup(modLoaded, modDeps, modInfo);    /* Note we *always* do this. If you could avoid this you could get       a system w/o USB keyboard support, which would be bad. */    usbInitialize(modLoaded, modDeps, modInfo);        /* now let's initialize any possible firewire.  fun */    firewireInitialize(modLoaded, modDeps, modInfo);    /* explicitly read this to let libkudzu know we want to merge     * in future tables rather than replace the initial one */    pciReadDrivers("/modules/modules.alias");        if (loaderData.lang && (loaderData.lang_set == 1)) {        setLanguage(loaderData.lang);    }    if (!canProbeDevices() || FL_MODDISK(flags)) {        startNewt();                loadDriverDisks(CLASS_UNSPEC, modLoaded, &modDeps, modInfo);    }    /* FIXME: this is a bit of a hack */    loaderData.modLoaded = modLoaded;    loaderData.modDepsPtr = &modDeps;    loaderData.modInfo = modInfo;    if (!access("/dd.img", R_OK)) {        logMessage(INFO, "found /dd.img, loading drivers");        getDDFromSource(&loaderData, "path:/dd.img");    }        /* this allows us to do an early load of modules specified on the     * command line to allow automating the load order of modules so that     * eg, certain scsi controllers are definitely first.     * FIXME: this syntax is likely to change in a future release     *        but is done as a quick hack for the present.     */    earlyModuleLoad(modInfo, modLoaded, modDeps, 0);    busProbe(modInfo, modLoaded, modDeps, 0);    /* JKFIXME: we'd really like to do this before the busprobe, but then     * we won't have network devices available (and that's the only thing     * we support with this right now */    if (loaderData.ddsrc != NULL) {        getDDFromSource(&loaderData, loaderData.ddsrc);    }    /* JKFIXME: loaderData->ksFile is set to the arg from the command line,     * and then getKickstartFile() changes it and sets FL_KICKSTART.       * kind of weird. */    if (loaderData.ksFile || ksFile) {        logMessage(INFO, "getting kickstart file");        if (!ksFile)            getKickstartFile(&loaderData);        if (FL_KICKSTART(flags) &&             (ksReadCommands((ksFile)?ksFile:loaderData.ksFile)!=LOADER_ERROR)) {            runKickstart(&loaderData);        }    }    if (FL_TELNETD(flags))        startTelnetd(&loaderData, modInfo, modLoaded, modDeps);    url = doLoaderMain("/mnt/source", &loaderData, modInfo, modLoaded, &modDeps);    if (!FL_TESTING(flags)) {        /* unlink dirs and link to the ones in /mnt/runtime */        migrate_runtime_directory("/usr");        migrate_runtime_directory("/lib");        migrate_runtime_directory("/lib64");    }    /* now load SELinux policy before exec'ing anaconda and the shell     * (if we're using SELinux) */    if (FL_SELINUX(flags)) {        if (mount("/selinux", "/selinux", "selinuxfs", 0, NULL)) {            logMessage(ERROR, "failed to mount /selinux: %s, disabling SELinux", strerror(errno));            flags &= ~LOADER_FLAGS_SELINUX;        } else {            /* FIXME: this is a bad hack for libselinux assuming things             * about paths */	    int ret;            ret = symlink("/mnt/runtime/etc/selinux", "/etc/selinux");            if (loadpolicy() == 0) {                setexeccon(ANACONDA_CONTEXT);            } else {                logMessage(ERROR, "failed to load policy, disabling SELinux");                flags &= ~LOADER_FLAGS_SELINUX;            }        }    }    logMessage(INFO, "getting ready to spawn shell now");        spawnShell();  /* we can attach gdb now :-) */    /* JKFIXME: kickstart devices crap... probably kind of bogus now though */    /* we might have already loaded these, but trying again doesn't hurt */    ideSetup(modLoaded, modDeps, modInfo);    scsiSetup(modLoaded, modDeps, modInfo);    busProbe(modInfo, modLoaded, modDeps, 0);    checkForHardDrives();    if ((!canProbeDevices() || FL_ISA(flags) || FL_NOPROBE(flags))        && !loaderData.ksFile) {        startNewt();        manualDeviceCheck(modInfo, modLoaded, &modDeps);    }    if (loaderData.updatessrc)        loadUpdatesFromRemote(loaderData.updatessrc, &loaderData);    else if (FL_UPDATES(flags))        loadUpdates(&loaderData);    mlLoadModuleSet("md:raid0:raid1:raid5:raid6:raid456:raid10:fat:msdos:jbd:lock_nolock:gfs2:reiserfs:jfs:xfs:dm-mod:dm-zero:dm-mirror:dm-snapshot:dm-multipath:dm-round-robin:dm-emc", modLoaded, modDeps, modInfo);    usbInitializeMouse(modLoaded, modDeps, modInfo);    /* we've loaded all the modules we're going to.  write out a file     * describing which scsi disks go with which scsi adapters */    writeScsiDisks(modLoaded);    /* if we are in rescue mode lets load st.ko for tape support */    if (FL_RESCUE(flags))        scsiTapeInitialize(modLoaded, modDeps, modInfo);    /* we only want to use RHupdates on nfs installs.  otherwise, we'll      * use files on the first iso image and not be able to umount it */    if (!strncmp(url, "nfs:", 4)) {        logMessage(INFO, "NFS install method detected, will use RHupdates/");        useRHupdates = 1;    } else {        useRHupdates = 0;    }    if (useRHupdates) {        setenv("PYTHONPATH", "/tmp/updates:/tmp/product:/mnt/source/RHupdates", 1);        setenv("LD_LIBRARY_PATH",                sdupprintf("/tmp/updates:/tmp/product:/mnt/source/RHupdates:%s",                           LIBPATH), 1);#ifdef NASH_FIRMWARE_LOADER        nashSetFirmwarePath(nc, "/firmware/:/lib/firmware/:/tmp/updates/firmware/:/tmp/product/firmware:/mnt/source/RHupdates/firmware/");        nashHotplugKill(nc);        nashHotplugInit(nc);#endif    } else {        setenv("PYTHONPATH", "/tmp/updates:/tmp/product", 1);        setenv("LD_LIBRARY_PATH",                sdupprintf("/tmp/updates:/tmp/product:%s", LIBPATH), 1);#ifdef NASH_FIRMWARE_LOADER        nashSetFirmwarePath(nc, "/firmware/:/lib/firmware/:/tmp/updates/firmware/:/tmp/product/firmware");        nashHotplugKill(nc);        nashHotplugInit(nc);#endif    }    if (!access("/mnt/runtime/usr/lib/libunicode-lite.so.1", R_OK))        setenv("LD_PRELOAD", "/mnt/runtime/usr/lib/libunicode-lite.so.1", 1);    if (!access("/mnt/runtime/usr/lib64/libunicode-lite.so.1", R_OK))        setenv("LD_PRELOAD", "/mnt/runtime/usr/lib64/libunicode-lite.so.1", 1);    argptr = anacondaArgs;    if (!access("/tmp/updates/anaconda", X_OK))        *argptr++ = "/tmp/updates/anaconda";    else if (useRHupdates && !access("/mnt/source/RHupdates/anaconda", X_OK))        *argptr++ = "/mnt/source/RHupdates/anaconda";    else        *argptr++ = "/usr/bin/anaconda";    /* make sure /tmp/updates exists so that magic in anaconda to */    /* symlink rhpl/ will work                                    */    if (access("/tmp/updates", F_OK))        mkdirChain("/tmp/updates");    logMessage(INFO, "Running anaconda script %s", *(argptr-1));        *argptr++ = "-m";    if (strncmp(url, "ftp:", 4)) {        *argptr++ = url;    } else {        int fd, ret;        fd = open("/tmp/method", O_CREAT | O_TRUNC | O_RDWR, 0600);        ret = write(fd, url, strlen(url));        ret = write(fd, "\r", 1);        close(fd);        *argptr++ = "@/tmp/method";    }    /* add extra args - this potentially munges extraArgs */    tmparg = extraArgs;    while (*tmparg) {        char *idx;                logMessage(DEBUGLVL, "adding extraArg %s", *tmparg);        idx = strchr(*tmparg, '=');        if (idx &&  ((idx-*tmparg) < strlen(*tmparg))) {            *idx = '\0';            *argptr++ = *tmparg;            *argptr++ = idx+1;        } else {            *argptr++ = *tmparg;        }                tmparg++;    }    if (loaderData.noipv4)        *argptr++ = "--noipv4";    if (loaderData.noipv6)        *argptr++ = "--noipv6";    if (FL_RESCUE(flags)) {        *argptr++ = "--rescue";        if (FL_SERIAL(flags))            *argptr++ = "--serial";    } else {        if (FL_SERIAL(flags))            *argptr++ = "--serial";        if (FL_TEXT(flags))            *argptr++ = "-T";        else if (FL_GRAPHICAL(flags))            *argptr++ = "--graphical";        if (FL_CMDLINE(flags))            *argptr++ = "-C";        if (FL_EXPERT(flags))            *argptr++ = "--expert";        if (!FL_SELINUX(flags))            *argptr++ = "--noselinux";        else if (FL_SELINUX(flags))            *argptr++ = "--selinux";                if (FL_KICKSTART(flags)) {            *argptr++ = "--kickstart";            *argptr++ = loaderData.ksFile;        }        if (FL_VIRTPCONSOLE(flags)) {            *argptr++ = "--virtpconsole";            *argptr++ = virtpcon;        }        if (loaderData.updatessrc && FL_UPDATES(flags)) {            *argptr++ = "--updates";            *argptr++ = loaderData.updatessrc;        }        if ((loaderData.lang) && !FL_NOPASS(flags)) {            *argptr++ = "--lang";            *argptr++ = loaderData.lang;        }                if ((loaderData.kbd) && !FL_NOPASS(flags)) {            *argptr++ = "--keymap";            *argptr++ = loaderData.kbd;        }        if (loaderData.logLevel) {            *argptr++ = "--loglevel";            *argptr++ = loaderData.logLevel;        }                for (i = 0; i < modLoaded->numModules; i++) {            if (!modLoaded->mods[i].path) continue;            if (!strcmp(modLoaded->mods[i].path,                         "/mnt/runtime/modules/modules.cgz")) {                continue;            }                        *argptr++ = "--module";            *argptr = alloca(80);            sprintf(*argptr, "%s:%s", modLoaded->mods[i].path,                    modLoaded->mods[i].name);                        argptr++;        }    }        *argptr = NULL;        stopNewt();    closeLog();        if (!FL_TESTING(flags)) {        int pid, status, rc;        char * buf;        if (FL_RESCUE(flags))            buf = sdupprintf(_("Running anaconda, the %s rescue mode - please wait...\n"), getProductName());        else            buf = sdupprintf(_("Running anaconda, the %s system installer - please wait...\n"), getProductName());        printf("%s", buf);        if (!(pid = fork())) {            if (execv(anacondaArgs[0], anacondaArgs) == -1) {               fprintf(stderr,"exec of anaconda failed: %s\n",strerror(errno));               exit(1);            }        }        waitpid(pid, &status, 0);        if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status))) {            rc = 1;        } else {            rc = 0;        }        if ((rc == 0) && (FL_POWEROFF(flags) || FL_HALT(flags))) {            if (!(pid = fork())) {                char * cmd = (FL_POWEROFF(flags) ? strdup("/sbin/poweroff") :                              strdup("/sbin/halt"));                if (execl(cmd, cmd, NULL) == -1) {                    fprintf(stderr, "exec of poweroff failed: %s",                             strerror(errno));                    exit(1);                }            }            waitpid(pid, &status, 0);        }#if defined(__s390__) || defined(__s390x__)        /* FIXME: we have to send a signal to linuxrc on s390 so that shutdown         * can happen.  this is ugly */        FILE * f;        f = fopen("/var/run/init.pid", "r");        if (!f) {            logMessage(WARNING, "can't find init.pid, guessing that init is pid 1");            pid = 1;        } else {            char * buf = malloc(256);            char *ret;            ret = fgets(buf, 256, f);            pid = atoi(buf);        }#ifdef NASH_FIRMWARE_LOADER        nashHotplugKill(nc);#endif        kill(pid, SIGUSR1);        return rc;#else        return rc;#endif    }#ifdef NASH_FIRMWARE_LOADER    else {	char **args = anacondaArgs;	printf("would have run ");	while (*args)	    printf("%s ", *args++);	printf("\n");	printf("LANGKEY=%s\n", getenv("LANGKEY"));	printf("LANG=%s\n", getenv("LANG"));    }#endif    return 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -