FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Infrastructure

 
 
LinkBack Thread Tools
 
Old 12-02-2009, 08:58 PM
Chris Lumens
 
Default Remove test mode from the loader, too.

All previous comments about test mode being untested apply to loader, but
doubly so.
---
loader/hdinstall.c | 3 -
loader/init.c | 161 ++++++++++++++++++++-------------------------------
loader/lang.c | 8 +--
loader/loader.c | 114 ++++++++++++++++---------------------
loader/loader.h | 3 +-
loader/log.c | 11 +---
loader/log.h | 2 +-
loader/net.c | 58 +++++++++----------
loader/nfsinstall.c | 5 --
loader/shutdown.c | 10 +---
loader/undomounts.c | 14 ++---
loader/urlinstall.c | 5 --
12 files changed, 154 insertions(+), 240 deletions(-)

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index d5b6138..ea39095 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -61,9 +61,6 @@ static char * setupIsoImages(char * device, char * dirName, char * location) {

logMessage(INFO, "mounting device %s for hard drive install", device);

- if (FL_TESTING(flags))
- return NULL;
-
if (doPwMount(device, "/mnt/isodir", "auto", "ro", NULL))
return NULL;

diff --git a/loader/init.c b/loader/init.c
index e3bb9b0..bc2f955 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -111,7 +111,6 @@ char * env[] = {
*
*/

-int testing=0;
void shutDown(int doKill, reboot_action rebootAction);
static int getKillPolicy(void);
struct termios ts;
@@ -134,8 +133,6 @@ static void fatal_error(int usePerror) {
printf("failed.
");

printf("
I can't recover from this.
");
- if (testing)
- exit(0);
#if !defined(__s390__) && !defined(__s390x__)
while (1) ;
#endif
@@ -548,17 +545,9 @@ int main(int argc, char **argv) {
doExit(0);
}

-#if !defined(__s390__) && !defined(__s390x__)
- testing = (getppid() != 0) && (getppid() != 1);
-#endif
-
- if (!testing) {
- /* turn off screen blanking */
- printstr("33[9;0]");
- printstr("33[8]");
- } else {
- printstr("(running in test mode).
");
- }
+ /* turn off screen blanking */
+ printstr("33[9;0]");
+ printstr("33[8]");

umask(022);

@@ -570,65 +559,56 @@ int main(int argc, char **argv) {
printf("anaconda installer init version %s starting
", VERSION);

printf("mounting /proc filesystem... ");
- if (!testing) {
- if (mount("/proc", "/proc", "proc", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/proc", "/proc", "proc", 0, NULL))
+ fatal_error(1);
printf("done
");

printf("creating /dev filesystem... ");
- if (!testing) {
- pid_t childpid;
- if (mount("/dev", "/dev", "tmpfs", 0, NULL))
- fatal_error(1);
- createDevices();
- printf("done
");
- printf("starting udev...");
- if ((childpid = fork()) == 0) {
- execl("/sbin/udevd", "/sbin/udevd", "--daemon", NULL);
- exit(1);
- }
-
- /* wait at least until the udevd process that we forked exits */
- do {
- pid_t retpid;
- int waitstatus;
-
- retpid = waitpid(childpid, &waitstatus, 0);
- if (retpid == -1) {
- if (errno == EINTR)
- continue;
- /* if the child exited before we called waitpid, we can get
- * ECHILD without anything really being wrong; we just lost
- * the race.*/
- if (errno == ECHILD)
- break;
- printf("init: error waiting on udevd: %m
");
- exit(1);
- } else if (WIFEXITED(waitstatus)) {
+ if (mount("/dev", "/dev", "tmpfs", 0, NULL))
+ fatal_error(1);
+ createDevices();
+ printf("done
");
+ printf("starting udev...");
+ if ((childpid = fork()) == 0) {
+ execl("/sbin/udevd", "/sbin/udevd", "--daemon", NULL);
+ exit(1);
+ }
+
+ /* wait at least until the udevd process that we forked exits */
+ do {
+ pid_t retpid;
+ int waitstatus;
+
+ retpid = waitpid(childpid, &waitstatus, 0);
+ if (retpid == -1) {
+ if (errno == EINTR)
+ continue;
+ /* if the child exited before we called waitpid, we can get
+ * ECHILD without anything really being wrong; we just lost
+ * the race.*/
+ if (errno == ECHILD)
break;
- }
- } while (1);
-
- if (fork() == 0) {
- execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
+ printf("init: error waiting on udevd: %m
");
exit(1);
+ } else if (WIFEXITED(waitstatus)) {
+ break;
}
+ } while (1);
+
+ if (fork() == 0) {
+ execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
+ exit(1);
}
printf("done
");

printf("mounting /dev/pts (unix98 pty) filesystem... ");
- if (!testing) {
- if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
+ fatal_error(1);
printf("done
");

printf("mounting /sys filesystem... ");
- if (!testing) {
- if (mount("/sys", "/sys", "sysfs", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/sys", "/sys", "sysfs", 0, NULL))
+ fatal_error(1);
printf("done
");

/* these args are only for testing from commandline */
@@ -725,9 +705,6 @@ int main(int argc, char **argv) {
}
}

- if (testing)
- doExit(0);
-
setsid();
if (ioctl(0, TIOCSCTTY, NULL)) {
printf("could not set new controlling tty
");
@@ -757,13 +734,11 @@ int main(int argc, char **argv) {
tcsetattr(0, TCSANOW, &ts);
}

- if (!testing) {
- int ret;
- ret = sethostname("localhost.localdomain", 21);
- /* the default domainname (as of 2.0.35) is "(none)", which confuses
- glibc */
- ret = setdomainname("", 0);
- }
+ int ret;
+ ret = sethostname("localhost.localdomain", 21);
+ /* the default domainname (as of 2.0.35) is "(none)", which confuses
+ glibc */
+ ret = setdomainname("", 0);

printf("trying to remount root filesystem read write... ");
if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) {
@@ -774,24 +749,20 @@ int main(int argc, char **argv) {
/* we want our /tmp to be tmpfs, 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);
+ rename("/tmp", "/oldtmp");
+ mkdir("/tmp", 0755);

- printf("mounting /tmp as tmpfs... ");
- if (mount("none", "/tmp", "tmpfs", 0, NULL))
- fatal_error(1);
- printf("done
");
+ printf("mounting /tmp as tmpfs... ");
+ if (mount("none", "/tmp", "tmpfs", 0, NULL))
+ fatal_error(1);
+ printf("done
");

- copyDirectory("/oldtmp", "/tmp", copyErrorFn, copyErrorFn);
- unlink("/oldtmp");
- }
+ 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");
+ doklog("/dev/tty4");

/* write out a pid file */
if ((fd = open("/var/run/init.pid", O_WRONLY|O_CREAT, 0644)) > 0) {
@@ -808,20 +779,18 @@ int main(int argc, char **argv) {
}

/* D-Bus */
- if (!testing) {
- if (fork() == 0) {
- execl("/sbin/dbus-uuidgen", "/sbin/dbus-uuidgen", "--ensure", NULL);
- doExit(1);
- }
-
- if (fork() == 0) {
- execl("/sbin/dbus-daemon", "/sbin/dbus-daemon", "--system", NULL);
- doExit(1);
- }
+ if (fork() == 0) {
+ execl("/sbin/dbus-uuidgen", "/sbin/dbus-uuidgen", "--ensure", NULL);
+ doExit(1);
+ }

- sleep(2);
+ if (fork() == 0) {
+ execl("/sbin/dbus-daemon", "/sbin/dbus-daemon", "--system", NULL);
+ doExit(1);
}

+ sleep(2);
+
/* Go into normal init mode - keep going, and then do a orderly shutdown
when:

@@ -874,6 +843,7 @@ int main(int argc, char **argv) {
}

while (!doShutdown) {
+ pid_t childpid;
childpid = waitpid(-1, &waitStatus, 0);

if (childpid == installpid)
@@ -892,9 +862,6 @@ int main(int argc, char **argv) {
doReboot = 1;
}

- if (testing)
- doExit(0);
-
shutDown(doKill, doReboot?REBOOT:HALT);

return 0;
diff --git a/loader/lang.c b/loader/lang.c
index 390df2e..fe2e8b7 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -101,8 +101,7 @@ static struct langInfo * languages = NULL;
static int numLanguages = 0;

static void loadLanguageList(void) {
- char * file = FL_TESTING(flags) ? "../lang-table" :
- "/etc/lang-table";
+ char * file = "/etc/lang-table";
FILE * f;
char line[256];
char name[256], key[256], font[256], code[256],
@@ -159,10 +158,7 @@ void loadLanguage (char * file) {

if (!file) {
file = filename;
- if (FL_TESTING(flags))
- sprintf(filename, "loader.tr");
- else
- sprintf(filename, "/etc/loader.tr");
+ sprintf(filename, "/etc/loader.tr");
}

stream = gunzip_open(file);
diff --git a/loader/loader.c b/loader/loader.c
index cd3e178..4ef03b5 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -231,9 +231,7 @@ void startNewt(void) {
newtPushHelpLine(_(" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen "));

newtRunning = 1;
- if (FL_TESTING(flags))
- newtSetSuspendCallback((void *) doSuspend, NULL);
- else if (!access("/bin/sh", X_OK))
+ if (!access("/bin/sh", X_OK))
newtSetSuspendCallback((void *) doShell, NULL);
}
}
@@ -326,8 +324,7 @@ void initializeConsole() {
fflush(stdout);

isysLoadFont();
- if (!FL_TESTING(flags))
- isysSetUnicodeKeymap();
+ isysSetUnicodeKeymap();
}

/* fbcon is buggy and resets our color palette if we allocate a terminal
@@ -1098,8 +1095,7 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
/* particular options. */
/* do vncpassword case first */
if (!strncasecmp(argv[i], "vncpassword=", 12)) {
- if (!FL_TESTING(flags))
- writeVNCPasswordFile("/tmp/vncpassword.dat", argv[i]+12);
+ writeVNCPasswordFile("/tmp/vncpassword.dat", argv[i]+12);
}
else if (!strncasecmp(argv[i], "resolution=", 11) ||
!strncasecmp(argv[i], "nomount", 7) ||
@@ -1766,7 +1762,7 @@ static void add_to_path_env(const char *env, const char *val)
}

int main(int argc, char ** argv) {
- int rc;
+ int rc, ret, pid, status;

struct stat sb;
struct serial_struct si;
@@ -1784,17 +1780,16 @@ int main(int argc, char ** argv) {

struct loaderData_s loaderData;

- char *path;
+ char *path, *fmt;

gchar *cmdLine = NULL, *ksFile = NULL, *virtpcon = NULL;
- gboolean testing = FALSE, mediacheck = FALSE;
+ gboolean mediacheck = FALSE;
gchar **remaining = NULL;
GOptionContext *optCon = g_option_context_new(NULL);
GError *optErr = NULL;
GOptionEntry optionTable[] = {
{ "cmdline", 0, 0, G_OPTION_ARG_STRING, &cmdLine, NULL, NULL },
{ "ksfile", 0, 0, G_OPTION_ARG_STRING, &ksFile, NULL, NULL },
- { "test", 0, 0, G_OPTION_ARG_NONE, &testing, NULL, NULL },
{ "mediacheck", 0, 0, G_OPTION_ARG_NONE, &mediacheck, NULL, NULL },
{ "virtpconsole", 0, 0, G_OPTION_ARG_STRING, &virtpcon, NULL, NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining,
@@ -1849,7 +1844,7 @@ int main(int argc, char ** argv) {

g_strfreev(remaining);

- if (!testing && !access("/var/run/loader.run", R_OK)) {
+ if (!access("/var/run/loader.run", R_OK)) {
printf(_("loader has already been run. Starting shell.
"));
execl("/bin/sh", "-/bin/sh", NULL);
doExit(0);
@@ -1869,7 +1864,6 @@ int main(int argc, char ** argv) {
flags |= LOADER_FLAGS_SERIAL;
}

- if (testing) flags |= LOADER_FLAGS_TESTING;
if (mediacheck) flags |= LOADER_FLAGS_MEDIACHECK;
if (ksFile) flags |= LOADER_FLAGS_KICKSTART;
if (virtpcon) flags |= LOADER_FLAGS_VIRTPCONSOLE;
@@ -1882,9 +1876,8 @@ int main(int argc, char ** argv) {
flags |= LOADER_FLAGS_NOSHELL;
#endif

- openLog(FL_TESTING(flags));
- if (!FL_TESTING(flags))
- openlog("loader", 0, LOG_LOCAL0);
+ openLog();
+ openlog("loader", 0, LOG_LOCAL0);

memset(&loaderData, 0, sizeof(loaderData));
loaderData.method = -1;
@@ -1905,7 +1898,7 @@ int main(int argc, char ** argv) {
set_fw_search_path(&loaderData, "/firmware:/lib/firmware");
start_fw_loader(&loaderData);

- arg = FL_TESTING(flags) ? "./module-info" : "/lib/modules/module-info";
+ arg = "/lib/modules/module-info";
modInfo = newModuleInfoSet();
if (readModuleInfo(arg, modInfo, NULL, 0)) {
fprintf(stderr, "failed to read %s
", arg);
@@ -2016,17 +2009,13 @@ int main(int argc, char ** argv) {

url = doLoaderMain(&loaderData, modInfo);

- if (!FL_TESTING(flags)) {
- int ret;
-
- /* 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", NULL, copyErrorFn);
- copyDirectory("/mnt/runtime/var","/var", NULL, copyErrorFn);
- }
+ /* 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", NULL, copyErrorFn);
+ copyDirectory("/mnt/runtime/var","/var", NULL, copyErrorFn);

/* now load SELinux policy before exec'ing anaconda and the shell
* (if we're using SELinux) */
@@ -2251,54 +2240,49 @@ int main(int argc, char ** argv) {

stopNewt();
closeLog();
-
- if (!FL_TESTING(flags)) {
- int pid, status, rc;
- char *fmt;

- if (FL_RESCUE(flags)) {
- fmt = _("Running anaconda %s, the %s rescue mode - please wait.
");
- } else {
- fmt = _("Running anaconda %s, the %s system installer - please wait.
");
- }
- printf(fmt, VERSION, getProductName());
+ if (FL_RESCUE(flags)) {
+ fmt = _("Running anaconda %s, the %s rescue mode - please wait.
");
+ } else {
+ fmt = _("Running anaconda %s, the %s system installer - please wait.
");
+ }
+ printf(fmt, VERSION, getProductName());

- if (!(pid = fork())) {
- if (execv(anacondaArgs[0], anacondaArgs) == -1) {
- fprintf(stderr,"exec of anaconda failed: %m
");
- doExit(1);
- }
+ if (!(pid = fork())) {
+ if (execv(anacondaArgs[0], anacondaArgs) == -1) {
+ fprintf(stderr,"exec of anaconda failed: %m
");
+ doExit(1);
}
+ }

- waitpid(pid, &status, 0);
+ waitpid(pid, &status, 0);

- if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status))) {
- rc = 1;
- } else {
- rc = 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: %m
");
- doExit(1);
- }
+ 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: %m
");
+ doExit(1);
}
- waitpid(pid, &status, 0);
}
+ waitpid(pid, &status, 0);
+ }

- stop_fw_loader(&loaderData);
+ stop_fw_loader(&loaderData);
#if defined(__s390__) || defined(__s390x__)
- /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
- logMessage(INFO, "Sending signal %d to process %d
",
- init_sig, init_pid);
- kill(init_pid, init_sig);
+ /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
+ logMessage(INFO, "Sending signal %d to process %d
",
+ init_sig, init_pid);
+ kill(init_pid, init_sig);
#endif
- doExit(rc);
- }
+ doExit(rc);

doExit(1);
}
diff --git a/loader/loader.h b/loader/loader.h
index ebf3766..d47009d 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -27,7 +27,7 @@
#define LOADER_NOOP 2
#define LOADER_ERROR -1

-#define LOADER_FLAGS_TESTING (((uint64_t) 1) << 0)
+/* #0 unused */
/* #1 unused */
#define LOADER_FLAGS_TEXT (((uint64_t) 1) << 2)
#define LOADER_FLAGS_RESCUE (((uint64_t) 1) << 3)
@@ -71,7 +71,6 @@
#define LOADER_FLAGS_NOKILL (((uint64_t) 1) << 38)
#define LOADER_FLAGS_KICKSTART_SEND_SERIAL (((uint64_t) 1) << 39)

-#define FL_TESTING(a) ((a) & LOADER_FLAGS_TESTING)
#define FL_TEXT(a) ((a) & LOADER_FLAGS_TEXT)
#define FL_RESCUE(a) ((a) & LOADER_FLAGS_RESCUE)
#define FL_KICKSTART(a) ((a) & LOADER_FLAGS_KICKSTART)
diff --git a/loader/log.c b/loader/log.c
index 2872fe8..52747e3 100644
--- a/loader/log.c
+++ b/loader/log.c
@@ -110,16 +110,11 @@ void logMessage(int level, const char * s, ...) {
int tty_logfd = -1;
int file_logfd = -1;

-void openLog(int useLocal) {
+void openLog() {
int flags;

- if (!useLocal) {
- tty_logfile = fopen("/dev/tty3", "w");
- file_logfile = fopen("/tmp/anaconda.log", "w");
- } else {
- tty_logfile = NULL;
- file_logfile = fopen("debug.log", "w");
- }
+ tty_logfile = fopen("/dev/tty3", "w");
+ file_logfile = fopen("/tmp/anaconda.log", "w");

if (tty_logfile) {
tty_logfd = fileno(tty_logfile);
diff --git a/loader/log.h b/loader/log.h
index 78eb44d..183c0b2 100644
--- a/loader/log.h
+++ b/loader/log.h
@@ -33,7 +33,7 @@ void logMessageV(int level, const char * s, va_list ap)
__attribute__ ((format (printf, 2, 0)));
void logMessage(int level, const char * s, ...)
__attribute__ ((format (printf, 2, 3)));
-void openLog(int useLocal);
+void openLog();
void closeLog(void);
void setLogLevel(int minLevel);
int getLogLevel(void);
diff --git a/loader/net.c b/loader/net.c
index 43de50f..3049fbc 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -444,7 +444,7 @@ int readNetConfig(char * device, iface_t * iface,

/* JKFIXME: we really need a way to override this and be able to change
* our network config */
- if (!FL_TESTING(flags) && !FL_ASKNETWORK(flags) &&
+ if (!FL_ASKNETWORK(flags) &&
((iface->ipv4method > IPV4_UNUSED_METHOD) ||
(iface->ipv6method > IPV4_UNUSED_METHOD))) {
logMessage(INFO, "doing kickstart... setting it up");
@@ -510,27 +510,25 @@ int readNetConfig(char * device, iface_t * iface,
}

/* bring up the interface */
- if (!FL_TESTING(flags)) {
- err = writeEnabledNetInfo(iface);
- if (err) {
- logMessage(ERROR, "failed to write %s data for %s (%d)",
- SYSCONFIG_PATH, iface->device, err);
- iface->ipv4method = IPV4_UNUSED_METHOD;
- iface->ipv6method = IPV6_UNUSED_METHOD;
- return LOADER_BACK;
- }
+ err = writeEnabledNetInfo(iface);
+ if (err) {
+ logMessage(ERROR, "failed to write %s data for %s (%d)",
+ SYSCONFIG_PATH, iface->device, err);
+ iface->ipv4method = IPV4_UNUSED_METHOD;
+ iface->ipv6method = IPV6_UNUSED_METHOD;
+ return LOADER_BACK;
+ }

- i = get_connection(iface);
- newtPopWindow();
+ i = get_connection(iface);
+ newtPopWindow();

- if (i > 0) {
- newtWinMessage(_("Network Error"), _("Retry"),
- _("There was an error configuring your network "
- "interface."));
- iface->ipv4method = IPV4_UNUSED_METHOD;
- iface->ipv6method = IPV6_UNUSED_METHOD;
- return LOADER_ERROR;
- }
+ if (i > 0) {
+ newtWinMessage(_("Network Error"), _("Retry"),
+ _("There was an error configuring your network "
+ "interface."));
+ iface->ipv4method = IPV4_UNUSED_METHOD;
+ iface->ipv6method = IPV6_UNUSED_METHOD;
+ return LOADER_ERROR;
}

return LOADER_OK;
@@ -1984,19 +1982,17 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
break;
}

- if (!FL_TESTING(flags)) {
- err = writeEnabledNetInfo(iface);
- if (err) {
- logMessage(ERROR,
- "failed to write %s data for %s (%d)",
- SYSCONFIG_PATH, iface->device, err);
- return -1;
- }
-
- err = get_connection(iface);
- newtPopWindow();
+ err = writeEnabledNetInfo(iface);
+ if (err) {
+ logMessage(ERROR,
+ "failed to write %s data for %s (%d)",
+ SYSCONFIG_PATH, iface->device, err);
+ return -1;
}

+ err = get_connection(iface);
+ newtPopWindow();
+
if (err) {
logMessage(ERROR, "failed to start NetworkManager (%d)", err);
return -1;
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 420ea06..de1ce29 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -249,11 +249,6 @@ char * mountNfsImage(struct installMethod * method,
directory);
logMessage(INFO, "mounting nfs path %s", fullPath);

- if (FL_TESTING(flags)) {
- stage = NFS_STAGE_DONE;
- break;
- }
-
stage = NFS_STAGE_NFS;

if (!doPwMount(fullPath, "/mnt/stage2", "nfs", mountOpts, NULL)) {
diff --git a/loader/shutdown.c b/loader/shutdown.c
index c733f86..8f2c55e 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -32,17 +32,11 @@

#include "init.h"

-#ifdef AS_SHUTDOWN
-int testing = 0;
-#else
-extern int testing;
-#endif
-
void disableSwap(void);
void unmountFilesystems(void);

static void performTerminations(int doKill) {
- if (testing || !doKill)
+ if (!doKill)
return;

sync();
@@ -60,7 +54,7 @@ static void performTerminations(int doKill) {
static void performUnmounts(int doKill) {
int ignore;

- if (testing || !doKill)
+ if (!doKill)
return;

printf("disabling swap...
");
diff --git a/loader/undomounts.c b/loader/undomounts.c
index 31a98bb..af5caaa 100644
--- a/loader/undomounts.c
+++ b/loader/undomounts.c
@@ -49,8 +49,6 @@ struct unmountInfo {
enum { FS, LOOP } what;
} ;

-extern int testing;
-
void undoLoop(struct unmountInfo * fs, int numFs, int this);

static void printstr(char * string) {
@@ -80,12 +78,10 @@ void undoMount(struct unmountInfo * fs, int numFs, int this) {

printf(" %s", fs[this].name);
/* don't need to unmount /tmp. it is busy anyway. */
- if (!testing) {
- if (umount2(fs[this].name, MNT_DETACH) < 0) {
- printf(" umount failed (%d)", errno);
- } else {
- printf(" done");
- }
+ if (umount2(fs[this].name, MNT_DETACH) < 0) {
+ printf(" umount failed (%d)", errno);
+ } else {
+ printf(" done");
}
printf("
");
}
@@ -115,7 +111,7 @@ void undoLoop(struct unmountInfo * fs, int numFs, int this) {
if ((fd = open("/tmp/loop", O_RDONLY, 0)) < 0) {
printf(" failed to open device: %d", errno);
} else {
- if (!testing && ioctl(fd, LOOP_CLR_FD, 0))
+ if (ioctl(fd, LOOP_CLR_FD, 0))
printf(" LOOP_CLR_FD failed: %d", errno);
close(fd);
}
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 519d08c..9148c33 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -290,11 +290,6 @@ char *mountUrlImage(struct installMethod *method, char *location,
}

case URL_STAGE_FETCH: {
- if (FL_TESTING(flags)) {
- stage = URL_STAGE_DONE;
- break;
- }
-
if (loadUrlImages(loaderData, &ui)) {
stage = URL_STAGE_MAIN;

--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 12-03-2009, 06:54 AM
Hans de Goede
 
Default Remove test mode from the loader, too.

Ack.

On 12/02/2009 10:58 PM, Chris Lumens wrote:

All previous comments about test mode being untested apply to loader, but
doubly so.
---
loader/hdinstall.c | 3 -
loader/init.c | 161 ++++++++++++++++++++-------------------------------
loader/lang.c | 8 +--
loader/loader.c | 114 ++++++++++++++++---------------------
loader/loader.h | 3 +-
loader/log.c | 11 +---
loader/log.h | 2 +-
loader/net.c | 58 +++++++++----------
loader/nfsinstall.c | 5 --
loader/shutdown.c | 10 +---
loader/undomounts.c | 14 ++---
loader/urlinstall.c | 5 --
12 files changed, 154 insertions(+), 240 deletions(-)

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index d5b6138..ea39095 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -61,9 +61,6 @@ static char * setupIsoImages(char * device, char * dirName, char * location) {

logMessage(INFO, "mounting device %s for hard drive install", device);

- if (FL_TESTING(flags))
- return NULL;
-
if (doPwMount(device, "/mnt/isodir", "auto", "ro", NULL))
return NULL;

diff --git a/loader/init.c b/loader/init.c
index e3bb9b0..bc2f955 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -111,7 +111,6 @@ char * env[] = {
*
*/

-int testing=0;
void shutDown(int doKill, reboot_action rebootAction);
static int getKillPolicy(void);
struct termios ts;
@@ -134,8 +133,6 @@ static void fatal_error(int usePerror) {
printf("failed.
");

printf("
I can't recover from this.
");
- if (testing)
- exit(0);
#if !defined(__s390__)&& !defined(__s390x__)
while (1) ;
#endif
@@ -548,17 +545,9 @@ int main(int argc, char **argv) {
doExit(0);
}

-#if !defined(__s390__)&& !defined(__s390x__)
- testing = (getppid() != 0)&& (getppid() != 1);
-#endif
-
- if (!testing) {
- /* turn off screen blanking */
- printstr("33[9;0]");
- printstr("33[8]");
- } else {
- printstr("(running in test mode).
");
- }
+ /* turn off screen blanking */
+ printstr("33[9;0]");
+ printstr("33[8]");

umask(022);

@@ -570,65 +559,56 @@ int main(int argc, char **argv) {
printf("anaconda installer init version %s starting
", VERSION);

printf("mounting /proc filesystem... ");
- if (!testing) {
- if (mount("/proc", "/proc", "proc", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/proc", "/proc", "proc", 0, NULL))
+ fatal_error(1);
printf("done
");

printf("creating /dev filesystem... ");
- if (!testing) {
- pid_t childpid;
- if (mount("/dev", "/dev", "tmpfs", 0, NULL))
- fatal_error(1);
- createDevices();
- printf("done
");
- printf("starting udev...");
- if ((childpid = fork()) == 0) {
- execl("/sbin/udevd", "/sbin/udevd", "--daemon", NULL);
- exit(1);
- }
-
- /* wait at least until the udevd process that we forked exits */
- do {
- pid_t retpid;
- int waitstatus;
-
- retpid = waitpid(childpid,&waitstatus, 0);
- if (retpid == -1) {
- if (errno == EINTR)
- continue;
- /* if the child exited before we called waitpid, we can get
- * ECHILD without anything really being wrong; we just lost
- * the race.*/
- if (errno == ECHILD)
- break;
- printf("init: error waiting on udevd: %m
");
- exit(1);
- } else if (WIFEXITED(waitstatus)) {
+ if (mount("/dev", "/dev", "tmpfs", 0, NULL))
+ fatal_error(1);
+ createDevices();
+ printf("done
");
+ printf("starting udev...");
+ if ((childpid = fork()) == 0) {
+ execl("/sbin/udevd", "/sbin/udevd", "--daemon", NULL);
+ exit(1);
+ }
+
+ /* wait at least until the udevd process that we forked exits */
+ do {
+ pid_t retpid;
+ int waitstatus;
+
+ retpid = waitpid(childpid,&waitstatus, 0);
+ if (retpid == -1) {
+ if (errno == EINTR)
+ continue;
+ /* if the child exited before we called waitpid, we can get
+ * ECHILD without anything really being wrong; we just lost
+ * the race.*/
+ if (errno == ECHILD)
break;
- }
- } while (1);
-
- if (fork() == 0) {
- execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
+ printf("init: error waiting on udevd: %m
");
exit(1);
+ } else if (WIFEXITED(waitstatus)) {
+ break;
}
+ } while (1);
+
+ if (fork() == 0) {
+ execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
+ exit(1);
}
printf("done
");

printf("mounting /dev/pts (unix98 pty) filesystem... ");
- if (!testing) {
- if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
+ fatal_error(1);
printf("done
");

printf("mounting /sys filesystem... ");
- if (!testing) {
- if (mount("/sys", "/sys", "sysfs", 0, NULL))
- fatal_error(1);
- }
+ if (mount("/sys", "/sys", "sysfs", 0, NULL))
+ fatal_error(1);
printf("done
");

/* these args are only for testing from commandline */
@@ -725,9 +705,6 @@ int main(int argc, char **argv) {
}
}

- if (testing)
- doExit(0);
-
setsid();
if (ioctl(0, TIOCSCTTY, NULL)) {
printf("could not set new controlling tty
");
@@ -757,13 +734,11 @@ int main(int argc, char **argv) {
tcsetattr(0, TCSANOW,&ts);
}

- if (!testing) {
- int ret;
- ret = sethostname("localhost.localdomain", 21);
- /* the default domainname (as of 2.0.35) is "(none)", which confuses
- glibc */
- ret = setdomainname("", 0);
- }
+ int ret;
+ ret = sethostname("localhost.localdomain", 21);
+ /* the default domainname (as of 2.0.35) is "(none)", which confuses
+ glibc */
+ ret = setdomainname("", 0);

printf("trying to remount root filesystem read write... ");
if (mount("/", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, NULL)) {
@@ -774,24 +749,20 @@ int main(int argc, char **argv) {
/* we want our /tmp to be tmpfs, 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);
+ rename("/tmp", "/oldtmp");
+ mkdir("/tmp", 0755);

- printf("mounting /tmp as tmpfs... ");
- if (mount("none", "/tmp", "tmpfs", 0, NULL))
- fatal_error(1);
- printf("done
");
+ printf("mounting /tmp as tmpfs... ");
+ if (mount("none", "/tmp", "tmpfs", 0, NULL))
+ fatal_error(1);
+ printf("done
");

- copyDirectory("/oldtmp", "/tmp", copyErrorFn, copyErrorFn);
- unlink("/oldtmp");
- }
+ 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");
+ doklog("/dev/tty4");

/* write out a pid file */
if ((fd = open("/var/run/init.pid", O_WRONLY|O_CREAT, 0644))> 0) {
@@ -808,20 +779,18 @@ int main(int argc, char **argv) {
}

/* D-Bus */
- if (!testing) {
- if (fork() == 0) {
- execl("/sbin/dbus-uuidgen", "/sbin/dbus-uuidgen", "--ensure", NULL);
- doExit(1);
- }
-
- if (fork() == 0) {
- execl("/sbin/dbus-daemon", "/sbin/dbus-daemon", "--system", NULL);
- doExit(1);
- }
+ if (fork() == 0) {
+ execl("/sbin/dbus-uuidgen", "/sbin/dbus-uuidgen", "--ensure", NULL);
+ doExit(1);
+ }

- sleep(2);
+ if (fork() == 0) {
+ execl("/sbin/dbus-daemon", "/sbin/dbus-daemon", "--system", NULL);
+ doExit(1);
}

+ sleep(2);
+
/* Go into normal init mode - keep going, and then do a orderly shutdown
when:

@@ -874,6 +843,7 @@ int main(int argc, char **argv) {
}

while (!doShutdown) {
+ pid_t childpid;
childpid = waitpid(-1,&waitStatus, 0);

if (childpid == installpid)
@@ -892,9 +862,6 @@ int main(int argc, char **argv) {
doReboot = 1;
}

- if (testing)
- doExit(0);
-
shutDown(doKill, doReboot?REBOOT:HALT);

return 0;
diff --git a/loader/lang.c b/loader/lang.c
index 390df2e..fe2e8b7 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -101,8 +101,7 @@ static struct langInfo * languages = NULL;
static int numLanguages = 0;

static void loadLanguageList(void) {
- char * file = FL_TESTING(flags) ? "../lang-table" :
- "/etc/lang-table";
+ char * file = "/etc/lang-table";
FILE * f;
char line[256];
char name[256], key[256], font[256], code[256],
@@ -159,10 +158,7 @@ void loadLanguage (char * file) {

if (!file) {
file = filename;
- if (FL_TESTING(flags))
- sprintf(filename, "loader.tr");
- else
- sprintf(filename, "/etc/loader.tr");
+ sprintf(filename, "/etc/loader.tr");
}

stream = gunzip_open(file);
diff --git a/loader/loader.c b/loader/loader.c
index cd3e178..4ef03b5 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -231,9 +231,7 @@ void startNewt(void) {
newtPushHelpLine(_("<Tab>/<Alt-Tab> between elements |<Space> selects |<F12> next screen "));

newtRunning = 1;
- if (FL_TESTING(flags))
- newtSetSuspendCallback((void *) doSuspend, NULL);
- else if (!access("/bin/sh", X_OK))
+ if (!access("/bin/sh", X_OK))
newtSetSuspendCallback((void *) doShell, NULL);
}
}
@@ -326,8 +324,7 @@ void initializeConsole() {
fflush(stdout);

isysLoadFont();
- if (!FL_TESTING(flags))
- isysSetUnicodeKeymap();
+ isysSetUnicodeKeymap();
}

/* fbcon is buggy and resets our color palette if we allocate a terminal
@@ -1098,8 +1095,7 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
/* particular options. */
/* do vncpassword case first */
if (!strncasecmp(argv[i], "vncpassword=", 12)) {
- if (!FL_TESTING(flags))
- writeVNCPasswordFile("/tmp/vncpassword.dat", argv[i]+12);
+ writeVNCPasswordFile("/tmp/vncpassword.dat", argv[i]+12);
}
else if (!strncasecmp(argv[i], "resolution=", 11) ||
!strncasecmp(argv[i], "nomount", 7) ||
@@ -1766,7 +1762,7 @@ static void add_to_path_env(const char *env, const char *val)
}

int main(int argc, char ** argv) {
- int rc;
+ int rc, ret, pid, status;

struct stat sb;
struct serial_struct si;
@@ -1784,17 +1780,16 @@ int main(int argc, char ** argv) {

struct loaderData_s loaderData;

- char *path;
+ char *path, *fmt;

gchar *cmdLine = NULL, *ksFile = NULL, *virtpcon = NULL;
- gboolean testing = FALSE, mediacheck = FALSE;
+ gboolean mediacheck = FALSE;
gchar **remaining = NULL;
GOptionContext *optCon = g_option_context_new(NULL);
GError *optErr = NULL;
GOptionEntry optionTable[] = {
{ "cmdline", 0, 0, G_OPTION_ARG_STRING,&cmdLine, NULL, NULL },
{ "ksfile", 0, 0, G_OPTION_ARG_STRING,&ksFile, NULL, NULL },
- { "test", 0, 0, G_OPTION_ARG_NONE,&testing, NULL, NULL },
{ "mediacheck", 0, 0, G_OPTION_ARG_NONE,&mediacheck, NULL, NULL },
{ "virtpconsole", 0, 0, G_OPTION_ARG_STRING,&virtpcon, NULL, NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY,&remaining,
@@ -1849,7 +1844,7 @@ int main(int argc, char ** argv) {

g_strfreev(remaining);

- if (!testing&& !access("/var/run/loader.run", R_OK)) {
+ if (!access("/var/run/loader.run", R_OK)) {
printf(_("loader has already been run. Starting shell.
"));
execl("/bin/sh", "-/bin/sh", NULL);
doExit(0);
@@ -1869,7 +1864,6 @@ int main(int argc, char ** argv) {
flags |= LOADER_FLAGS_SERIAL;
}

- if (testing) flags |= LOADER_FLAGS_TESTING;
if (mediacheck) flags |= LOADER_FLAGS_MEDIACHECK;
if (ksFile) flags |= LOADER_FLAGS_KICKSTART;
if (virtpcon) flags |= LOADER_FLAGS_VIRTPCONSOLE;
@@ -1882,9 +1876,8 @@ int main(int argc, char ** argv) {
flags |= LOADER_FLAGS_NOSHELL;
#endif

- openLog(FL_TESTING(flags));
- if (!FL_TESTING(flags))
- openlog("loader", 0, LOG_LOCAL0);
+ openLog();
+ openlog("loader", 0, LOG_LOCAL0);

memset(&loaderData, 0, sizeof(loaderData));
loaderData.method = -1;
@@ -1905,7 +1898,7 @@ int main(int argc, char ** argv) {
set_fw_search_path(&loaderData, "/firmware:/lib/firmware");
start_fw_loader(&loaderData);

- arg = FL_TESTING(flags) ? "./module-info" : "/lib/modules/module-info";
+ arg = "/lib/modules/module-info";
modInfo = newModuleInfoSet();
if (readModuleInfo(arg, modInfo, NULL, 0)) {
fprintf(stderr, "failed to read %s
", arg);
@@ -2016,17 +2009,13 @@ int main(int argc, char ** argv) {

url = doLoaderMain(&loaderData, modInfo);

- if (!FL_TESTING(flags)) {
- int ret;
-
- /* 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", NULL, copyErrorFn);
- copyDirectory("/mnt/runtime/var","/var", NULL, copyErrorFn);
- }
+ /* 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", NULL, copyErrorFn);
+ copyDirectory("/mnt/runtime/var","/var", NULL, copyErrorFn);

/* now load SELinux policy before exec'ing anaconda and the shell
* (if we're using SELinux) */
@@ -2251,54 +2240,49 @@ int main(int argc, char ** argv) {

stopNewt();
closeLog();
-
- if (!FL_TESTING(flags)) {
- int pid, status, rc;
- char *fmt;

- if (FL_RESCUE(flags)) {
- fmt = _("Running anaconda %s, the %s rescue mode - please wait.
");
- } else {
- fmt = _("Running anaconda %s, the %s system installer - please wait.
");
- }
- printf(fmt, VERSION, getProductName());
+ if (FL_RESCUE(flags)) {
+ fmt = _("Running anaconda %s, the %s rescue mode - please wait.
");
+ } else {
+ fmt = _("Running anaconda %s, the %s system installer - please wait.
");
+ }
+ printf(fmt, VERSION, getProductName());

- if (!(pid = fork())) {
- if (execv(anacondaArgs[0], anacondaArgs) == -1) {
- fprintf(stderr,"exec of anaconda failed: %m
");
- doExit(1);
- }
+ if (!(pid = fork())) {
+ if (execv(anacondaArgs[0], anacondaArgs) == -1) {
+ fprintf(stderr,"exec of anaconda failed: %m
");
+ doExit(1);
}
+ }

- waitpid(pid,&status, 0);
+ waitpid(pid,&status, 0);

- if (!WIFEXITED(status) || (WIFEXITED(status)&& WEXITSTATUS(status))) {
- rc = 1;
- } else {
- rc = 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: %m
");
- doExit(1);
- }
+ 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: %m
");
+ doExit(1);
}
- waitpid(pid,&status, 0);
}
+ waitpid(pid,&status, 0);
+ }

- stop_fw_loader(&loaderData);
+ stop_fw_loader(&loaderData);
#if defined(__s390__) || defined(__s390x__)
- /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
- logMessage(INFO, "Sending signal %d to process %d
",
- init_sig, init_pid);
- kill(init_pid, init_sig);
+ /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
+ logMessage(INFO, "Sending signal %d to process %d
",
+ init_sig, init_pid);
+ kill(init_pid, init_sig);
#endif
- doExit(rc);
- }
+ doExit(rc);

doExit(1);
}
diff --git a/loader/loader.h b/loader/loader.h
index ebf3766..d47009d 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -27,7 +27,7 @@
#define LOADER_NOOP 2
#define LOADER_ERROR -1

-#define LOADER_FLAGS_TESTING (((uint64_t) 1)<< 0)
+/* #0 unused */
/* #1 unused */
#define LOADER_FLAGS_TEXT (((uint64_t) 1)<< 2)
#define LOADER_FLAGS_RESCUE (((uint64_t) 1)<< 3)
@@ -71,7 +71,6 @@
#define LOADER_FLAGS_NOKILL (((uint64_t) 1)<< 38)
#define LOADER_FLAGS_KICKSTART_SEND_SERIAL (((uint64_t) 1)<< 39)

-#define FL_TESTING(a) ((a)& LOADER_FLAGS_TESTING)
#define FL_TEXT(a) ((a)& LOADER_FLAGS_TEXT)
#define FL_RESCUE(a) ((a)& LOADER_FLAGS_RESCUE)
#define FL_KICKSTART(a) ((a)& LOADER_FLAGS_KICKSTART)
diff --git a/loader/log.c b/loader/log.c
index 2872fe8..52747e3 100644
--- a/loader/log.c
+++ b/loader/log.c
@@ -110,16 +110,11 @@ void logMessage(int level, const char * s, ...) {
int tty_logfd = -1;
int file_logfd = -1;

-void openLog(int useLocal) {
+void openLog() {
int flags;

- if (!useLocal) {
- tty_logfile = fopen("/dev/tty3", "w");
- file_logfile = fopen("/tmp/anaconda.log", "w");
- } else {
- tty_logfile = NULL;
- file_logfile = fopen("debug.log", "w");
- }
+ tty_logfile = fopen("/dev/tty3", "w");
+ file_logfile = fopen("/tmp/anaconda.log", "w");

if (tty_logfile) {
tty_logfd = fileno(tty_logfile);
diff --git a/loader/log.h b/loader/log.h
index 78eb44d..183c0b2 100644
--- a/loader/log.h
+++ b/loader/log.h
@@ -33,7 +33,7 @@ void logMessageV(int level, const char * s, va_list ap)
__attribute__ ((format (printf, 2, 0)));
void logMessage(int level, const char * s, ...)
__attribute__ ((format (printf, 2, 3)));
-void openLog(int useLocal);
+void openLog();
void closeLog(void);
void setLogLevel(int minLevel);
int getLogLevel(void);
diff --git a/loader/net.c b/loader/net.c
index 43de50f..3049fbc 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -444,7 +444,7 @@ int readNetConfig(char * device, iface_t * iface,

/* JKFIXME: we really need a way to override this and be able to change
* our network config */
- if (!FL_TESTING(flags)&& !FL_ASKNETWORK(flags)&&
+ if (!FL_ASKNETWORK(flags)&&
((iface->ipv4method> IPV4_UNUSED_METHOD) ||
(iface->ipv6method> IPV4_UNUSED_METHOD))) {
logMessage(INFO, "doing kickstart... setting it up");
@@ -510,27 +510,25 @@ int readNetConfig(char * device, iface_t * iface,
}

/* bring up the interface */
- if (!FL_TESTING(flags)) {
- err = writeEnabledNetInfo(iface);
- if (err) {
- logMessage(ERROR, "failed to write %s data for %s (%d)",
- SYSCONFIG_PATH, iface->device, err);
- iface->ipv4method = IPV4_UNUSED_METHOD;
- iface->ipv6method = IPV6_UNUSED_METHOD;
- return LOADER_BACK;
- }
+ err = writeEnabledNetInfo(iface);
+ if (err) {
+ logMessage(ERROR, "failed to write %s data for %s (%d)",
+ SYSCONFIG_PATH, iface->device, err);
+ iface->ipv4method = IPV4_UNUSED_METHOD;
+ iface->ipv6method = IPV6_UNUSED_METHOD;
+ return LOADER_BACK;
+ }

- i = get_connection(iface);
- newtPopWindow();
+ i = get_connection(iface);
+ newtPopWindow();

- if (i> 0) {
- newtWinMessage(_("Network Error"), _("Retry"),
- _("There was an error configuring your network "
- "interface."));
- iface->ipv4method = IPV4_UNUSED_METHOD;
- iface->ipv6method = IPV6_UNUSED_METHOD;
- return LOADER_ERROR;
- }
+ if (i> 0) {
+ newtWinMessage(_("Network Error"), _("Retry"),
+ _("There was an error configuring your network "
+ "interface."));
+ iface->ipv4method = IPV4_UNUSED_METHOD;
+ iface->ipv6method = IPV6_UNUSED_METHOD;
+ return LOADER_ERROR;
}

return LOADER_OK;
@@ -1984,19 +1982,17 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
break;
}

- if (!FL_TESTING(flags)) {
- err = writeEnabledNetInfo(iface);
- if (err) {
- logMessage(ERROR,
- "failed to write %s data for %s (%d)",
- SYSCONFIG_PATH, iface->device, err);
- return -1;
- }
-
- err = get_connection(iface);
- newtPopWindow();
+ err = writeEnabledNetInfo(iface);
+ if (err) {
+ logMessage(ERROR,
+ "failed to write %s data for %s (%d)",
+ SYSCONFIG_PATH, iface->device, err);
+ return -1;
}

+ err = get_connection(iface);
+ newtPopWindow();
+
if (err) {
logMessage(ERROR, "failed to start NetworkManager (%d)", err);
return -1;
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 420ea06..de1ce29 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -249,11 +249,6 @@ char * mountNfsImage(struct installMethod * method,
directory);
logMessage(INFO, "mounting nfs path %s", fullPath);

- if (FL_TESTING(flags)) {
- stage = NFS_STAGE_DONE;
- break;
- }
-
stage = NFS_STAGE_NFS;

if (!doPwMount(fullPath, "/mnt/stage2", "nfs", mountOpts, NULL)) {
diff --git a/loader/shutdown.c b/loader/shutdown.c
index c733f86..8f2c55e 100644
--- a/loader/shutdown.c
+++ b/loader/shutdown.c
@@ -32,17 +32,11 @@

#include "init.h"

-#ifdef AS_SHUTDOWN
-int testing = 0;
-#else
-extern int testing;
-#endif
-
void disableSwap(void);
void unmountFilesystems(void);

static void performTerminations(int doKill) {
- if (testing || !doKill)
+ if (!doKill)
return;

sync();
@@ -60,7 +54,7 @@ static void performTerminations(int doKill) {
static void performUnmounts(int doKill) {
int ignore;

- if (testing || !doKill)
+ if (!doKill)
return;

printf("disabling swap...
");
diff --git a/loader/undomounts.c b/loader/undomounts.c
index 31a98bb..af5caaa 100644
--- a/loader/undomounts.c
+++ b/loader/undomounts.c
@@ -49,8 +49,6 @@ struct unmountInfo {
enum { FS, LOOP } what;
} ;

-extern int testing;
-
void undoLoop(struct unmountInfo * fs, int numFs, int this);

static void printstr(char * string) {
@@ -80,12 +78,10 @@ void undoMount(struct unmountInfo * fs, int numFs, int this) {

printf(" %s", fs[this].name);
/* don't need to unmount /tmp. it is busy anyway. */
- if (!testing) {
- if (umount2(fs[this].name, MNT_DETACH)< 0) {
- printf(" umount failed (%d)", errno);
- } else {
- printf(" done");
- }
+ if (umount2(fs[this].name, MNT_DETACH)< 0) {
+ printf(" umount failed (%d)", errno);
+ } else {
+ printf(" done");
}
printf("
");
}
@@ -115,7 +111,7 @@ void undoLoop(struct unmountInfo * fs, int numFs, int this) {
if ((fd = open("/tmp/loop", O_RDONLY, 0))< 0) {
printf(" failed to open device: %d", errno);
} else {
- if (!testing&& ioctl(fd, LOOP_CLR_FD, 0))
+ if (ioctl(fd, LOOP_CLR_FD, 0))
printf(" LOOP_CLR_FD failed: %d", errno);
close(fd);
}
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 519d08c..9148c33 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -290,11 +290,6 @@ char *mountUrlImage(struct installMethod *method, char *location,
}

case URL_STAGE_FETCH: {
- if (FL_TESTING(flags)) {
- stage = URL_STAGE_DONE;
- break;
- }
-
if (loadUrlImages(loaderData,&ui)) {
stage = URL_STAGE_MAIN;



_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 10:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org