mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
Den Installer ordentlich abgespeckt.
restartsyslogd entfernt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@773 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -23,7 +23,7 @@ clean :
|
||||
|
||||
######
|
||||
|
||||
OBJS=main.o ide.o nic.o net.o config.o ../libsmooth/libsmooth.o usb.o scsi.o unattended.o
|
||||
OBJS=main.o nic.o net.o config.o ../libsmooth/libsmooth.o unattended.o
|
||||
|
||||
install: $(OBJS)
|
||||
$(LINK) $(OBJS) -o $@ $(LIBS)
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/* SmoothWall install program.
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*
|
||||
* (c) Lawrence Manning, 2001
|
||||
* Contains some functs for scanning /proc for ide info on CDROMS and
|
||||
* harddisks.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "install.h"
|
||||
|
||||
int initialize_ide() {
|
||||
mysystem("/sbin/modprobe ide-generic");
|
||||
mysystem("/sbin/modprobe generic");
|
||||
mysystem("/sbin/modprobe ide-cd");
|
||||
mysystem("/sbin/modprobe ide-disk");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* checkide(). Scans the named drive letter and returns the IDE_??? type. */
|
||||
int checkide(char letter)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
char filename[STRING_SIZE];
|
||||
char buffer[STRING_SIZE];
|
||||
|
||||
sprintf(filename, "/proc/ide/hd%c/media", letter);
|
||||
|
||||
if (!(f = fopen(filename, "r")))
|
||||
return IDE_EMPTY;
|
||||
|
||||
if (!(fgets(buffer, STRING_SIZE, f)))
|
||||
{
|
||||
printf("Couldn't read from %s\n", filename);
|
||||
fclose(f);
|
||||
return IDE_EMPTY;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
stripnl(buffer);
|
||||
|
||||
if (strcmp(buffer, "cdrom") == 0)
|
||||
return IDE_CDROM;
|
||||
else if (strcmp(buffer, "disk") == 0)
|
||||
return IDE_HD;
|
||||
else
|
||||
return IDE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* findidetype(). Finds the first ide deveice of the given IDE_?? type. */
|
||||
char findidetype(int type)
|
||||
{
|
||||
char letter;
|
||||
|
||||
for (letter = 'a'; letter <= 'z'; letter++)
|
||||
{
|
||||
if ((checkide(letter)) == type)
|
||||
{
|
||||
return letter;
|
||||
}
|
||||
}
|
||||
return '\0';
|
||||
}
|
||||
|
||||
@@ -26,14 +26,6 @@ struct devparams
|
||||
char options[STRING_SIZE];
|
||||
};
|
||||
|
||||
/* ide.c */
|
||||
int initialize_ide();
|
||||
int checkide(char letter);
|
||||
char findidetype(int type);
|
||||
|
||||
/* cdrom.c */
|
||||
int ejectcdrom(char *dev);
|
||||
|
||||
/* nic.c */
|
||||
int networkmenu(struct keyvalue *ethernetkv);
|
||||
|
||||
@@ -45,14 +37,5 @@ int write_disk_configs(struct devparams *dp);
|
||||
int write_lang_configs( char *lang);
|
||||
int write_ethernet_configs(struct keyvalue *ethernetkv);
|
||||
|
||||
/* usb.c */
|
||||
int initialize_usb();
|
||||
int write_usb_modules_conf();
|
||||
int checkusb (char *partition);
|
||||
|
||||
/* scsi.c */
|
||||
int try_scsi(char *dev);
|
||||
int get_boot(char *dev);
|
||||
|
||||
/* unattended.c */
|
||||
int unattended_setup(struct keyvalue *unattendedkv);
|
||||
|
||||
@@ -142,29 +142,23 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
|
||||
} else {
|
||||
mysystem("/sbin/modprobe ide-generic");
|
||||
mysystem("/sbin/modprobe generic");
|
||||
mysystem("/sbin/modprobe ide-cd");
|
||||
mysystem("/sbin/modprobe ide-disk");
|
||||
mysystem("/sbin/modprobe sd_mod");
|
||||
mysystem("/sbin/modprobe sr_mod");
|
||||
mysystem("/sbin/modprobe usb-storage");
|
||||
|
||||
fgets(line, STRING_SIZE, cmdfile);
|
||||
if (strstr (line, "noide") == NULL) {
|
||||
fprintf(flog, "Initializing IDE controllers.\n");
|
||||
initialize_ide();
|
||||
} else {
|
||||
fprintf(flog, "Skipping IDE detection.\n");
|
||||
}
|
||||
if (strstr (line, "nousb") == NULL) {
|
||||
fprintf(flog, "Initializing USB controllers.\n");
|
||||
initialize_usb();
|
||||
} else {
|
||||
fprintf(flog, "Skipping USB detection.\n");
|
||||
}
|
||||
|
||||
// check if we have to make an unattended install
|
||||
if (strstr (line, "unattended") != NULL) {
|
||||
unattended = 1;
|
||||
}
|
||||
// Loading the cdrom-filesystem and ext2
|
||||
mysystem("/sbin/modprobe iso9660");
|
||||
mysystem("/sbin/modprobe ext2");
|
||||
|
||||
// Loading the via_rhine driver because it isn't detected correctly (sometimes)
|
||||
mysystem("/sbin/modprobe via-rhine");
|
||||
mysystem("/sbin/modprobe iso9660"); // CDROM
|
||||
mysystem("/sbin/modprobe ext2"); // Boot patition
|
||||
mysystem("/sbin/modprobe vfat"); // USB key
|
||||
}
|
||||
|
||||
if (unattended) {
|
||||
@@ -535,9 +529,6 @@ int main(int argc, char *argv[])
|
||||
errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
/* Save USB controller type to modules.conf */
|
||||
write_usb_modules_conf();
|
||||
|
||||
/* Save language und local settings */
|
||||
write_lang_configs(shortlangname);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/* IPCop install program.
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*
|
||||
* (c) Alan Hourihane, 2003 <alanh@fairlite.demon.co.uk>
|
||||
*
|
||||
* $Id: scsi.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include "install.h"
|
||||
|
||||
int
|
||||
try_scsi(char *disk_device)
|
||||
{
|
||||
int fd;
|
||||
char dev[10];
|
||||
|
||||
sprintf(dev, "/dev/%s", disk_device);
|
||||
|
||||
if ((fd = open(dev, O_RDONLY)) < 0)
|
||||
return 0;
|
||||
|
||||
close(fd);
|
||||
// remove usb scsi
|
||||
return (checkusb(disk_device) ? 0:1);
|
||||
//return 1;
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* This file is part of the IPCop Firewall.
|
||||
*
|
||||
* IPCop 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.
|
||||
*
|
||||
* IPCop 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 IPCop; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Copyright 2002: Mark Wormgoor <mark@wormgoor.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "install.h"
|
||||
|
||||
int usbuhci = 0;
|
||||
int usbohci = 0;
|
||||
int ehcihcd = 0;
|
||||
|
||||
int initialize_usb() {
|
||||
mysystem("/sbin/modprobe sd_mod");
|
||||
mysystem("/sbin/modprobe sr_mod");
|
||||
mysystem("/sbin/modprobe usb-storage");
|
||||
mysystem("/sbin/modprobe vfat");
|
||||
|
||||
if (ehcihcd) {
|
||||
mysystem("/sbin/rmmod ehci-hcd");
|
||||
ehcihcd = 0;
|
||||
}
|
||||
if (usbohci) {
|
||||
mysystem("/sbin/rmmod ohci-hcd");
|
||||
usbohci = 0;
|
||||
}
|
||||
if (usbuhci) {
|
||||
mysystem("/sbin/rmmod uhci-hcd");
|
||||
usbuhci = 0;
|
||||
}
|
||||
|
||||
if (mysystem("/sbin/modprobe ehci-hcd") == 0)
|
||||
ehcihcd = 1;
|
||||
if (mysystem("/sbin/modprobe ohci-hcd") == 0)
|
||||
usbohci = 1;
|
||||
if (mysystem("/sbin/modprobe uhci-hcd") == 0)
|
||||
usbuhci = 1;
|
||||
|
||||
mysystem("/sbin/modprobe usbhid");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int write_usb_modules_conf() {
|
||||
int index;
|
||||
FILE *handle;
|
||||
|
||||
if (!(handle = fopen("/harddisk/etc/modules.conf", "a")))
|
||||
return 0;
|
||||
|
||||
index = 0;
|
||||
|
||||
#if 0 /* we don't do this yet, because one of the drivers has a problem
|
||||
* with it */
|
||||
if (ehcihcd) {
|
||||
if (index)
|
||||
fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
|
||||
else
|
||||
fprintf(handle,"alias usb-controller ehci-hcd\n");
|
||||
index++;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (usbohci) {
|
||||
if (index)
|
||||
fprintf(handle,"alias usb-controller%d ohci-hcd\n",index);
|
||||
else
|
||||
fprintf(handle,"alias usb-controller ohci-hcd\n");
|
||||
index++;
|
||||
}
|
||||
|
||||
if (usbuhci) {
|
||||
if (index)
|
||||
fprintf(handle,"alias usb-controller%d uhci-hcd\n",index);
|
||||
else
|
||||
fprintf(handle,"alias usb-controller uhci-hcd\n");
|
||||
index++;
|
||||
}
|
||||
fclose(handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Scans the named partitions and returns true if USB-removable. */
|
||||
int checkusb(char *device)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
char filename[STRING_SIZE];
|
||||
char command[STRING_SIZE];
|
||||
char buffer[STRING_SIZE];
|
||||
int found = 0;
|
||||
|
||||
sprintf(command, "udevinfo -a -p /sys/block/%s | grep BUS | sort| uniq >/tmp/usbscan 2>/dev/null", device);
|
||||
system(command);
|
||||
|
||||
f = fopen("/tmp/usbscan", "r");
|
||||
while (fgets(buffer, STRING_SIZE, f)) {
|
||||
if (strstr(buffer,"usb")) found=1;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
if (found) return 0;
|
||||
else return 1;
|
||||
}
|
||||
@@ -18,9 +18,6 @@ int handlehostname(void);
|
||||
/* domainname.c */
|
||||
int handledomainname(void);
|
||||
|
||||
/* isdn.c */
|
||||
int handleisdn(void);
|
||||
|
||||
/* networking.c */
|
||||
int handlenetworking(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user