|
From: <ow...@us...> - 2008-01-23 21:10:49
|
Revision: 1026
http://ipcop.svn.sourceforge.net/ipcop/?rev=1026&view=rev
Author: owes
Date: 2008-01-23 13:10:55 -0800 (Wed, 23 Jan 2008)
Log Message:
-----------
Rearrange use of variable
Modified Paths:
--------------
ipcop/trunk/src/installer/installer.c
Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c 2008-01-23 21:09:16 UTC (rev 1025)
+++ ipcop/trunk/src/installer/installer.c 2008-01-23 21:10:55 UTC (rev 1026)
@@ -41,12 +41,16 @@
// tweak for errorbox
#define gettext ipcop_gettext
-NODEKV *kv = NULL; // contains a list key=value pairs
+
+/* global variables */
int flag_installer = 1;
supported_media_t medium_boot = none;
supported_media_t medium_sources = none;
char network_source[STRING_SIZE];
+/* local variables */
+static NODEKV *kv = NULL; // contains a list key=value pairs from boot parameters
+static char command[STRING_SIZE];
/*
ISO from http/ftp server
@@ -68,8 +72,8 @@
{
if ( hardwares[i].type == network )
{
- snprintf(string, STRING_SIZE, "modprobe %s", hardwares[i].module);
- mysystem(string);
+ snprintf(command, STRING_SIZE, "modprobe %s", hardwares[i].module);
+ mysystem(command);
}
}
@@ -77,8 +81,8 @@
{
/* maybe fancy progress bar here */
- snprintf(string, STRING_SIZE, "udhcpc -q -n -i eth%d -s /usr/bin/udhcpc.script > /dev/null\n", j);
- if ( !mysystem(string) )
+ snprintf(command, STRING_SIZE, "udhcpc -q -n -i eth%d -s /usr/bin/udhcpc.script > /dev/null\n", j);
+ if ( !mysystem(command) )
{
fprintf(flog, "eth%d DHCP Configured\n", j);
@@ -103,8 +107,8 @@
{
/* Try and configure a default address */
/* owes: this is bogus, should replace with window that asks for IP address */
- snprintf(string, STRING_SIZE, "ifconfig eth%d 192.168.%d.1\n", j, 200+j);
- mysystem(string);
+ snprintf(command, STRING_SIZE, "ifconfig eth%d 192.168.%d.1\n", j, 200+j);
+ mysystem(command);
}
j++;
}
@@ -138,16 +142,16 @@
/* just verify if files exist, download later */
strcpy(filename, TARBALL_VARLOG);
- snprintf(string, STRING_SIZE, "/bin/wget --spider -O /tmp/%s %s/%s", filename, network_source, filename);
- if (!mysystem(string))
+ snprintf(command, STRING_SIZE, "/bin/wget --spider -O /tmp/%s %s/%s", filename, network_source, filename);
+ if ( !mysystem(command) )
{
strcpy(filename, TARBALL_CONFIG);
snprintf(string, STRING_SIZE, "/bin/wget --spider -O /tmp/%s %s/%s", filename, network_source, filename);
- if (!mysystem(string))
+ if ( !mysystem(command) )
{
strcpy(filename, TARBALL_IPCOP);
- snprintf(string, STRING_SIZE, "/bin/wget --spider -O /tmp/%s %s/%s", filename, network_source, filename);
- if ( !mysystem(string) )
+ snprintf(command, STRING_SIZE, "/bin/wget --spider -O /tmp/%s %s/%s", filename, network_source, filename);
+ if ( !mysystem(command) )
{
fprintf(flog, "NETWORK INSTALL checked tarball URLs\n");
newtPopWindow();
@@ -169,7 +173,6 @@
*/
int findsource(void)
{
- char string[STRING_SIZE_LARGE];
char *installtypes[] = { "CDROM", "HTTP/FTP", NULL };
int installtype = 0; /* depending on menu, 0 = cdrom, 1 = http/ftp */
int i, rc;
@@ -215,8 +218,8 @@
if ( hardwares[i].type == cdrom )
{
fprintf(flog, "Linking %s to /dev/cdrom\n", hardwares[i].device);
- snprintf(string, STRING_SIZE, "ln -sf /dev/%s /dev/cdrom", hardwares[i].device);
- if ( !mysystem(string) )
+ snprintf(command, STRING_SIZE, "ln -sf /dev/%s /dev/cdrom", hardwares[i].device);
+ if ( !mysystem(command) )
{
fprintf(flog, "Created /dev/cdrom\n");
}
@@ -227,8 +230,8 @@
}
statuswindow(72, 5, ipcop_gettext("TR_TITLE_SOURCE"), ipcop_gettext("TR_MOUNTING_CDROM"));
- snprintf(string, STRING_SIZE, "/bin/mount -o ro /dev/%s /cdrom", hardwares[i].device);
- if ( mysystem(string) )
+ snprintf(command, STRING_SIZE, "/bin/mount -o ro /dev/%s /cdrom", hardwares[i].device);
+ if ( mysystem(command) )
{
fprintf(flog, "Failed to mount CDROM\n");
errorbox(ipcop_gettext("TR_UNABLE_TO_MOUNT_CDROM"));
@@ -506,6 +509,15 @@
{
/* running udhcp may have given us some acceptable defaults */
mysystem("/bin/cp /etc/dhcp-*.params /harddisk/tmp/");
+
+ for (i = 0; i < numhardwares; i++)
+ {
+ if ( hardwares[i].type == network )
+ {
+ snprintf(command, STRING_SIZE, "modprobe -r %s", hardwares[i].module);
+ mysystem(command);
+ }
+ }
}
/* Run setup to configure remaining bits & pieces */
@@ -540,8 +552,8 @@
}
else
{
- snprintf(line, STRING_SIZE, "/bin/umount /harddisk%s", partition_label[i]);
- mysystem(line);
+ snprintf(command, STRING_SIZE, "/bin/umount /harddisk%s", partition_label[i]);
+ mysystem(command);
}
}
@@ -560,8 +572,8 @@
// owes: need to verify this
if ( medium_boot == cdrom )
{
- snprintf(line, STRING_SIZE, "/bin/eject %s", "cdrom");
- mysystem(line);
+ snprintf(command, STRING_SIZE, "/bin/eject %s", "cdrom");
+ mysystem(command);
}
newtPopWindow();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|