Installer repariert

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@46 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2006-02-19 13:16:13 +00:00
parent 0e325635f8
commit 10bc6f0635
9 changed files with 732 additions and 841 deletions

View File

@@ -1,159 +1,159 @@
!!! List of softwares used to build IPFire Version:1.4.11
* 3c5x9setup-1.00
* 3cp4218-2003-10-22
* CnxADSL-TgrATMcln-20041004
* Compress-Zlib-1.35
* Digest-1.08
* Digest-HMAC-1.01
* Digest-SHA1-2.10
* GD-2.12
* HTML-Parser-3.45
* HTML-Tagset-3.04
* LPRng-3.8.28
* Linux-PAM-0.99.3.0
* Net-DNS-0.47
* Net-IPv4Addr-0.10
* Net_SSLeay.pm-1.25
* Python-2.3.4
* URI-1.35
* amedyn-2004-08-04
* apache_1.3.34
* arping-2.05
* as86-0.16.17
* autoconf-2.59
* automake-1.8.4
* bash-2.05b
* bast-0.9.0
* beep-1.2.2
* bind-9.2.5
* binutils-2.15.90.0.3
* bison-1.875
* busybox-0.60.5
* bzip2-1.0.3
* capi4k-utils-2004-10-06
* ccache-2.3
* cdrtools-2.01
* coreutils-5.93
* cxacru-2003-10-05
* dhcp-3.0.2
* dhcpcd-1.3.22-pl4
* diffutils-2.8.1
* dnsmasq-2.22
* dosfstools-2.11
* e2fsprogs-1.35
* eagle-usb-2.3.2
* eciadsl-usermode-0.11
* ed-0.2
* ethtool-3
* expat-1.95.7
* ez-ipupdate-3.0.11b8
* fcdsl-suse8.2-03.11.02
* fcdsl2-suse9.0-03.11.04
* fcdslsl-suse8.2-03.11.02
* fcdslslusb-suse8.2-03.11.04
* fcdslusb-suse8.2-03.11.02
* fcron-2.0.2
* file-4.16
* findutils-4.1.20
* flex-2.5.4a
* gawk-3.1.3
* gcc-3.3.3
* gd-2.0.20
* gdbm-1.8.3
* gettext-0.14.1
* glibc-2.3.3-lfs-5.1
* gmp-4.1.2
* gnupg-1.4.2
* grep-2.5.1
* groff-1.19
* grub-0.95
* gzip-1.3.5
* hdparm-6.3
* httpd-2.2.0
* iana-etc-2.00
* ibod
* inetutils-1.4.2
* ipac-ng-1.31
* ipaddr-1.2
* iproute2-2.4.7-now-ss010824
* iptables-1.3.5
* iptstate-1.4
* iputils-ss020927
* isapnptools-1.26
* isdn4k-utils.v3.2p1
* kbd-1.12
* kudzu-0.99.50
* less-382
* libcap-1.10
* libnet-1.1.2.1
* libpcap-0.8.3
* libpng-1.2.8
* libsafe_2.0-16
* libtool-1.5.6
* libusb-0.1.7
* libwww-perl-5.803
* linux-2.4.31
* linux-atm-2.4.1
* logrotate-3.7
* logwatch-6.1.2
* m4-1.4
* make-3.80
* make_devices-1.2
* man-1.5p
* man-pages-2.17
* mbr-1.1.8
* mingetty-1.06
* misc-progs
* mktemp-1.5
* modutils-2.4.27
* mtools-3.9.9
* nano-1.2.4
* nash
* nasm-0.98.36
* ncurses-5.4
* net-tools-1.60
* newt-utf8_0.50.17
* noip_updater_v1.6
* ntp-4.2.0
* oinkmaster-1.2
* openssh-3.9p1
* openssl-0.9.7i
* openswan-1.0.10
* patch-2.5.4
* pciutils-2.1.11
* pcmcia-cs-3.2.8
* pcre-4.5
* perl-5.8.5
* popt-1.7
* ppp-2.4.2
* pptp-1.6.0
* procinfo-18
* procps-3.2.5
* psmisc-21.4
* pulsar-4.0.19
* rp-pppoe-3.5
* rrdtool-1.0.49
* sed-4.0.9
* setserial-2.17
* shadow-4.0.4.1
* slang-1.4.5-mini
* snort-2.3.3
* speedtouch-1.2
* squid-2.5.STABLE12
* squid-graph-3.1
* stund_0.96_Aug13
* sysklogd-1.4.1
* syslinux-2.11
* sysvinit-2.86
* tar-1.13.25
* tcpdump-3.8.3
* texinfo-4.7
* traceroute-1.4a12
* uClibc-0.9.26
* unzip552
* util-linux-2.12r
* vim-6.3
* vlan.1.9
* wireless_tools.27
* xampp-linux-1.5.1
* zlib-1.2.3
!!! List of softwares used to build IPFire Version:1.4.11
* 3c5x9setup-1.00
* 3cp4218-2003-10-22
* CnxADSL-TgrATMcln-20041004
* Compress-Zlib-1.35
* Digest-1.08
* Digest-HMAC-1.01
* Digest-SHA1-2.10
* GD-2.12
* HTML-Parser-3.45
* HTML-Tagset-3.04
* LPRng-3.8.28
* Linux-PAM-0.99.3.0
* Net-DNS-0.47
* Net-IPv4Addr-0.10
* Net_SSLeay.pm-1.25
* Python-2.3.4
* URI-1.35
* amedyn-2004-08-04
* apache_1.3.34
* arping-2.05
* as86-0.16.17
* autoconf-2.59
* automake-1.8.4
* bash-2.05b
* bast-0.9.0
* beep-1.2.2
* bind-9.2.5
* binutils-2.15.90.0.3
* bison-1.875
* busybox-0.60.5
* bzip2-1.0.3
* capi4k-utils-2004-10-06
* ccache-2.3
* cdrtools-2.01
* coreutils-5.93
* cxacru-2003-10-05
* dhcp-3.0.2
* dhcpcd-1.3.22-pl4
* diffutils-2.8.1
* dnsmasq-2.22
* dosfstools-2.11
* e2fsprogs-1.35
* eagle-usb-2.3.2
* eciadsl-usermode-0.11
* ed-0.2
* ethtool-3
* expat-1.95.7
* ez-ipupdate-3.0.11b8
* fcdsl-suse8.2-03.11.02
* fcdsl2-suse9.0-03.11.04
* fcdslsl-suse8.2-03.11.02
* fcdslslusb-suse8.2-03.11.04
* fcdslusb-suse8.2-03.11.02
* fcron-2.0.2
* file-4.16
* findutils-4.1.20
* flex-2.5.4a
* gawk-3.1.3
* gcc-3.3.3
* gd-2.0.20
* gdbm-1.8.3
* gettext-0.14.1
* glibc-2.3.3-lfs-5.1
* gmp-4.1.2
* gnupg-1.4.2
* grep-2.5.1
* groff-1.19
* grub-0.95
* gzip-1.3.5
* hdparm-6.3
* httpd-2.2.0
* iana-etc-2.00
* ibod
* inetutils-1.4.2
* ipac-ng-1.31
* ipaddr-1.2
* iproute2-2.4.7-now-ss010824
* iptables-1.3.5
* iptstate-1.4
* iputils-ss020927
* isapnptools-1.26
* isdn4k-utils.v3.2p1
* kbd-1.12
* kudzu-0.99.50
* less-382
* libcap-1.10
* libnet-1.1.2.1
* libpcap-0.8.3
* libpng-1.2.8
* libsafe_2.0-16
* libtool-1.5.6
* libusb-0.1.7
* libwww-perl-5.803
* linux-2.4.31
* linux-atm-2.4.1
* logrotate-3.7
* logwatch-6.1.2
* m4-1.4
* make-3.80
* make_devices-1.2
* man-1.5p
* man-pages-2.17
* mbr-1.1.8
* mingetty-1.06
* misc-progs
* mktemp-1.5
* modutils-2.4.27
* mtools-3.9.9
* nano-1.2.4
* nash
* nasm-0.98.36
* ncurses-5.4
* net-tools-1.60
* newt-utf8_0.50.17
* noip_updater_v1.6
* ntp-4.2.0
* oinkmaster-1.2
* openssh-3.9p1
* openssl-0.9.7i
* openswan-1.0.10
* patch-2.5.4
* pciutils-2.1.11
* pcmcia-cs-3.2.8
* pcre-4.5
* perl-5.8.5
* popt-1.7
* ppp-2.4.2
* pptp-1.6.0
* procinfo-18
* procps-3.2.5
* psmisc-21.4
* pulsar-4.0.19
* rp-pppoe-3.5
* rrdtool-1.0.49
* sed-4.0.9
* setserial-2.17
* shadow-4.0.4.1
* slang-1.4.5-mini
* snort-2.3.3
* speedtouch-1.2
* squid-2.5.STABLE12
* squid-graph-3.1
* stund_0.96_Aug13
* sysklogd-1.4.1
* syslinux-2.11
* sysvinit-2.86
* tar-1.13.25
* tcpdump-3.8.3
* texinfo-4.7
* traceroute-1.4a12
* uClibc-0.9.26
* unzip552
* util-linux-2.12r
* vim-6.3
* vlan.1.9
* wireless_tools.27
* xampp-linux-1.5.1
* zlib-1.2.3

View File

@@ -1,5 +1,5 @@
#
# $Id: Makefile,v 1.6.2.2 2006/01/11 01:01:38 franck78 Exp $
# $Id: Makefile,v 1.6 2004/02/24 21:24:10 alanh Exp $
#
CC = gcc
@@ -16,57 +16,18 @@ LINK = $(LD) $(LDFLAGS)
all : programs
programs : install install2
programs : install
clean :
-rm -f *.o install core
######
# Macro to extract from the full set of translations only what is really used
# into the installer (install&install2). Each needed entry have a "comment
# inside the main source file"
define lang_install
rm $(OBJS3); \
for i in /usr/src/langs/*/install/lang_*.c ; do \
path=$${i%/*}/; \
file=../libsmooth/$${i/$$path/}; \
echo "#include \"libsmooth.h\"" > $$file; \
grep "^char \*" $$i >> $$file; \
echo "#include \"libsmooth.h\"" > $$file; \
grep "^char \*" $$i >> $$file; \
grep "^/\* TR_*" ../install/$$SELECT|xargs -i% grep -FA1 % $$i >> $$file; \
echo "};">>$$file; \
done
#build the tr_strings include file
awk 'BEGIN{ print"enum trstrings{" } \
$$0 ~/\/\* (TR_[A-Z0-9_]*)/ {print $$2"," }\
END{ print "};" }' ../libsmooth/lang_en.c > ../libsmooth/langs.h
endef
lang_install:
SELECT=main.c; \
$(lang_install)
cp ../libsmooth/langs.h main_langs.h
OBJS=main.o ide.o cdrom.o nic.o net.o config.o ../libsmooth/libsmooth.o \
pcmcia.o upgrade-v12-v13.o upgrade-v130-v140.o usb.o scsi.o
lang_install2:
SELECT=install2.c; \
$(lang_install)
cp ../libsmooth/langs.h install_langs.h
OBJS1=main.o ide.o cdrom.o nic.o net.o config.o pcmcia.o usb.o scsi.o
OBJS2=install2.o upgrade-v12-v13.o upgrade-v130-v140.o
OBJS3=../libsmooth/main.o ../libsmooth/netstuff.o ../libsmooth/varval.o
install: lang_install $(OBJS1) $(OBJS3) install.h ../libsmooth/langs.h ../libsmooth/libsmooth.h /install/include/newt.h
$(LINK) $(OBJS1) $(OBJS3) -o $@ $(LIBS)
install2: lang_install2 $(OBJS2) $(OBJS3)
#strange 'make': even if files $OBJS3 are deleted, they are not recompiled,
#so I explicitly recompile them (needed because langs.h have changed).
$(foreach I, $(OBJS3), $(COMPILE) $(patsubst %.o,%.c,$(I)) -o $(I);)
$(LINK) $(OBJS2) $(OBJS3) -o $@ $(LIBS)
install: $(OBJS)
$(LINK) $(OBJS) -o $@ $(LIBS)
%.o : %.c
$(COMPILE) $< -o $@
.PHONY : lang_install lang_install2 clean

View File

@@ -6,46 +6,74 @@
* (c) Lawrence Manning, 2001
* Write the config and get password stuff.
*
* $Id: config.c,v 1.6.2.3 2005/12/07 20:42:48 franck78 Exp $
* $Id: config.c,v 1.6.2.2 2004/08/23 21:09:44 alanh Exp $
*
*/
#include "install.h"
extern char **ctr; // text translation table
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int raid_disk;
/* called to write out all config files using the keyvalue interface. */
int write_disk_configs(struct devparams *dp)
{
char devnode[STRING_SIZE];
char partition[STRING_SIZE];
char *messages[5] = { NULL,
ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK1],
ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK2],
ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK3],
ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK4]
};
/* dev node links. */
sprintf(devnode, "%s", dp->devnode_disk_run);
snprintf(devnode, STRING_SIZE, "%s", dp->devnode);
if (symlink(devnode, "/harddisk/dev/harddisk"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK]);
return 0;
}
int j;
for (j=1; j<5; j++) {
sprintf(devnode, "%s%d", dp->devnode_part_run,j);
sprintf(partition,"/harddisk/dev/harddisk%d",j);
if (symlink(devnode, partition))
{
errorbox( messages[j] );
return 0;
}
if (raid_disk)
snprintf(devnode, STRING_SIZE, "%sp1", dp->devnode);
else
snprintf(devnode, STRING_SIZE, "%s1", dp->devnode);
if (symlink(devnode, "/harddisk/dev/harddisk1"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK1]);
return 0;
}
if (raid_disk)
snprintf(devnode, STRING_SIZE, "%sp2", dp->devnode);
else
snprintf(devnode, STRING_SIZE, "%s2", dp->devnode);
if (symlink(devnode, "/harddisk/dev/harddisk2"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK2]);
return 0;
}
if (raid_disk)
snprintf(devnode, STRING_SIZE, "%sp3", dp->devnode);
else
snprintf(devnode, STRING_SIZE, "%s3", dp->devnode);
if (symlink(devnode, "/harddisk/dev/harddisk3"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK3]);
return 0;
}
if (raid_disk)
snprintf(devnode, STRING_SIZE, "%sp4", dp->devnode);
else
snprintf(devnode, STRING_SIZE, "%s4", dp->devnode);
if (symlink(devnode, "/harddisk/dev/harddisk4"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK4]);
return 0;
}
/* Add /dev/root symlink linking to the root filesystem to
* keep updfstab happy */
sprintf(devnode, "%s4", dp->devnode_part_run);
if (raid_disk)
snprintf(devnode, STRING_SIZE, "%sp4", dp->devnode);
else
snprintf(devnode, STRING_SIZE, "%s4", dp->devnode);
if (symlink(devnode, "/harddisk/dev/root"))
{
errorbox(ctr[TR_UNABLE_TO_MAKE_SYMLINK_DEV_ROOT]);
@@ -123,3 +151,4 @@ int getpassword(char *password, char *text)
return rc;
}

View File

@@ -6,7 +6,7 @@
* (c) Lawrence Manning, 2001
* Main include file.
*
* $Id: install.h,v 1.10.2.4 2006/01/11 01:01:38 franck78 Exp $
* $Id: install.h,v 1.10 2004/02/24 21:24:10 alanh Exp $
*
*/
@@ -20,13 +20,10 @@
/* CDROMS and harddisks. */
struct devparams
{
char devnode_disk[30]; // when single partition is addressed
char devnode_part[30]; // when the RAID partition is addressed
char devnode_disk_run[30]; // the same dev but after installation
char devnode_part_run[30];
char devnode[STRING_SIZE];
int module;
char modulename[STRING_SIZE];
char options[STRING_SIZE];
// int module;
};
/* ide.c */
@@ -59,34 +56,7 @@ int upgrade_v130_v140();
/* 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);
/*main.c */
int modprobe (char *mod);
int rmmod (char *mod);
extern char *bz_tr[];
extern char *cs_tr[];
extern char *da_tr[];
extern char *en_tr[];
extern char *es_tr[];
extern char *fi_tr[];
extern char *fr_tr[];
extern char *hu_tr[];
extern char *la_tr[];
extern char *nl_tr[];
extern char *de_tr[];
extern char *tr_tr[];
extern char *it_tr[];
extern char *el_tr[];
extern char *pl_tr[];
extern char *pt_tr[];
extern char *sk_tr[];
extern char *so_tr[];
extern char *sv_tr[];
extern char *no_tr[];
extern char *vi_tr[];

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
* Contains stuff related to firing up the network card, including a crude
* autodector.
*
* $Id: nic.c,v 1.8.2.2 2005/12/24 09:08:26 franck78 Exp $
* $Id: nic.c,v 1.8.2.1 2004/04/14 22:05:40 gespinasse Exp $
*
*/
@@ -19,7 +19,9 @@
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern struct nic nics[];
int networkmenu(struct keyvalue *ethernetkv)
@@ -27,6 +29,7 @@ int networkmenu(struct keyvalue *ethernetkv)
int rc;
char driver[STRING_SIZE] = "";
char driveroptions[STRING_SIZE] = "";
struct keyvalue *kv = initkeyvalues();
int result = 0;
char commandstring[STRING_SIZE];
char address[STRING_SIZE], netmask[STRING_SIZE];
@@ -92,6 +95,7 @@ int networkmenu(struct keyvalue *ethernetkv)
result = 1;
EXIT:
freekeyvalues(kv);
return result;
}

View File

@@ -21,7 +21,7 @@
* <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* $Id: pcmcia.c,v 1.6.2.4 2005/12/08 02:12:28 franck78 Exp $
* $Id: pcmcia.c,v 1.6.2.2 2005/01/31 15:49:43 alanh Exp $
*
*/
@@ -35,7 +35,6 @@
#endif
extern FILE *flog;
extern int modprobe(char *);
/*====================================================================*/
@@ -141,8 +140,6 @@ static u_char i365_get(u_short sock, u_short reg)
return val;
}
#if 0 // the following code do nothing usefull, it ends with return 0 anyway
static void i365_set(u_short sock, u_short reg, u_char data)
{
u_char val = I365_REG(sock, reg);
@@ -162,12 +159,11 @@ static void i365_bclr(u_short sock, u_short reg, u_char mask)
d &= ~mask;
i365_set(sock, reg, d);
}
#endif
int i365_probe()
{
int val, slot, sock, done;
// char *name = "i82365sl";
char *name = "i82365sl";
ioperm(i365_base, 4, 1);
ioperm(0x80, 1, 1);
@@ -176,17 +172,17 @@ int i365_probe()
val = i365_get(sock, I365_IDENT);
switch (val) {
case 0x82:
// name = "i82365sl A step";
// break;
name = "i82365sl A step";
break;
case 0x83:
// name = "i82365sl B step";
// break;
name = "i82365sl B step";
break;
case 0x84:
// name = "VLSI 82C146";
// break;
name = "VLSI 82C146";
break;
case 0x88: case 0x89: case 0x8a:
// name = "IBM Clone";
// break;
name = "IBM Clone";
break;
case 0x8b: case 0x8c:
break;
default:
@@ -202,7 +198,6 @@ int i365_probe()
return -1;
}
#if 0 // the following code do nothing usefull, it ends with return 0 anyway
if ((sock == 2) && (strcmp(name, "VLSI 82C146") == 0))
name = "i82365sl DF";
@@ -236,7 +231,7 @@ int i365_probe()
name = "VIA VT83C469";
}
}
#endif
return 0;
} /* i365_probe */
@@ -303,30 +298,38 @@ int tcic_probe(ioaddr_t base)
#endif
/*====================================================================*/
char * initialize_pcmcia (void)
{
#ifndef __alpha__
ioaddr_t tcic_base = TCIC_BASE;
#endif
char* pcmcia;
if ((pcmcia = pci_probe()))
return pcmcia; /* we're all done */
int len;
char *pcmcia = NULL;
if ((pcmcia = pci_probe())) {
/* we're all done */
#ifndef __alpha__
else if (i365_probe() == 0)
return "i82365";
else if (tcic_probe(tcic_base) == 0)
return "tcic";
} else if (i365_probe() == 0) {
len = strlen("i82365") + 1;
pcmcia = calloc(1, len);
strncpy(pcmcia, "i82365", len);
} else if (tcic_probe(tcic_base) == 0) {
len = strlen("tcic") + 1;
pcmcia = calloc(1, len);
strncpy(pcmcia, "tcic", len);
#endif
else {
} else {
/* Detect ISAPNP based i82365 controllers */
FILE *f;
modprobe("i82365");
mysystem("modprobe i82365");
if ((f = fopen("/proc/bus/pccard/00/info", "r"))) {
len = strlen("i82365") + 1;
pcmcia = calloc(1, len);
strncpy(pcmcia, "i82365", len);
fclose(f);
return "i82365";
}
}
return NULL;
return pcmcia;
}

View File

@@ -23,6 +23,6 @@ try_scsi(char *disk_device)
return 0;
close(fd);
// remove usb scsi
return ( checkusb(disk_device) ? 0:1 );
return 1;
}

View File

@@ -17,7 +17,7 @@
*
* Copyright 2002: Mark Wormgoor <mark@wormgoor.com>
*
* $Id: usb.c,v 1.9.2.8 2005/12/10 00:18:23 franck78 Exp $
* $Id: usb.c,v 1.9.2.3 2004/11/16 22:48:43 alanh Exp $
*
*/
@@ -28,114 +28,71 @@ int usbohci = 0;
int ehcihcd = 0;
int initialize_usb() {
modprobe("sd_mod");
modprobe("sr_mod");
modprobe("usb-storage");
mysystem("/sbin/modprobe sd_mod");
mysystem("/sbin/modprobe sr_mod");
mysystem("/sbin/modprobe usb-storage");
if (ehcihcd) {
rmmod("ehci-hcd");
mysystem("/sbin/rmmod ehci-hcd");
ehcihcd = 0;
}
if (usbohci) {
rmmod("usb-ohci");
mysystem("/sbin/rmmod usb-ohci");
usbohci = 0;
}
if (usbuhci) {
rmmod("usb-uhci");
mysystem("/sbin/rmmod usb-uhci");
usbuhci = 0;
}
if (modprobe("ehci-hcd") == 0) ehcihcd = 1;
if (modprobe("usb-ohci") == 0) usbohci = 1;
if (modprobe("usb-uhci") == 0) usbuhci = 1;
if (mysystem("/sbin/modprobe ehci-hcd") == 0)
ehcihcd = 1;
if (mysystem("/sbin/modprobe usb-ohci") == 0)
usbohci = 1;
if (mysystem("/sbin/modprobe usb-uhci") == 0)
usbuhci = 1;
modprobe("hid");
modprobe("keybdev");
mysystem("/sbin/modprobe hid");
mysystem("/sbin/modprobe keybdev");
return 0;
}
int write_usb_modules_conf() {
int index = 0;
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) {
fprintf(handle,"alias usb-controller");
if (index)
fprintf(handle,"%d",index);
fprintf(handle," ehci-hcd\n");
fprintf(handle,"alias usb-controller%d ehci-hcd\n",index);
else
fprintf(handle,"alias usb-controller ehci-hcd\n");
index++;
}
#endif
if (usbohci) {
fprintf(handle,"alias usb-controller");
if (index)
fprintf(handle,"%d",index);
fprintf(handle," usb-ohci\n");
fprintf(handle,"alias usb-controller%d usb-ohci\n",index);
else
fprintf(handle,"alias usb-controller usb-ohci\n");
index++;
}
if (usbuhci) {
fprintf(handle,"alias usb-controller");
if (index)
fprintf(handle,"%d",index);
fprintf(handle," usb-uhci\n");
fprintf(handle,"alias usb-controller%d usb-uhci\n",index);
else
fprintf(handle,"alias usb-controller usb-uhci\n");
index++;
}
fclose(handle);
return 0;
}
/* checkusb().
Scans the named partitions and returns true if USB-removable.
a bug? in "cat /proc/partitions" with superfloppy scheme device
make them appearing always with four 'false' partitions:
sda and sda1 sda2 sda3 sda4.
No easy way to decide if /dev/sda1 exists or not.
*/
int checkusb(char *partition)
{
FILE *f = NULL;
char filename[STRING_SIZE];
char buffer[STRING_SIZE];
char *pchar = &buffer[0];
if (!(f = fopen("/proc/partitions", "r")))
return 0;
short int major = 0, minor = 0;
while (fgets(buffer, STRING_SIZE, f)) {
/* look for partition*/
if (strstr (buffer, partition)) {
major = atoi (buffer);
if (major != 8) break ; /* not scsi */
//get minor
while (*pchar != '8') pchar++;
minor = atoi (++pchar);
break;
}
}
fclose(f);
if (major != 8) return 0; /* nothing found */
//now check for usb-storage-MINOR
minor >>= 4; // get index from minor
sprintf (filename, "/proc/scsi/usb-storage-%d/%d", minor,minor);
if (!(f = fopen(filename, "r")))
return 0;
int count = 0;
while (fgets(buffer, STRING_SIZE, f)) {
if (strstr(buffer,"usb-storage")) count++;
if (strstr(buffer,"SCSI")) count++;
if (strstr(buffer,"Attached: Yes")) count++;
}
fclose(f);
return (count==3 ? 1 : 0);
}