|
From: <ow...@us...> - 2008-01-12 22:50:46
|
Revision: 1001
http://ipcop.svn.sourceforge.net/ipcop/?rev=1001&view=rev
Author: owes
Date: 2008-01-12 14:50:48 -0800 (Sat, 12 Jan 2008)
Log Message:
-----------
Move locale-archive to /usr/lib/locale.
Store info from pxe/dhcp servers in seperate file per interface.
Fix partitioning when disk is clean.
Change some newt window sizes and titles.
More smaller things ...
Language updates will follow in second commit.
Modified Paths:
--------------
ipcop/trunk/config/busybox/default.script
ipcop/trunk/lfs/initramfs
ipcop/trunk/src/installer/Makefile
ipcop/trunk/src/installer/arch_defs.h
ipcop/trunk/src/installer/hardware.c
ipcop/trunk/src/installer/installer.c
ipcop/trunk/src/installer/language.c
ipcop/trunk/src/installer/networking.c
ipcop/trunk/src/installer/partition.c
ipcop/trunk/src/installer/passwords.c
ipcop/trunk/src/installer/setup.c
Modified: ipcop/trunk/config/busybox/default.script
===================================================================
--- ipcop/trunk/config/busybox/default.script 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/config/busybox/default.script 2008-01-12 22:50:48 UTC (rev 1001)
@@ -41,7 +41,7 @@
echo nameserver $i >> $RESOLV_CONF
done
- DHCP_PARAMS="/etc/dhcp.params"
+ DHCP_PARAMS="/etc/dhcp-$interface.params"
echo -n > $DHCP_PARAMS
[ -n "$serverid" ] && echo "SERVERID=$serverid" >> $DHCP_PARAMS
[ -n "$ip" ] && echo "IP=$ip" >> $DHCP_PARAMS
Modified: ipcop/trunk/lfs/initramfs
===================================================================
--- ipcop/trunk/lfs/initramfs 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/lfs/initramfs 2008-01-12 22:50:48 UTC (rev 1001)
@@ -176,8 +176,8 @@
done
# Copy locale archive
- mkdir -p $(INITRAMFS_DIR)/lib/locale/
- cp -a /usr/lib/locale/locale-archive $(INITRAMFS_DIR)/lib/locale/locale-archive
+ mkdir -p $(INITRAMFS_DIR)/usr/lib/locale/
+ cp -a /usr/lib/locale/locale-archive $(INITRAMFS_DIR)/usr/lib/locale/locale-archive
# Copy over udhcp settings for busybox
install -m 0755 $(DIR_SRC)/config/busybox/default.script \
@@ -451,8 +451,9 @@
# START of root-extra floppy section #
#################################################################################################
# Copy the the locale archive to the extra floppy root directory
- mkdir -p $(FLOPPY_ROOT_DIR)/lib
- cp -a $(INITRAMFS_DIR)/lib/locale $(FLOPPY_ROOT_DIR)/lib/
+ # owes: working on this
+ #mkdir -p $(FLOPPY_ROOT_DIR)/lib
+ #cp -a $(INITRAMFS_DIR)/usr/lib/locale $(FLOPPY_ROOT_DIR)/lib/
# Copy the installer i18n messages
mkdir -p $(FLOPPY_ROOT_DIR)/usr/share
Modified: ipcop/trunk/src/installer/Makefile
===================================================================
--- ipcop/trunk/src/installer/Makefile 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/Makefile 2008-01-12 22:50:48 UTC (rev 1001)
@@ -7,7 +7,7 @@
SRC_HELP = helper.c
OBJS_INST = installer.o helper.o helper_newt.o hardware.o language.o partition.o passwords.c
LIBS_INST = -ldiscover -lparted -lnewt -lslang
-OBJS_SETUP = setup.o helper.o helper_newt.o host_domain.o keymap.o networking.o passwords.o timezone.o
+OBJS_SETUP = setup.o helper.o helper_newt.o hardware.o host_domain.o keymap.o networking.o passwords.o timezone.o
LIBS_SETUP = -ldiscover -lnewt -lslang
all: installer setup
Modified: ipcop/trunk/src/installer/arch_defs.h
===================================================================
--- ipcop/trunk/src/installer/arch_defs.h 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/arch_defs.h 2008-01-12 22:50:48 UTC (rev 1001)
@@ -5,7 +5,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* $Id$
*
@@ -69,7 +69,7 @@
typedef enum
{
none = 0,
- floppy, /* currently not supported */
+ floppy, /* bootable */
cdrom, /* bootable and sources available */
harddisk, /* possible installation target */
network, /* bootable (PXE) and source available (http/ftp server) */
@@ -99,10 +99,10 @@
/*
Various function implemented in hardware.c and partition.c
*/
-void scanhardware(int nopcmcia, int nousb, int noscsi);
-int autopart(char *device, long int disk_size);
-int makedisk(char *device, int *bootpartexist);
-void createinitramfs(void);
+void scan_hardware(int installer_setup, int nopcmcia, int nousb, int noscsi);
+int make_partitions(char *device, long int disk_size);
+int make_disk(char *device, int *bootpartexist);
+void create_initramfs(void);
void make_bootable(char *device, int bootpartexist);
/*
List of partitions.
Modified: ipcop/trunk/src/installer/hardware.c
===================================================================
--- ipcop/trunk/src/installer/hardware.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/hardware.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* $Id$
*
@@ -34,6 +34,7 @@
static FILE *fhwdetect;
static int have_idedisk = 0;
static int have_idecd = 0;
+static int install_setup = 0; /* 0 when running setup (NIC detection), 1 for installer */
/*
Add something to our hardware list
@@ -101,9 +102,12 @@
fprintf(flog, " Add %3d, %s, %s, %s\n", type, hardwares[numhardwares].module,
hardwares[numhardwares].device,
hardwares[numhardwares].description);
- fprintf(fhwdetect, " Add %3d, %s, %s, %s\n", type, hardwares[numhardwares].module,
- hardwares[numhardwares].device,
- hardwares[numhardwares].description);
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, " Add %3d, %s, %s, %s\n", type, hardwares[numhardwares].module,
+ hardwares[numhardwares].device,
+ hardwares[numhardwares].description);
+ }
// increment tallies
numhardwares++;
switch ( type )
@@ -237,13 +241,19 @@
// fill in tables with data
-void scanhardware(int nopcmcia, int nousb, int noscsi)
+void scan_hardware(int flag_i_s, int nopcmcia, int nousb, int noscsi)
{
discover_bus_map_t *busmap;
discover_error_t *status;
discover_device_t *devices;
char command[STRING_SIZE];
int i;
+ newtComponent form;
+ newtComponent text;
+ newtComponent scale;
+ char line[STRING_SIZE];
+ int numBusses;
+ int firstscan;
numhardwares = 0;
numharddisk = 0;
@@ -251,42 +261,84 @@
numnetwork = 0;
status = discover_error_new();
- fhwdetect = fopen("/tmp/hwdetect", "w");
+ install_setup = flag_i_s;
+ if ( install_setup )
+ {
+ /* also write HW detection to file, for easier reference */
+ fhwdetect = fopen("/tmp/hwdetect", "w");
+ }
- /* disable stuff the user does not want */
+ numBusses = BUS_COUNT;
+ /* disable stuff the user does not want or does not need */
+ if ( !install_setup )
+ {
+ busmap = discover_conf_get_bus_map_by_name("ata", status);
+ busmap->scan_never = 1;
+ numBusses--;
+ }
if ( nopcmcia )
{
busmap = discover_conf_get_bus_map_by_name("pcmcia", status);
busmap->scan_never = 1;
+ numBusses--;
}
if ( nousb )
{
busmap = discover_conf_get_bus_map_by_name("usb", status);
busmap->scan_never = 1;
+ numBusses--;
}
- if ( noscsi )
+ if ( noscsi || !install_setup )
{
busmap = discover_conf_get_bus_map_by_name("scsi", status);
busmap->scan_never = 1;
+ numBusses--;
}
+ snprintf(line, STRING_SIZE, ipcop_gettext("TR_PROBING_HARDWARE"), "");
+ text = newtLabel(1, 1, line);
+ scale = newtScale(1, 3, 68, numBusses*10);
+ newtCenteredWindow(72, 5, ipcop_gettext("TR_TITLE_HARDWARE"));
+ form = newtForm(NULL, NULL, 0);
+ newtFormAddComponents(form, text, scale, NULL);
+
+ newtDrawForm(form);
+ newtRefresh();
+
/* start bus scan */
busmap = discover_conf_get_full_bus_map(status);
for (i = 0; busmap[i].name; i++)
{
+ snprintf(line, STRING_SIZE, ipcop_gettext("TR_PROBING_HARDWARE"), busmap[i].name);
+ strcat(line, " ");
+ newtLabelSetText(text, line);
+ newtRefresh();
+
if ( busmap[i].scan_never )
{
fprintf(flog, "Noscan %s\n", busmap[i].name);
- fprintf(fhwdetect, "Noscan %s\n", busmap[i].name);
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, "Noscan %s\n", busmap[i].name);
+ }
+ newtScaleSet(scale, (i+1)*10);
+ newtRefresh();
continue;
}
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_PROBING_HARDWARE"), busmap[i].name);
+ /* not really necessary, but with our nice screen the user probably won't mind waiting an extra second */
+ sleep(1);
fprintf(flog, "Scan %s\n", busmap[i].name);
- fprintf(fhwdetect, "Scan %s\n", busmap[i].name);
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, "Scan %s\n", busmap[i].name);
+ }
devices = discover_get_devices(i, status);
+ newtScaleSet(scale, i*10+1);
+ newtRefresh();
+
/* walk list of devices */
for (; devices; devices = discover_device_get_next(devices))
{
@@ -322,7 +374,7 @@
type = network;
}
}
- else if ( flag_installer && (
+ else if ( install_setup && (
( !strcmp(busclass, "0100") && !noscsi ) || /* SCSI controller */
!strcmp(busclass, "0101") || /* IDE controller */
// !strcmp(busclass, "0102") || /* Floppy controller */
@@ -333,14 +385,14 @@
{
type = specialmodule;
}
- else if ( flag_installer && (
+ else if ( install_setup && (
( !strcmp(busclass, "0605") && !nopcmcia) || /* PCMCIA bridge */
( !strcmp(busclass, "0607") && !nopcmcia) /* Cardbus bridge */
) )
{
type = specialmodule;
}
- else if ( flag_installer && (
+ else if ( install_setup && (
( !strcmp(busclass, "0c03") && !nousb) /* USB controller */
) )
{
@@ -359,10 +411,13 @@
busclass,
module == NULL ? "---" : module,
description == NULL ? "---" : description);
- fprintf(fhwdetect, " Skip %s %s, %s\n",
- busclass,
- module == NULL ? "---" : module,
- description == NULL ? "---" : description);
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, " Skip %s %s, %s\n",
+ busclass,
+ module == NULL ? "---" : module,
+ description == NULL ? "---" : description);
+ }
}
else
{
@@ -372,7 +427,7 @@
/*
Some special handling for special devices
*/
- if ( flag_installer && (module != NULL) && (type == specialmodule) )
+ if ( install_setup && (module != NULL) && (type == specialmodule) )
{
snprintf(command, STRING_SIZE, "/sbin/modprobe %s", module);
mysystem(command);
@@ -407,82 +462,94 @@
}
}
- newtPopWindow();
+ /* not really necessary, but with our nice screen the user probably won't mind waiting a bit */
+ sleep(1);
+ newtScaleSet(scale, (i+1)*10);
+ newtRefresh();
}
discover_error_free(status);
+ newtFormDestroy(form);
+ newtPopWindow();
-scanproc:
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_PROBING_HARDWARE"), "drives");
- /*
- must delay a little until hardware is recognized.
- If not, device name is not found and installer
- restarts (seg fault).
+ firstscan = TRUE;
+ while ( install_setup && (numharddisk == 0) )
+ {
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_HARDWARE"), ipcop_gettext("TR_PROBING_HARDWARE"), "drives");
- owes: do we need this, if yes which value ?
- */
- sleep(2);
+ if ( !firstscan )
+ {
+ /* since we've not yet waited since last modprobe, sleep now */
+ sleep(2);
+ }
+ firstscan = FALSE;
- /* go hunting for drives */
- fprintf(flog, "Scan for drives\r\n");
- fprintf(fhwdetect, "Scan for drives\r\n");
- scanprocdrives(1);
+ /* go hunting for drives */
+ fprintf(flog, "Scan for drives\n");
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, "Scan for drives\n");
+ }
+ scanprocdrives(1);
- newtPopWindow();
+ newtPopWindow();
- if ( numharddisk == 0 )
- {
- newtComponent form;
- newtComponent text;
- newtComponent button_rescan, button_modprobe, button_cancel;
- newtComponent module, moduleentry;
- struct newtExitStruct exitstruct;
- const char *modulename;
+ if ( numharddisk == 0 )
+ {
+ newtComponent button_rescan, button_modprobe, button_cancel;
+ newtComponent module, moduleentry;
+ struct newtExitStruct exitstruct;
+ const char *modulename;
+ int numLines;
- newtCenteredWindow(60, 13, get_title());
- form = newtForm(NULL, NULL, 0);
+ text = newtTextboxReflowed(1, 1, ipcop_gettext("TR_NO_HARDDISK_MODPROBE"), 68, 0, 0, 0);
+ numLines = newtTextboxGetNumLines(text);
+ newtCenteredWindow(72, numLines + 9, ipcop_gettext("TR_TITLE_HARDWARE"));
+ form = newtForm(NULL, NULL, 0);
+ newtFormAddComponent(form, text);
- text = newtTextboxReflowed(1, 1, ipcop_gettext("TR_NO_HARDDISK_MODPROBE"), 58, 0, 0, 0);
- newtFormAddComponent(form, text);
+ module = newtTextbox(2, numLines + 2, 10, 1, 0);
+ newtTextboxSetText(module, "Module:");
+ newtFormAddComponent(form, module);
+ moduleentry = newtEntry(12, numLines + 2, "", 20, &modulename, 0);
+ newtFormAddComponent(form, moduleentry);
- module = newtTextbox(2, 5, 10, 1, 0);
- newtTextboxSetText(module, "Module:");
- newtFormAddComponent(form, module);
- moduleentry = newtEntry(12, 5, "", 20, &modulename, 0);
- newtFormAddComponent(form, moduleentry);
+ button_rescan = newtButton(6, numLines + 4, ipcop_gettext("TR_RESCAN"));
+ button_modprobe = newtButton(26, numLines + 4, "Modprobe");
+ button_cancel = newtButton(46, numLines + 4, ipcop_gettext("TR_CANCEL"));
+ newtFormAddComponents(form, button_rescan, button_modprobe, button_cancel, NULL);
- button_rescan = newtButton(6, 8, ipcop_gettext("TR_RESCAN"));
- button_modprobe = newtButton(26, 8, ipcop_gettext("TR_MODPROBE"));
- button_cancel = newtButton(46, 8, ipcop_gettext("TR_CANCEL"));
- newtFormAddComponents(form, button_rescan, button_modprobe, button_cancel, NULL);
+ newtRefresh();
+ newtDrawForm(form);
+ newtFormRun(form, &exitstruct);
- newtRefresh();
- newtDrawForm(form);
- newtFormRun(form, &exitstruct);
+ if ( exitstruct.u.co == button_modprobe )
+ {
+ snprintf(command, STRING_SIZE, "/sbin/modprobe %s", modulename);
+ if ( !mysystem(command) )
+ {
+ hardwareadd(specialmodule, modulename, NULL, NULL, NULL, NULL, NULL);
+ }
+ else
+ {
+ /* owes: show errorbox here */
+ }
+ }
- if ( exitstruct.u.co == button_rescan )
- {
newtFormDestroy(form);
newtPopWindow();
- goto scanproc;
- }
- if ( exitstruct.u.co == button_modprobe )
- {
- snprintf(command, STRING_SIZE, "/sbin/modprobe %s", modulename);
- if ( !mysystem(command) )
- hardwareadd(specialmodule, modulename, NULL, NULL, NULL, NULL, NULL);
- newtFormDestroy(form);
- newtPopWindow();
- goto scanproc;
+ if ( exitstruct.u.co == button_cancel )
+ {
+ return;
+ }
}
-
- newtFormDestroy(form);
- newtPopWindow();
}
fprintf(flog, "Scan complete. Hardware %d, Harddisk %d, CDROM %d, Network %d\n", numhardwares, numharddisk, numcdrom, numnetwork);
- fprintf(fhwdetect, "Scan complete. Hardware %d, Harddisk %d, CDROM %d, Network %d\n", numhardwares, numharddisk, numcdrom, numnetwork);
-
- fclose(fhwdetect);
+ if ( install_setup )
+ {
+ fprintf(fhwdetect, "Scan complete. Hardware %d, Harddisk %d, CDROM %d, Network %d\n", numhardwares, numharddisk, numcdrom, numnetwork);
+ fclose(fhwdetect);
+ }
}
Modified: ipcop/trunk/src/installer/installer.c
===================================================================
--- ipcop/trunk/src/installer/installer.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/installer.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -6,7 +6,7 @@
*
* Written by Alan Hourihane <al...@fa...>
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* This is the first stage installer.
* - select language.
@@ -60,10 +60,10 @@
int i,j = 0;
char string[STRING_SIZE];
int rc;
- char *values[] = { "http://192.168.10.203/iso", NULL }; /* pointers for the values. */
+ char *values[] = { "http://192.168.1.1/iso", NULL }; /* pointers for the values. */
char serverid[STRING_SIZE];
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_SEARCH_NETWORKS"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_SOURCE"), ipcop_gettext("TR_SEARCH_NETWORKS"));
for (i = 0; i < numhardwares; i++)
{
if ( hardwares[i].type == network )
@@ -86,7 +86,8 @@
* if not probably close enough to use it's IP */
NODEKV *kv_dhcp_params = NULL;
- read_kv_from_file(&kv_dhcp_params, "/etc/dhcp.params");
+ snprintf(string, STRING_SIZE, "/etc/dhcp-eth%d.params", j);
+ read_kv_from_file(&kv_dhcp_params, string);
if ( find_kv(kv_dhcp_params, "SERVERID") != NULL )
{
@@ -114,8 +115,8 @@
{
newtPopWindow();
struct newtWinEntry entries[] = { {"", &values[0], 0,}, {NULL, NULL, 0} };
- rc = newtWinEntries(get_title(), ipcop_gettext("TR_ENTER_URL"),
- 60, 5, 5, 50, entries, ipcop_gettext("TR_OK"),
+ rc = newtWinEntries(ipcop_gettext("TR_TITLE_SOURCE"), ipcop_gettext("TR_ENTER_URL"),
+ 72, 5, 5, 50, entries, ipcop_gettext("TR_OK"),
ipcop_gettext("TR_CANCEL"), NULL);
strncpy(message, values[0], STRING_SIZE);
fprintf(flog, "URL is %s\n", message);
@@ -133,7 +134,7 @@
message[strlen(message) - 1] = '\0';
strcpy(network_source, message);
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_CHECKING"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_SOURCE"), ipcop_gettext("TR_CHECKING"));
/* just verify if files exist, download later */
strcpy(filename, TARBALL_VARLOG);
@@ -189,8 +190,8 @@
while ( 1 )
{
snprintf (line, STRING_SIZE_LARGE, ipcop_gettext("TR_SELECT_INSTALLATION_MEDIA_LONG"), NAME);
- rc = newtWinMenu(get_title(),
- line, 50, 5, 5, 8,
+ rc = newtWinMenu(ipcop_gettext("TR_TITLE_SOURCE"),
+ line, 72, 5, 5, 8,
installtypes, &installtype, ipcop_gettext("TR_OK"),
ipcop_gettext("TR_CANCEL"), NULL);
if ( rc == 2 )
@@ -225,7 +226,7 @@
continue;
}
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_MOUNTING_CDROM"));
+ 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) )
{
@@ -303,7 +304,7 @@
// Choose the disk to use
rc = newtWinMenu(ipcop_gettext("TR_SELECT_HARDDISK"),
ipcop_gettext("TR_SELECT_DEVICE_FOR_INSTALLATION"),
- 50, 5, 5, 8,
+ 72, 5, 5, 8,
harddisklist,
&c,
ipcop_gettext("TR_OK"), ipcop_gettext("TR_CANCEL"), NULL);
@@ -382,16 +383,22 @@
}
/* Determine boot medium */
- if ( (handle = fopen("/CDROMBOOT", "r")) != NULL )
+ if ( access("/FLOPPYBOOT", 0) != -1 )
{
+ medium_boot = floppy;
+ fprintf(flog, "Boot is floppy\n");
+ }
+ else if ( access("/CDROMBOOT", 0) != -1 )
+ {
/* currently also PXE and USB stick */
medium_boot = cdrom;
- fclose(handle);
+ fprintf(flog, "Boot is cdrom (or others)\n");
}
else
{
/* actually this cannot be, boot must have used something */
medium_boot = none;
+ fprintf(flog, "Boot is unknown ?!\n");
}
/* USB keyboard modules are already loaded so no need to load them */
@@ -434,14 +441,8 @@
}
// find nics cdrom harddisk & floppies
- scanhardware(nopcmcia, nousb, noscsi);
+ scan_hardware(1, nopcmcia, nousb, noscsi);
- /* Create device files now */
- /* DISABLED -- we use udevd now */
- /*
- mysystem("/sbin/udevstart");
- */
-
/* any possible target drives found */
if ( numharddisk == 0 )
{
@@ -462,40 +463,22 @@
long int disk_size = 0;
int bootpartindex = 0;
- switch ( selectdestination(&selected_hd, &disk_size) )
- {
- case 2: //CANCEL
- goto EXIT;
- case 3: // call manual fdisk
-#if 0
-// skip for now
- if (!(bigdisk = (disk_size >= SMALL_DISK))) {
- errorbox(ipcop_gettext("TR_NO_MULTIPLE_PARTITIONS_POSSIBLE"));
- if (makesmalldisk(selected_hd))
- goto EXIT;
- break;
- }
- // it is a bigdisk!
- if (manualpart(selected_hd))
- goto EXIT;
- if (makebigdisk(selected_hd,
- &bootpartindex, // return index id '/boot'
- FALSE // autolabel=no
- ))
-#endif
- goto EXIT;
- default:
- if ( autopart(hardwares[selected_hd].device, disk_size) )
- goto EXIT;
- if ( makedisk( hardwares[selected_hd].device,
+ if ( selectdestination(&selected_hd, &disk_size) == 2 )
+ {
+ /* CANCEL */
+ goto EXIT;
+ }
+
+ if ( make_partitions(hardwares[selected_hd].device, disk_size) )
+ goto EXIT;
+ if ( make_disk( hardwares[selected_hd].device,
&bootpartindex // return index id '/boot'
))
- goto EXIT;
- }
+ goto EXIT;
// Now, /harddisk is mounted
- // /harddisk/boot sometimes mounted
- // /harddisk/var/log sometimes mounted
+ // /harddisk/boot is mounted
+ // /harddisk/var/log is mounted
/* Mount filesystems necessary??? */
mysystem("/bin/mount -n -t sysfs none /harddisk/sys");
@@ -507,44 +490,29 @@
mysystem("/bin/mount -n -o bind /dev /harddisk/dev");
// InitRD
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_BUILDING_INITRD"));
- createinitramfs();
- newtPopWindow();
+ create_initramfs();
/* Make the new installation bootable */
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_MAKING_BOOTABLE"));
make_bootable(hardwares[selected_hd].device, (bootpartindex!=0));
- newtPopWindow();
- /* Network configuration */
-// OWES: could drop some config list for setup here
-#if 0
- for (i = 0; i < nummodules; i++)
- {
- if (module_type[i] == hw_network_ctrl)
- {
- fprintf(flog, "Nr %d module %s\n", i, modules[i]);
- }
- }
-#endif
-
write_lang_configs();
if ( medium_sources == network )
{
/* running udhcp may have given us some acceptable defaults */
- mysystem("/bin/cp /etc/dhcp.params /harddisk/tmp/dhcp.params");
+ mysystem("/bin/cp /etc/dhcp-*.params /harddisk/tmp/");
}
+ /* Run setup to configure remaining bits & pieces */
if ( system("/bin/chroot /harddisk /usr/local/sbin/setup INSTALL") )
printf("Unable to run setup.\n");
/* cleanup possible udhcp parameters */
- mysystem("/bin/rm -f /harddisk/tmp/dhcp.params");
+ mysystem("/bin/rm -f /harddisk/tmp/dhcp-*.params");
// All done, just have to unmount everything...
- statuswindow(60, 4, get_title(),
+ statuswindow(72, 5, get_title(),
ipcop_gettext("TR_UNMOUNTING"));
mysystem("/bin/umount -n /harddisk/dev");
Modified: ipcop/trunk/src/installer/language.c
===================================================================
--- ipcop/trunk/src/installer/language.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/language.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* $Id$
*
@@ -21,7 +21,10 @@
#include <string.h>
#include "common.h"
+/* Uncomment this to get more logging on console5 */
+// #define _DEBUG_GETTEXT
+
struct language
{
int inuse;
@@ -191,8 +194,9 @@
if ( tmp_lang->inuse == 0 )
{
-// fprintf(flog, "Language skip %s %s %s\n", tmp_lang->shortname, tmp_lang->locale, tmp_lang->longname);
-
+#ifdef _DEBUG_GETTEXT
+ fprintf(flog, "Language skip %s %s %s\n", tmp_lang->shortname, tmp_lang->locale, tmp_lang->longname);
+#endif
free(tmp_lang);
if ( p_lang == NULL )
{
@@ -201,8 +205,9 @@
}
else
{
-// fprintf(flog, "Language add %s %s %s\n", tmp_lang->shortname, tmp_lang->locale, tmp_lang->longname);
-
+#ifdef _DEBUG_GETTEXT
+ fprintf(flog, "Language add %s %s %s\n", tmp_lang->shortname, tmp_lang->locale, tmp_lang->longname);
+#endif
count++;
if ( p_lang != NULL )
@@ -269,7 +274,7 @@
fclose(f);
free(langnames);
-#endif
+#endif // not defined LANG_EN_ONLY
}
@@ -447,11 +452,15 @@
{
int i;
-// fprintf(flog, "LOCALE: %s\n", txt);
+#ifdef _DEBUG_GETTEXT
+ fprintf(flog, "LOCALE: %s\n", txt);
+#endif
if ( !b_locale )
{
-// fprintf(flog, "not initialised\n");
+#ifdef _DEBUG_GETTEXT
+ fprintf(flog, "not initialised\n");
+#endif
return( txt );
}
@@ -459,7 +468,9 @@
{
if ( !strcmp(strings_org[i], txt) )
{
-// fprintf(flog, "-> %s\n", strings_trans[i]);
+#ifdef _DEBUG_GETTEXT
+ fprintf(flog, "-> %s\n", strings_trans[i]);
+#endif
return( strings_trans[i] );
}
}
Modified: ipcop/trunk/src/installer/networking.c
===================================================================
--- ipcop/trunk/src/installer/networking.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/networking.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* $Id: passwords.c 590 2007-10-29 09:05:10Z owes $
*
@@ -19,6 +19,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include "common.h"
+#include "arch_defs.h"
/* Length of list with types for red */
@@ -36,42 +37,35 @@
static char default_ip[STRING_SIZE] = "192.168.1.1";
static char default_netmask[STRING_SIZE] = "255.255.255.0";
-// OWES
-#ifdef OLD_STUFF
-void scan_cards(char *info)
+
+static unsigned int numnics;
+static struct hardware_s *nics;
+
+
+static void build_card_list(void)
{
- char line[STRING_SIZE];
- hd_t *hd = NULL;
- hd_data_t *hd_data;
- hd_data = calloc(1, sizeof *hd_data);
+}
- hd = hd_list(hd_data, hw_network_ctrl, 1, NULL);
- info[0] = 0;
- for ( ; hd; hd = hd->next)
- {
- hd_res_t *res;
+static void scan_cards(void)
+{
+ int i;
- snprintf(line, STRING_SIZE, "%s\n 0x%X 0x%X %s\n",
- hd->model, // this does not seem to work with libhd-tiny
- hd->vendor.id, hd->device.id, hd->driver); // driver does not always seem to work
- strcat(info, line);
+ /* scan for NICs, disable SCSI */
+ scan_hardware(0, 0, 0, 1);
- for(res = hd->res; res; res = res->next) {
- if ( res->any.type == res_hwaddr )
- {
- strcat(info, res->hwaddr.addr);
- }
+ for (i = 0; i < numhardwares; i++)
+ {
+ if ( hardwares[i].type == network )
+ {
+ char command[STRING_SIZE];
+ snprintf(command, STRING_SIZE, "modprobe %s", hardwares[i].module);
+ mysystem(command);
}
}
-
- hd_free_hd_list(hd);
- hd_free_hd_data(hd_data);
-
- free(hd_data);
}
-#endif
+
/*
Verify IP address and netmask
*/
@@ -174,6 +168,8 @@
newtComponent driverentry;
const char *deviceresult;
+ scan_cards();
+
if ( flag_installer )
{
/* as long as scanning is not working properly, do a quick setup for green */
@@ -215,10 +211,6 @@
else
{
statuswindow(60, 4, get_title(), gettext("TR_PROBING_HARDWARE"));
-// OWES
-#ifdef OLD_STUFF
- scan_cards(info);
-#endif
newtPopWindow();
newtCenteredWindow(60, 14, gettext("TR_CARD_ASSIGNMENT"));
@@ -354,6 +346,10 @@
/* green only for now */
strcpy(keyvalue, default_ip);
}
+ else
+ {
+ strcpy(keyvalue, "");
+ }
find_kv_default(eth_kv, addresskey, keyvalue);
addressentry = newtEntry(20, 4, keyvalue, 20, &addressresult, 0);
newtEntrySetFilter(addressentry, filter_ip, NULL);
@@ -588,7 +584,7 @@
{
NODEKV *kv_dhcp_params = NULL;
- read_kv_from_file(&kv_dhcp_params, "/tmp/dhcp.params");
+ read_kv_from_file(&kv_dhcp_params, "/tmp/dhcp-eth0.params");
find_kv_default(kv_dhcp_params, "IP", default_ip);
find_kv_default(kv_dhcp_params, "NETMASK", default_netmask);
free_kv(&kv_dhcp_params);
Modified: ipcop/trunk/src/installer/partition.c
===================================================================
--- ipcop/trunk/src/installer/partition.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/partition.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
*
*
@@ -52,8 +52,9 @@
Calculate for the user a useable disk schema partition
and make it so.
*/
-int autopart(char *dev, long int disk_size)
+int make_partitions(char *dev, long int disk_size)
{
+ int retcode = 1; /* ERROR */
long int swap_file, boot_partition, log_partition;
long int start_partition, current_free, root_partition;
char string[STRING_SIZE];
@@ -68,6 +69,11 @@
snprintf(device, STRING_SIZE, "/dev/%s", dev);
+ /*
+ someday offer semi-manual partition here
+ keep /, /boot /var/log but allow user to set different sizes (> MINIMUM) or leave free space
+ */
+
/* set all the minimum sizes */
boot_partition = BOOT_PARTITION;
root_partition = ROOT_MINIMUM;
@@ -96,20 +102,24 @@
start_partition = 1; /* in MB */
+
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_MAKING_PARTITIONS"));
+
+
snprintf(string, STRING_SIZE, "/bin/dd if=/dev/zero of=%s bs=512 count=1", device );
mysystem(string);
mysystem("/bin/sync");
-
ped_dev = ped_device_get(device);
if ( !ped_dev )
{
fprintf(flog, "error in ped_device_get\n");
- /* return 1; */ /* ERROR */
+ goto PARTITION_EXIT;
}
if ( (ped_fstype = ped_file_system_type_get("ext2")) == NULL )
{
fprintf(flog, "error in ped_file_system_type_get\n");
+ goto PARTITION_EXIT;
}
pedsector_start = (PedSector) (1*1024*1024/ ped_dev->sector_size);
@@ -125,11 +135,12 @@
if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("msdos"))) == NULL )
{
fprintf(flog, "error in ped_disk_new_fresh\n");
+ goto PARTITION_EXIT;
}
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit disktype\n");
- return 1;
+ goto PARTITION_EXIT;
}
/* boot partition */
@@ -141,7 +152,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /boot\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /boot\n");
@@ -153,7 +164,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /\n");
@@ -165,7 +176,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /var/log\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /var/log\n");
#endif /* End of i386/x86_64 partitioning block */
@@ -181,11 +192,12 @@
if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("mac"))) == NULL )
{
fprintf(flog, "error in ped_disk_new_fresh\n");
+ goto PARTITION_EXIT;
}
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit disktype\n");
- return 1;
+ goto PARTITION_EXIT;
}
/* hfs bootstrap partition */
@@ -196,7 +208,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit bootstrap\n");
- return 1;
+ goto PARTITION_EXIT;
}
/* boot partition */
@@ -206,7 +218,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /boot\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /boot\n");
@@ -217,7 +229,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /\n");
@@ -228,7 +240,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /var/log\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /var/log\n");
#endif /* End of ppc/ppc64 partitioning block */
@@ -243,11 +255,12 @@
if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("sun"))) == NULL )
{
fprintf(flog, "error in ped_disk_new_fresh\n");
+ goto PARTITION_EXIT;
}
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit disktype\n");
- return 1;
+ goto PARTITION_EXIT;
}
/* boot partition */
@@ -258,7 +271,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /boot\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /boot\n");
@@ -269,7 +282,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /\n");
@@ -280,7 +293,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /var/log\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /var/log\n");
#endif /* End of sparc/sparc64 partitioning block */
@@ -294,11 +307,12 @@
if ( (ped_disk = ped_disk_new_fresh(ped_dev, ped_disk_type_get("bsd"))) == NULL )
{
fprintf(flog, "error in ped_disk_new_fresh\n");
+ goto PARTITION_EXIT;
}
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit disktype\n");
- return 1;
+ goto PARTITION_EXIT;
}
/* boot partition */
@@ -309,7 +323,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /boot\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /boot\n");
@@ -320,7 +334,7 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /\n");
@@ -331,32 +345,29 @@
if ( !ped_disk_commit_to_dev(ped_disk) )
{
fprintf(flog, "error in ped_disk_commit /var/log\n");
- return 1;
+ goto PARTITION_EXIT;
}
fprintf(flog, "Partition added /var/log\n");
#endif /* End of alpha partitioning block */
+ ped_disk_commit(ped_disk);
ped_disk_destroy(ped_disk);
+ retcode = 0; /* SUCCESS */
- return 0; /* SUCCESS */
-} /* End of int autopart() */
+PARTITION_EXIT:
+ sleep(1);
+ mysystem("/bin/sync");
+ newtPopWindow();
-/*
- Manual partition. Not correctly implemented, not tested.
- Do not use.
-*/
-int manualpart( int selected_hd)
-{
+ return retcode;
+} /* End of int autopart() */
- return 0;
-}
-
/*
After sourcefile are decompressed on harddisk, make room on ... (someplace)
*/
-void delete_tarballs()
+static void delete_tarballs()
{
switch ( medium_sources )
{
@@ -388,7 +399,7 @@
Return value:
index of boot partition (zero if not)
*/
-int makedisk(char *dev, int *bootpartexist)
+int make_disk(char *dev, int *bootpartexist)
{
char string[STRING_SIZE];
FILE *handle;
@@ -418,7 +429,7 @@
}
free(names);
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_MAKING_FILESYSTEMS"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_MAKING_FILESYSTEMS"));
if ( (handle = fopen("/etc/fstab", "w")) )
{
@@ -449,7 +460,7 @@
mysystem("/sbin/udevstart");
*/
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_MOUTING_FILESYSTEMS"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_MOUTING_FILESYSTEMS"));
/* load ext3 now */
mysystem("/bin/modprobe ext3");
@@ -474,13 +485,16 @@
}
}
}
- /* this can fail */
- mysystem("/bin/mount -a");
newtPopWindow();
+ /* this can fail */
+ if ( mysystem("/bin/mount -a") )
+ {
+ /* */
+ return 1;
+ }
+
/* populate files on the partitions */
-
-
switch ( medium_sources )
{
case cdrom:
@@ -488,7 +502,7 @@
break;
case network:
/* download needed files */
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_DOWNLOADING_IMAGE"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_DOWNLOADING_IMAGE"));
mysystem("mkdir -p /harddisk/tmp");
snprintf(string, STRING_SIZE,
"/bin/wget -O /harddisk/tmp/"TARBALL_VARLOG " %s/"TARBALL_VARLOG, network_source);
@@ -514,7 +528,7 @@
break;
}
- statuswindow(60, 4, get_title(), ipcop_gettext("TR_INSTALLING_FILES"));
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_INSTALLING_FILES"));
snprintf(string, STRING_SIZE, "/bin/tar -C /harddisk -xpzf %s/"TARBALL_VARLOG, tarball_location);
if ( mysystem(string) )
{
@@ -581,15 +595,16 @@
}
-void createinitramfs(void)
+void create_initramfs(void)
{
char bigstring[STRING_SIZE_LARGE]; // many modules maybe!
int i;
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_BUILDING_INITRD"));
+
//pivot_root for initrd
mkdir("/harddisk/initrd", S_IRWXU | S_IRWXG | S_IRWXO);
-
strcpy(bigstring, "/bin/chroot /harddisk /sbin/mkinitramfs --with-firmware --with-modules=");
/* owes: this probably no longer necessary */
@@ -623,6 +638,8 @@
strcat (bigstring, " --with-kernel=" KERNEL_VERSION );
mysystem(bigstring);
+
+ newtPopWindow();
}
@@ -634,6 +651,8 @@
char string[STRING_SIZE];
char device[STRING_SIZE];
+ statuswindow(72, 5, ipcop_gettext("TR_TITLE_DISK"), ipcop_gettext("TR_MAKING_BOOTABLE"));
+
snprintf(device, STRING_SIZE, "/dev/%s", dev);
#if defined (__i386__)
@@ -735,4 +754,6 @@
/* Surely alpha must have something marked bootable as well ..... */
#endif
+
+ newtPopWindow();
}
Modified: ipcop/trunk/src/installer/passwords.c
===================================================================
--- ipcop/trunk/src/installer/passwords.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/passwords.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* $Id$
*
@@ -33,10 +33,8 @@
do
{
done = 1;
- newtPushHelpLine(gettext("TR_NO_PASSWORD_ECHO"));
rc = newtWinEntries(get_title(), text,
50, 5, 5, 20, entries, gettext("TR_OK"), gettext("TR_CANCEL"), NULL);
- newtPopHelpLine();
if (rc != 2)
{
Modified: ipcop/trunk/src/installer/setup.c
===================================================================
--- ipcop/trunk/src/installer/setup.c 2008-01-12 22:41:02 UTC (rev 1000)
+++ ipcop/trunk/src/installer/setup.c 2008-01-12 22:50:48 UTC (rev 1001)
@@ -4,7 +4,7 @@
* This program is distributed under the terms of the GNU General Public
* Licence. See the file COPYING for details.
*
- * (c) 2007, the IPCop team
+ * (c) 2007-2008, the IPCop team
*
* Commandline options:
*
@@ -27,6 +27,12 @@
char selected_locale[STRING_SIZE];
+char *ipcop_gettext(char *txt)
+{
+ return gettext(txt);
+}
+
+
int main(int argc, char **argv)
{
int i;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|