Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 297348 Details for
Bug 435142
direct installation option
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
loader patch
jv.patch (text/plain), 25.58 KB, created by
Jerry Vonau
on 2008-03-09 05:27:25 UTC
(
hide
)
Description:
loader patch
Filename:
MIME Type:
Creator:
Jerry Vonau
Created:
2008-03-09 05:27:25 UTC
Size:
25.58 KB
patch
obsolete
>diff -up ./init.c.orig ./init.c >--- ./init.c.orig 2008-03-01 12:22:33.000000000 -0600 >+++ ./init.c 2008-03-01 12:38:28.000000000 -0600 >@@ -135,6 +135,7 @@ void shutDown(int noKill, int doReboot, > static int getNoKill(void); > struct termios ts; > >+ > static int mystrstr(char *str1, char *str2) { > char *p; > int rc=0; >@@ -440,6 +441,21 @@ static void sigUsr2Handler(int signum) { > shutDown(getNoKill(), 0, 1); > } > >+ >+static int getRunInit(void) { >+ int fd; >+ int len; >+ char buf[1024]; >+ >+ /* look through /proc/cmdline for special options */ >+ if ((fd = open("/proc/cmdline", O_RDONLY,0)) > 0) { >+ len = read(fd, buf, sizeof(buf) - 1); >+ close(fd); >+ if (len > 0 && mystrstr(buf, "liveinit")) >+ return 1; >+ } >+ return 0; >+} > static int getNoKill(void) { > int fd; > int len; >@@ -478,6 +494,7 @@ int main(int argc, char **argv) { > pid_t installpid, childpid; > int waitStatus; > int fd = -1; >+ int Runinit = 0; > int doReboot = 0; > int doShutdown =0; > int isSerial = 0; >@@ -489,7 +506,13 @@ int main(int argc, char **argv) { > struct serial_struct si; > int i, disable_keys; > >- if (!strncmp(basename(argv[0]), "poweroff", 8)) { >+ if (!strncmp(basename(argv[0]), "runinit", 7)) { >+ printf("Running runinit...\n"); >+ fd = getRunInit(); >+ if (fd > 0) >+ kill(fd, SIGUSR2); >+ exit(0); >+ } else if (!strncmp(basename(argv[0]), "poweroff", 8)) { > printf("Running poweroff...\n"); > fd = getInitPid(); > if (fd > 0) >@@ -525,7 +548,7 @@ int main(int argc, char **argv) { > > printstr("\nGreetings.\n"); > >- printf("anaconda installer init version %s starting\n", VERSION); >+ printf("anaconda installer-init JV-version %s starting\n", VERSION); > > printf("mounting /proc filesystem... "); > if (!testing) { >@@ -534,6 +557,38 @@ int main(int argc, char **argv) { > } > printf("done\n"); > >+ printf("mounting /sys filesystem... "); >+ if (!testing) { >+ if (mount("/sys", "/sys", "sysfs", 0, NULL)) >+ fatal_error(1); >+ } >+ printf("done\n"); >+ >+ printf("trying to remount root filesystem read write... "); >+ if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) { >+ fatal_error(1); >+ } >+ printf("done\n"); >+ >+ /* we want our /tmp to be ramfs, but we also want to let people hack >+ * their initrds to add things like a ks.cfg, so this has to be a little >+ * tricky */ >+ if (!testing) { >+ rename("/tmp", "/oldtmp"); >+ mkdir("/tmp", 0755); >+ >+ printf("mounting /tmp as ramfs... "); >+ if (mount("none", "/tmp", "ramfs", 0, NULL)) >+ fatal_error(1); >+ printf("done\n"); >+ >+ copyDirectory("/oldtmp", "/tmp", copyErrorFn, copyErrorFn); >+ unlink("/oldtmp"); >+ } >+ >+ /* Now we have some /tmp space set up, and /etc and /dev point to >+ it. We should be in pretty good shape. */ >+ > printf("creating /dev filesystem... "); > if (!testing) { > if (mount("/dev", "/dev", "tmpfs", 0, NULL)) >@@ -542,6 +597,20 @@ int main(int argc, char **argv) { > printf("starting udev..."); > if (fork() == 0) { > execl("/sbin/udevd", "/sbin/udevd","--daemon",NULL); >+ >+ /* write out a pid file */ >+ if ((fd = open("/var/run/udev.pid", O_WRONLY|O_CREAT, 0644)) > 0) { >+ char * buf = malloc(10); >+ int ret; >+ snprintf(buf, 9, "%d", getpid()); >+ ret = write(fd, buf, strlen(buf)); >+ close(fd); >+ free(buf); >+ } else { >+ printf("unable to write udev.pid (%d): %s\n", errno, strerror(errno)); >+ sleep(2); >+ >+ } > exit(1); > } > } >@@ -554,13 +623,6 @@ int main(int argc, char **argv) { > } > printf("done\n"); > >- printf("mounting /sys filesystem... "); >- if (!testing) { >- if (mount("/sys", "/sys", "sysfs", 0, NULL)) >- fatal_error(1); >- } >- printf("done\n"); >- > /* these args are only for testing from commandline */ > for (i = 1; i < argc; i++) { > if (!strcmp (argv[i], "serial")) { >@@ -699,31 +761,6 @@ int main(int argc, char **argv) { > ret = setdomainname("", 0); > } > >- printf("trying to remount root filesystem read write... "); >- if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) { >- fatal_error(1); >- } >- printf("done\n"); >- >- /* we want our /tmp to be ramfs, but we also want to let people hack >- * their initrds to add things like a ks.cfg, so this has to be a little >- * tricky */ >- if (!testing) { >- rename("/tmp", "/oldtmp"); >- mkdir("/tmp", 0755); >- >- printf("mounting /tmp as ramfs... "); >- if (mount("none", "/tmp", "ramfs", 0, NULL)) >- fatal_error(1); >- printf("done\n"); >- >- copyDirectory("/oldtmp", "/tmp", copyErrorFn, copyErrorFn); >- unlink("/oldtmp"); >- } >- >- /* Now we have some /tmp space set up, and /etc and /dev point to >- it. We should be in pretty good shape. */ >- > if (!testing) > doklog("/dev/tty4"); > >@@ -822,15 +859,30 @@ int main(int argc, char **argv) { > if (childpid == installpid) > doShutdown = 1; > } >- >- if (!WIFEXITED(waitStatus) || >+ >+ if (!WIFEXITED(waitStatus) || > (WIFEXITED(waitStatus) && WEXITSTATUS(waitStatus))) { >- printf("install exited abnormally [%d/%d] ", WIFEXITED(waitStatus), >- WEXITSTATUS(waitStatus)); >+ /* run-init handler */ >+ /* Runinit = 0; */ >+ Runinit = WEXITSTATUS(waitStatus); >+ if (Runinit == 2) { >+ printf("loader exit signal"); >+ printf("-- received signal %d", WEXITSTATUS(waitStatus)); >+ Runinit = (getRunInit()); >+ if (Runinit == 1) { >+ execve("kill `pidof udevd`", NULL, NULL); >+ execve("/sbin/run-init", NULL, NULL); >+ exit(0); >+ } >+ } >+ printf("install exited abnormally [%d/%d] ", WIFEXITED(waitStatus), WEXITSTATUS(waitStatus)); >+ printf("-- received signal %d", WIFEXITED(waitStatus)); >+ printf("-- received signal %d", WEXITSTATUS(waitStatus)); > if (WIFSIGNALED(waitStatus)) { > printf("-- received signal %d", WTERMSIG(waitStatus)); > } > printf("\n"); >+ > } else { > doReboot = 1; > } >diff -up ./loader.c.orig ./loader.c >--- ./loader.c.orig 2008-02-28 16:42:50.000000000 -0600 >+++ ./loader.c 2008-03-01 12:48:46.000000000 -0600 >@@ -82,6 +82,7 @@ > #include "nfsinstall.h" > #include "hdinstall.h" > #include "urlinstall.h" >+#include "imginstall.h" > > #include "net.h" > #include "telnetd.h" >@@ -109,6 +110,7 @@ uint64_t flags = LOADER_FLAGS_SELINUX; > #ifdef INCLUDE_LOCAL > #include "cdinstall.h" > #include "hdinstall.h" >+#include "imginstall.h" > #endif > #ifdef INCLUDE_NETWORK > #include "nfsinstall.h" >@@ -121,8 +123,10 @@ int post_link_sleep = 0; > static struct installMethod installMethods[] = { > #if !defined(__s390__) && !defined(__s390x__) > { N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage }, >+ { N_("Live CD/DVD"), 0, DEVICE_CDROM, mountLiveCD }, > #endif > { N_("Hard drive"), 0, DEVICE_DISK, mountHardDrive }, >+ { N_("Live HD"), 0, DEVICE_DISK, mountLiveHD }, > { N_("NFS directory"), 1, DEVICE_NETWORK, mountNfsImage }, > { "URL", 1, DEVICE_NETWORK, mountUrlImage }, > }; >@@ -750,8 +754,10 @@ static void parseCmdLineFlags(struct loa > logMessage(INFO, "expert got used, ignoring"); > /* flags |= (LOADER_FLAGS_EXPERT | LOADER_FLAGS_MODDISK | > LOADER_FLAGS_ASKMETHOD);*/ >- } else if (!strcasecmp(argv[i], "askmethod")) >- flags |= LOADER_FLAGS_ASKMETHOD; >+ } else if (!strcasecmp(argv[i], "liveinit")) >+ flags |= LOADER_FLAGS_LIVEINIT; >+ else if (!strcasecmp(argv[i], "livefs")) >+ flags |= LOADER_FLAGS_LIVEFS; > else if (!strcasecmp(argv[i], "asknetwork")) > flags |= LOADER_FLAGS_ASKNETWORK; > else if (!strcasecmp(argv[i], "noshell")) >@@ -1432,7 +1438,8 @@ static int manualDeviceCheck(struct load > > /* JKFIXME: I don't really like this, but at least it isolates the ifdefs */ > /* Either move dirname to %s_old or unlink depending on arch (unlink on all >- * !s390{,x} arches). symlink to /mnt/runtime/dirname. dirname *MUST* start >+ * !s390{,x} arches). symlink to /mnt/runtime/dirname. dirname *MUST* >+start > * with a '/' */ > static void migrate_runtime_directory(char * dirname) { > char * runtimedir; >@@ -1709,19 +1716,40 @@ int main(int argc, char ** argv) { > if (FL_TELNETD(flags)) > startTelnetd(&loaderData); > >- url = doLoaderMain("/mnt/source", &loaderData, modInfo); >- >- if (!FL_TESTING(flags)) { >+ if (FL_LIVEFS(flags)) { >+ char *fmt; >+ fmt = _("Running anaconda %s LiveCD mode for %s - please wait...\n"); >+ printf(fmt, VERSION, getProductName()); >+ mkdir("/sysroot", 0755); >+ url = doLoaderMain("/mnt/source", &loaderData, modInfo); > int ret; >+ ret = symlink("/sysroot", "/mnt/runtime"); > >- /* unlink dirs and link to the ones in /mnt/runtime */ >- migrate_runtime_directory("/usr"); >- migrate_runtime_directory("/lib"); >- migrate_runtime_directory("/lib64"); >- ret = symlink("/mnt/runtime/etc/selinux", "/etc/selinux"); >- copyDirectory("/mnt/runtime/etc","/etc", copyWarnFn, copyErrorFn); >- copyDirectory("/mnt/runtime/var","/var", copyWarnFn, copyErrorFn); >- } >+ if (FL_LIVEINIT(flags)) { >+ char *fmt; >+ fmt = _("Running anaconda %s init mode for %s - please wait...\n"); >+ printf(fmt, VERSION, getProductName()); >+ exit (2); >+ } >+ >+ } else { >+ >+ url = doLoaderMain("/mnt/source", &loaderData, modInfo); >+ } >+ if (!FL_TESTING(flags)) { >+ int ret; >+ /* unlink dirs and link to the ones in /mnt/runtime */ >+ if (FL_LIVEFS(flags)) { >+ migrate_runtime_directory("/bin"); >+ migrate_runtime_directory("/sbin"); >+ } >+ migrate_runtime_directory("/usr"); >+ migrate_runtime_directory("/lib"); >+ migrate_runtime_directory("/lib64"); >+ ret = symlink("/mnt/runtime/etc/selinux", "/etc/selinux"); >+ copyDirectory("/mnt/runtime/etc","/etc", copyWarnFn, copyErrorFn); >+ copyDirectory("/mnt/runtime/var","/var", copyWarnFn, copyErrorFn); >+ } > > /* now load SELinux policy before exec'ing anaconda and the shell > * (if we're using SELinux) */ >@@ -1913,11 +1941,11 @@ int main(int argc, char ** argv) { > > if (FL_RESCUE(flags)) { > fmt = _("Running anaconda %s, the %s rescue mode - please wait...\n"); >- } else { >+ } else { > fmt = _("Running anaconda %s, the %s system installer - please wait...\n"); > } > printf(fmt, VERSION, getProductName()); >- >+ > if (!(pid = fork())) { > setenv("ANACONDAVERSION", VERSION, 1); > if (execv(anacondaArgs[0], anacondaArgs) == -1) { >diff -up ./method.c.orig ./method.c >--- ./method.c.orig 2008-02-28 16:42:50.000000000 -0600 >+++ ./method.c 2008-03-01 13:12:36.000000000 -0600 >@@ -54,6 +54,7 @@ > #include "nfsinstall.h" > #include "hdinstall.h" > #include "urlinstall.h" >+#include "imginstall.h" > > /* boot flags */ > extern uint64_t flags; >@@ -128,6 +129,7 @@ int mountLoopback(char * fsystem, char * > /* FIXME: really, mountLoopback() should take a list of "valid" > * filesystems for the specific type of image being mounted */ > if (doPwMount(device, mntpoint, "iso9660", "ro,loop")) { >+ if (doPwMount(device, mntpoint, "ext3", "ro,loop")) { > if (doPwMount(device, mntpoint, "ext2", "ro,loop")) { > if (doPwMount(device, mntpoint, "squashfs", "ro,loop")) { > if (doPwMount(device, mntpoint, "cramfs", "ro,loop")) { >@@ -141,7 +143,8 @@ int mountLoopback(char * fsystem, char * > } > } > } >- } >+ } >+ } > > return 0; > } >@@ -676,11 +679,12 @@ void setMethodFromCmdline(char * arg, st > ld->methodData = calloc(sizeof(struct urlInstallData *), 1); > ((struct urlInstallData *)ld->methodData)->url = strdup(arg); > #if !defined(__s390__) && !defined(__s390x__) >- } else if (!strncmp(arg, "cdrom:", 6)) { >+ } else if (!strncmp(arg, "cdrom:", 6) || !strncmp(arg, "livecd:", 7) ) { > ld->method = METHOD_CDROM; > #endif >- } else if (!strncmp(arg, "harddrive:", 10) || >- !strncmp(arg, "hd:", 3)) { >+ } else if (!strncmp(arg, "harddrive:", 10) || >+ !strncmp(arg, "hd:", 3) || >+ !strncmp(arg, "livehd:", 7 )) { > ld->method = METHOD_HD; > ld->methodData = calloc(sizeof(struct hdInstallData *), 1); > ((struct hdInstallData *)ld->methodData)->partition = strdup(c); >diff -up ./loader.h.orig ./loader.h >--- ./loader.h.orig 2008-02-28 16:42:50.000000000 -0600 >+++ ./loader.h 2008-03-01 13:03:26.000000000 -0600 >@@ -66,6 +66,9 @@ > #define LOADER_FLAGS_IS_KICKSTART (((uint64_t) 1) << 35) > #define LOADER_FLAGS_ALLOW_WIRELESS (((uint64_t) 1) << 36) > #define LOADER_FLAGS_HAVE_CMSCONF (((uint64_t) 1) << 37) >+#define LOADER_FLAGS_LIVEINIT (((uint64_t) 1) << 38) >+#define LOADER_FLAGS_LIVEFS (((uint64_t) 1) << 39) >+#define LOADER_FLAGS_LIVERAM (((uint64_t) 1) << 40) > > #define FL_TESTING(a) ((a) & LOADER_FLAGS_TESTING) > #define FL_EXPERT(a) ((a) & LOADER_FLAGS_EXPERT) >@@ -97,6 +100,9 @@ > #define FL_IS_KICKSTART(a) ((a) & LOADER_FLAGS_IS_KICKSTART) > #define FL_ALLOW_WIRELESS(a) ((a) & LOADER_FLAGS_ALLOW_WIRELESS) > #define FL_HAVE_CMSCONF(a) ((a) & LOADER_FLAGS_HAVE_CMSCONF) >+#define FL_LIVEINIT(a) ((a) & LOADER_FLAGS_LIVEINIT) >+#define FL_LIVEFS(a) ((a) & LOADER_FLAGS_LIVEFS) >+#define FL_LIVERAM(a) ((a) & LOADER_FLAGS_LIVERAM) > > void startNewt(void); > void stopNewt(void); >diff -up ./urlinstall.c.orig ./urlinstall.c >--- ./urlinstall.c.orig 2008-02-28 16:42:50.000000000 -0600 >+++ ./urlinstall.c 2008-03-01 13:08:05.000000000 -0600 >@@ -43,6 +43,7 @@ > #include "method.h" > #include "urlinstall.h" > #include "cdinstall.h" >+#include "imginstall.h" > #include "urls.h" > #include "windows.h" > >@@ -232,6 +233,15 @@ char * mountUrlImage(struct installMetho > break; > > case URL_STAGE_FETCH: >+ if (FL_LIVEFS(flags)) { >+ mountLiveCD(method, location, loaderData); >+ >+ stage = URL_STAGE_DONE; >+ dir = 1; >+ break; >+ } >+ >+ > if (FL_TESTING(flags)) { > stage = URL_STAGE_DONE; > dir = 1; >diff -up ./imginstall.c.orig ./imginstall.c >--- ./imginstall.c.orig 2008-03-01 13:33:28.000000000 -0600 >+++ ./imginstall.c 2008-03-01 13:09:11.000000000 -0600 >@@ -1 +1,325 @@ >+/* >+ * imginstall.c - code to set up live images for installs >+ * Based on cdinstall.c JV >+ * Copyright (C) 2008 Red Hat, Inc. >+ * All rights reserved. >+ * >+ * This program is free software; you can redistribute it and/or modify >+ * it under the terms of the GNU General Public License as published by >+ * the Free Software Foundation; either version 2 of the License, or >+ * (at your option) any later version. >+ * >+ * This program is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ * GNU General Public License for more details. >+ * >+ * You should have received a copy of the GNU General Public License >+ * along with this program. If not, see <http://www.gnu.org/licenses/>. >+ * Author(s): cdinstall.c: >+ * Erik Troan <ewt@redhat.com> >+ * Matt Wilson <msw@redhat.com> >+ * Michael Fulbright <msf@redhat.com> >+ * Jeremy Katz <katzj@redhat.com> >+ * >+ * imginstall.c: >+ * Jerry Vonau <jvonau@shaw.ca> >+ */ >+ >+#include <ctype.h> >+#include <dirent.h> >+#include <errno.h> >+#include <fcntl.h> >+#include <newt.h> >+#include <stdlib.h> >+#include <string.h> >+#include <sys/mount.h> >+#include <sys/ioctl.h> >+#include <unistd.h> >+#include <asm/types.h> >+#include <linux/cdrom.h> >+#include "kickstart.h" >+#include "loader.h" >+#include "loadermisc.h" >+#include "log.h" >+#include "lang.h" >+#include "modules.h" >+#include "method.h" >+#include "imginstall.h" >+#include "mediacheck.h" >+#include "../isys/imount.h" >+#include "../isys/isys.h" >+ >+/* boot flags */ >+extern uint64_t flags; >+ >+/* output an error message when CD in drive is not the correct one */ >+/* Used by mountLiveCd() */ >+static void wrongCDMessage(void) { >+ char *buf = NULL; >+ int i; >+ i = asprintf(&buf, (_("The LiveCD was not found " >+ "in any of your drives. Please insert " >+ "the LiveCD and press %s to retry."), _("OK"))); >+ newtWinMessage(_("Error"), _("OK"), buf, _("OK")); >+ free(buf); >+} >+static char SetupLive() { >+ int rc; >+ logMessage(INFO, "SetupLive called"); >+ rc = unlink("/mnt/runtime"); >+ rc = umount("/mnt/source"); >+ rc = system("rm -rf /mnt/*"); >+/* rc = system("kill pidof udevd"); */ >+/* rc = system("/sbin/run-init"); */ >+ return 1; >+ exit(2); >+} >+ >+static char SetupDM() { >+ int rc, r; >+ char *dmhelper2 = NULL; >+/* char *dmhelper = NULL; */ >+ >+ logMessage(INFO, "SetupDM called"); >+ rc = mlLoadModule("dm_snapshot", NULL); >+/* rc = system("/tmp/mkosmin2"); */ >+ >+ rc = mkdir("/LiveFS", 0755); >+ rc = mount("none", "/LiveFS", "tmpfs", 0, NULL); >+ r = asprintf(&dmhelper2, "dd if=/mnt/source/LiveOS/osmin.img of=/LiveFS/osmin.img 2> /dev/null"); >+ rc = system(dmhelper2); >+ >+ rc = mkdir("/LiveFS/squashfs.osmin", 0755); >+ rc = mountLoopback("/LiveFS/osmin.img", "/LiveFS/squashfs.osmin", "/dev/loop3"); >+ rc = mkdir("/LiveFS/squashfs.delta", 0755); >+ >+ rc = system("losetup /dev/loop4 /LiveFS/squashfs.osmin/osmin"); >+ >+ r = asprintf(&dmhelper2, "echo 0 `blockdev --getsize /dev/loop2` snapshot /dev/loop2 /dev/loop4 p 8 | dmsetup create --readonly live-osimg-min"); >+ rc = system(dmhelper2); >+ >+/* rc = system("/tmp/mkosmin3"); get dmc's stuff in here */ >+ >+ r = asprintf(&dmhelper2, "dd if=/dev/null of=/LiveFS/overlay bs=1024 seek=524288 2> /dev/null"); >+ rc = system(dmhelper2); >+ rc = system("losetup /dev/loop5 /LiveFS/overlay"); >+ >+ r = asprintf(&dmhelper2, "echo 0 `blockdev --getsize /dev/loop2` snapshot /dev/loop2 /dev/loop5 p 8 | dmsetup create live-rw"); >+ rc = system(dmhelper2); >+ rc = doPwMount("/dev/mapper/live-rw", "/sysroot", "ext3", 0, NULL); >+ >+ rc = symlink("/dev/mapper/live-rw", "/dev/root"); >+ rc = symlink("/sysroot/usr/sbin/anaconda", "/sysroot/usr/bin/anaconda"); >+ >+ rc = doPwMount("/dev/mapper/live-rw", "/sysroot", "ext3", IMOUNT_RDONLY, NULL); >+ >+ if (rc == 1) { >+ logMessage(INFO, "DM symlink OK"); >+ if (FL_LIVEINIT(flags)) { >+ SetupLive(); >+ } >+ >+/* work here for run livecd */ >+ >+ return 1; >+ >+ } else { >+ logMessage(INFO, "DM symlink failed"); >+ return -1; >+ } >+ return 0; >+} >+ >+ >+static char mountExt3() { >+ int r, rc; >+ char *ext3img; >+ >+ logMessage(INFO, "mountExt3 called"); >+ r = asprintf(&ext3img, "/squashfs/LiveOS/ext3fs.img"); >+ mkdir("/sysroot", 0755); >+ rc = mountLoopback(ext3img, "/sysroot", "/dev/loop2"); >+ umount("/sysroot"); >+ if (rc == -1) { >+ logMessage(INFO, "mounted ext3fs failed"); >+ return -1; >+ } else { >+ logMessage(INFO, "mounted ext3FS at sysroot - unmounting"); >+ umount("/squashfs"); >+ rc = SetupDM(); >+ if (rc == -1) { >+ return -1; >+ wrongCDMessage(); >+ } >+ } >+ return 0; >+} >+ >+static char findSquash() { >+ int r; >+ char *squashimg; >+ if (FL_LIVEFS(flags)) { >+ r = asprintf(&squashimg, "/mnt/source/LiveOS/squashfs.img"); >+ if (!access(squashimg, R_OK)) { >+ logMessage(INFO, "found %s", squashimg); >+ return 1; >+ } else { >+ logMessage(INFO, "Failed to find %s", squashimg); >+ return -1; >+ } >+ } >+ return 0; >+} >+ >+ >+static char mountSquash(char * squashimg) { >+ int rc; >+ >+ logMessage(INFO, "mountSquash called"); >+ mkdir("/squashfs", 0755); >+ rc = mountLoopback(squashimg, "/squashfs", "/dev/loop1"); >+ if (rc == -1) { >+ logMessage(INFO, "mounting squashfs failed"); >+ return -1; >+ } else { >+ logMessage(INFO, "mounting squashfs OK"); >+ logMessage(INFO, "calling mountExt3"); >+ rc = mountExt3(); >+ >+ /* this wasnt the CD we were looking for, clean up and */ >+ /* try the next CD drive */ >+ if (rc == -1) { >+ return -1; >+ umount("/squashfs"); >+ wrongCDMessage(); >+ } >+ } >+ return 0; >+} >+ >+/* set up a cdrom, nominally for installation >+ * >+ * location: where to mount the cdrom at >+ * >+ * loaderData is the kickstart info, can be NULL meaning no info >+ * >+ * side effect: found cdrom is mounted as /mnt/source. ext3fs mounted >+ * as /mnt/runtime. >+ */ >+ >+char * FindLiveImg(char * location) { >+ int i, r, rc; >+ int squashinram = 0; >+ char *squashimg = NULL; >+ char *buf; >+ struct device ** devices; >+ char *cddev = NULL; >+ >+ devices = getDevices(DEVICE_CDROM); >+ >+ if (!devices) { >+ logMessage(ERROR, "got to findLiveCD without a CD device"); >+ return NULL; >+ } >+ >+ /* JKFIXME: ASSERT -- we have a cdrom device when we get here */ >+ do { >+ for (i = 0; devices[i]; i++) { >+ char *tmp = NULL; >+ >+ if (!devices[i]->device) >+ continue; >+ >+ if (strncmp("/dev/", devices[i]->device, 5)) { >+ r = asprintf(&tmp, "/dev/%s", devices[i]->device); >+ free(devices[i]->device); >+ devices[i]->device = tmp; >+ >+ logMessage(INFO,"trying to mount CD device %s on %s", devices[i]->device, location); >+ >+ if (!(rc=doPwMount(devices[i]->device, location, "iso9660", >+ IMOUNT_RDONLY, NULL))) { >+ cddev = devices[i]->device; >+ >+ /* ## JV ## fixme for location */ >+ logMessage(INFO, "find squash"); >+ rc = findSquash(); >+ if (rc == -1) { >+ logMessage(INFO, "find squash failed"); >+ wrongCDMessage(); >+ continue; >+ } else { >+ /* Media Check? */ >+ /* if in run from ram mode copy squashfs into RAM so we */ >+ /* can free up the CD drive and user can have it available */ >+ /* ##### make the flag JV ####*/ >+ squashinram = 0; >+ r = asprintf(&squashimg, "/mnt/source/LiveOS/squashfs.img"); >+ logMessage(INFO, "using squash from cdrom"); >+ >+ if (FL_LIVERAM(flags)) { >+ rc = copyFile("/mnt/source/LiveOS/squashfs.img", "/tmp/squashfs.img"); >+ squashinram = 1; >+ logMessage(INFO, "Copied squash to ram"); >+ r = asprintf(&squashimg, "/tmp/squashfs.img"); >+ } >+ logMessage(INFO, "mounting squash"); >+ /* if in run from ram mode and we copied squash to RAM */ >+ /* we can now unmount the CD */ >+ if (squashinram) { >+ /* umount(location); */ >+ } >+ >+ rc = mountSquash(squashimg); >+ if (rc == -1) { >+ logMessage(INFO, "mount squash failed"); >+ umount(location); >+ wrongCDMessage(); >+ continue; >+ return NULL; >+ } else { >+ r = asprintf(&buf, "livecd://dev/mapper/live-osimg-min"); >+ umount(location); >+ return buf; >+ continue; >+ } >+ } >+ } >+ } >+ } >+ >+ } while (1); >+ >+ return NULL; >+} >+ >+/* look for a CD and mount it. if we have problems, ask */ >+char * mountLiveCD(struct installMethod * method, >+ char * location, struct loaderData_s * loaderData) { >+ >+ >+/*char * mountLiveCD(char * location) { */ >+ >+ >+ return FindLiveImg(location); >+} >+ >+char * mountLiveHD(struct installMethod * method, >+ char * location, struct loaderData_s * loaderData) { >+ >+ return FindLiveImg(location); >+} >+ >+char * findLiveOS(char * location) { >+ int r, rc; >+ char *buf; >+ rc = findSquash(); >+ if (rc == -1) { >+ return NULL; >+ } else { >+ r = asprintf(&buf, "found"); >+ return buf; >+ } >+} > >diff -up ./Makefile.orig ./Makefile >--- ./Makefile.orig 2008-03-01 13:09:43.000000000 -0600 >+++ ./Makefile 2008-03-01 13:10:14.000000000 -0600 >@@ -46,7 +46,7 @@ LIBS += -lresolv -lm > BINS = loader > > HWOBJS = hardware.o >-METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o >+METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o imginstall.o > OBJS = copy.o log.o moduleinfo.o loadermisc.o modules.o windows.o \ > lang.o kbd.o driverdisk.o selinux.o \ > mediacheck.o kickstart.o driverselect.o \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 435142
: 297348