From 10bc6f06351b7417014e0b2a59788231e51ff201 Mon Sep 17 00:00:00 2001 From: ms Date: Sun, 19 Feb 2006 13:16:13 +0000 Subject: [PATCH] Installer repariert git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@46 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- doc/packages-list.txt | 318 +++++----- src/install+setup/install/Makefile | 51 +- src/install+setup/install/config.c | 71 ++- src/install+setup/install/install.h | 36 +- src/install+setup/install/main.c | 925 ++++++++++++++-------------- src/install+setup/install/nic.c | 6 +- src/install+setup/install/pcmcia.c | 59 +- src/install+setup/install/scsi.c | 4 +- src/install+setup/install/usb.c | 97 +-- 9 files changed, 729 insertions(+), 838 deletions(-) diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 97f982938a..1e733cb2d7 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -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 diff --git a/src/install+setup/install/Makefile b/src/install+setup/install/Makefile index 4136e761fd..7f5fc6e672 100644 --- a/src/install+setup/install/Makefile +++ b/src/install+setup/install/Makefile @@ -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 diff --git a/src/install+setup/install/config.c b/src/install+setup/install/config.c index 89cfa5921c..a5baa8d293 100644 --- a/src/install+setup/install/config.c +++ b/src/install+setup/install/config.c @@ -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; } + diff --git a/src/install+setup/install/install.h b/src/install+setup/install/install.h index c04984fb53..1b004bc373 100644 --- a/src/install+setup/install/install.h +++ b/src/install+setup/install/install.h @@ -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[]; diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index 4b17e2e182..9770358d73 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -6,9 +6,10 @@ * (c) Lawrence Manning, 2001 * Contains main entry point, and misc functions. * - * $Id: main.c,v 1.63.2.64 2006/01/11 01:01:38 franck78 Exp $ + * $Id: main.c,v 1.63.2.57 2005/09/25 19:57:46 gespinasse Exp $ * */ + #include "install.h" #define CDROM_INSTALL 0 @@ -17,114 +18,32 @@ int raid_disk = 0; FILE *flog = NULL; char *mylog; + char **ctr; char *pcmcia = NULL; extern char url[STRING_SIZE]; -/* - To include a translated string in the final installer, you must reference - it here with a simplr comment. This save a lot a space in the installer -*/ -/* TR_WELCOME */ -/* TR_HELPLINE */ -/* TR_OK */ -/* TR_ERROR */ -/* TR_SELECT_INSTALLATION_MEDIA_LONG */ -/* TR_SELECT_INSTALLATION_MEDIA */ -/* TR_CANCEL */ -/* TR_INSERT_FLOPPY */ -/* TR_INSTALLATION_CANCELED */ -/* TR_EXTRACTING_MODULES */ -/* TR_UNABLE_TO_EXTRACT_MODULES */ -/* TR_LOADING_PCMCIA */ -/* TR_PROBING_SCSI */ -/* TR_NO_CDROM */ -/* TR_INSERT_CDROM */ -/* TR_USB_KEY_VFAT_ERR */ -/* TR_NETWORK_SETUP_FAILED */ -/* TR_NO_IPCOP_TARBALL_FOUND */ -/* TR_NO_SCSI_IMAGE_FOUND */ -/* TR_INSTALLING_FILES */ -/* TR_UNABLE_TO_INSTALL_FILES */ -/* TR_NO_HARDDISK */ -/* TR_PREPARE_HARDDISK */ -/* TR_DISK_TOO_SMALL */ -/* TR_CONTINUE_NO_SWAP */ -/* TR_PARTITIONING_DISK */ -/* TR_UNABLE_TO_PARTITION */ -/* TR_MAKING_BOOT_FILESYSTEM */ -/* TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM */ -/* TR_MAKING_LOG_FILESYSTEM */ -/* TR_UNABLE_TO_MAKE_LOG_FILESYSTEM */ -/* TR_MAKING_ROOT_FILESYSTEM */ -/* TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM */ -/* TR_MOUNTING_ROOT_FILESYSTEM */ -/* TR_UNABLE_TO_MOUNT_ROOT_FILESYSTEM */ -/* TR_MAKING_SWAPSPACE */ -/* TR_UNABLE_TO_MAKE_SWAPSPACE */ -/* TR_MOUNTING_SWAP_PARTITION */ -/* TR_UNABLE_TO_MOUNT_SWAP_PARTITION */ -/* TR_MOUNTING_BOOT_FILESYSTEM */ -/* TR_UNABLE_TO_MOUNT_BOOT_FILESYSTEM */ -/* TR_MOUNTING_LOG_FILESYSTEM */ -/* TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM */ -/* TR_ERROR_WRITING_CONFIG */ -/* TR_INSTALLING_GRUB */ -/* TR_UNABLE_TO_INSTALL_GRUB */ -/* TR_UNABLE_TO_UNMOUNT_CDROM */ -/* TR_UNABLE_TO_EJECT_CDROM */ -/* TR_CONGRATULATIONS_LONG */ -/* TR_CONGRATULATIONS */ -/* TR_PRESS_OK_TO_REBOOT */ - -// in nic.c -/* TR_CONFIGURE_NETWORKING */ -/* TR_PROBE */ -/* TR_SELECT */ -/* TR_CONFIGURE_NETWORKING_LONG */ -/* TR_PROBE_FAILED */ -/* TR_FOUND_NIC */ -/* TR_INTERFACE_FAILED_TO_COME_UP */ - -//netc.c -/* TR_CHECKING */ -/* TR_FAILED_TO_FIND */ -/* TR_ENTER_URL */ - -//setup.c -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK1 */ -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK2 */ -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK3 */ -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK4 */ -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_HARDDISK */ -/* TR_UNABLE_TO_MAKE_SYMLINK_DEV_ROOT */ -/* TR_PASSWORD_PROMPT */ -/* TR_AGAIN_PROMPT */ -/* TR_PASSWORD_CANNOT_BE_BLANK */ -/* TR_PASSWORDS_DO_NOT_MATCH */ - -//libsmooth -/* TR_INTERFACE */ -/* TR_ENTER_THE_IP_ADDRESS_INFORMATION */ -/* TR_STATIC */ -/* TR_DHCP_HOSTNAME */ -/* TR_IP_ADDRESS_PROMPT */ -/* TR_NETMASK_PROMPT */ -/* TR_INVALID_FIELDS */ -/* TR_IP_ADDRESS_CR */ -/* TR_NETWORK_MASK_CR */ -/* TR_DHCP_HOSTNAME_CR */ -/* TR_LOOKING_FOR_NIC */ -/* TR_MANUAL */ -/* TR_SELECT_NETWORK_DRIVER */ -/* TR_SELECT_NETWORK_DRIVER_LONG */ -/* TR_UNABLE_TO_LOAD_DRIVER_MODULE */ -/* TR_THIS_DRIVER_MODULE_IS_ALREADY_LOADED */ -/* TR_MODULE_PARAMETERS */ -/* TR_LOADING_MODULE */ -/* TR_MODULE_NAME_CANNOT_BE_BLANK */ - +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 *so_tr[]; +extern char *sv_tr[]; +extern char *no_tr[]; +extern char *vi_tr[]; int main(int argc, char *argv[]) { @@ -133,9 +52,9 @@ int main(int argc, char *argv[]) char *shortlangnames[] = { "en", NULL }; char **langtrs[] = { en_tr, NULL }; #else - char *langnames[] = { "Brasil", "Cestina", "Dansk", "Deutsch", "English", "Español", "Français", "Hellenic", "Italiano", "Spanish Latino", "Magyar", "Nederlands", "Norsk", "Polski", "Português", "Slovak", "Soomali", "Suomi", "Svenska", "Türkçe", "Tieng Viet", NULL }; - char *shortlangnames[] = { "bz", "cs", "da", "de", "en", "es", "fr", "el", "it", "la", "hu", "nl", "no", "pl", "pt", "sk", "so", "fi", "sv", "tr", "vi", NULL }; - char **langtrs[] = { bz_tr, cs_tr, da_tr, de_tr, en_tr, es_tr, fr_tr, el_tr, it_tr, la_tr, hu_tr, nl_tr, no_tr, pl_tr, pt_tr, sk_tr, so_tr, fi_tr, sv_tr, tr_tr, vi_tr, NULL }; + char *langnames[] = { "Brasil", "Cestina", "Dansk", "Deutsch", "English", "Español", "Français", "Hellenic", "Italiano", "Spanish Latino", "Magyar", "Nederlands", "Norsk", "Polski", "Português", "Soomali", "Suomi", "Svenska", "Türkçe", "Tieng Viet", NULL }; + char *shortlangnames[] = { "bz", "cs", "da", "de", "en", "es", "fr", "el", "it", "la", "hu", "nl", "no", "pl", "pt", "so", "fi", "sv", "tr", "vi", NULL }; + char **langtrs[] = { bz_tr, cs_tr, da_tr, de_tr, en_tr, es_tr, fr_tr, el_tr, it_tr, la_tr, hu_tr, nl_tr, no_tr, pl_tr, pt_tr, so_tr, fi_tr, sv_tr, tr_tr, vi_tr, NULL }; #endif char hdletter, cdletter; char harddrive[5], cdromdrive[5]; /* Device holder. */ @@ -143,7 +62,7 @@ int main(int argc, char *argv[]) int cdmounted = 0; /* Loop flag for inserting a cd. */ int rc; char commandstring[STRING_SIZE]; - char *installtypes[] = { "CDROM/USB-KEY", "HTTP/FTP", NULL }; + char *installtypes[] = { "CDROM", "HTTP/FTP", NULL }; int installtype = CDROM_INSTALL; char insertmessage[STRING_SIZE]; char insertdevnode[STRING_SIZE]; @@ -152,7 +71,7 @@ int main(int argc, char *argv[]) char message[1000]; char title[STRING_SIZE]; int allok = 0; - int no_restore=0; + int allok_fastexit=0; int unmount_before=0; struct keyvalue *ethernetkv = initkeyvalues(); FILE *handle, *cmdfile; @@ -167,10 +86,10 @@ int main(int argc, char *argv[]) int scsi_cdrom = 0; int ide_cdrom = 0; int fdisk = 0; - int usb_cdrom = 0; + setlocale (LC_ALL, ""); - sethostname(SNAME, 10); + sethostname( SNAME , 10); memset(&hdparams, 0, sizeof(struct devparams)); memset(&cdromparams, 0, sizeof(struct devparams)); @@ -256,122 +175,94 @@ int main(int argc, char *argv[]) mysystem("/bin/setfont lat2-16"); else if (strcmp(shortlangname, "pl") == 0) mysystem("/bin/setfont lat2-16"); - else if (strcmp(shortlangname, "sk") == 0) - mysystem("/bin/setfont lat2-16"); else if (strcmp(shortlangname, "tr") == 0) mysystem("/bin/setfont lat5-16"); else if (strcmp(shortlangname, "vi") == 0) mysystem("/bin/setfont viscii10-8x16"); else mysystem("/bin/setfont lat0-16"); - - /* need this for reading from formatted device */ - modprobe("vfat"); - + newtDrawRootText(14, 0, NAME " v" VERSION " - " SLOGAN ); newtPushHelpLine(ctr[TR_HELPLINE]); - snprintf(message, STRING_SIZE, ctr[TR_WELCOME], NAME); - snprintf (title, STRING_SIZE, "%s v%s - %s", NAME, VERSION, SLOGAN); + sprintf(message, ctr[TR_WELCOME], NAME); + sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN); newtWinMessage(title, ctr[TR_OK], message); - snprintf(message,STRING_SIZE, ctr[TR_SELECT_INSTALLATION_MEDIA_LONG], NAME); + sprintf(message, ctr[TR_SELECT_INSTALLATION_MEDIA_LONG], NAME); rc = newtWinMenu(ctr[TR_SELECT_INSTALLATION_MEDIA], message, 50, 5, 5, 6, installtypes, &installtype, ctr[TR_OK], ctr[TR_CANCEL], NULL); - + if (rc == 2) goto EXIT; - - if (installtype == CDROM_INSTALL) // CD or USB-key - { - - /* try usb key in superfloppy format only */ - if (checkusb("sda")) { - sprintf(cdromdrive, "sda"); - usb_cdrom = 1; - goto FOUND_SOURCE; - } - if (checkusb("sdb")) { - sprintf(cdromdrive, "sdb"); - usb_cdrom = 1; - goto FOUND_SOURCE; - } - - /* look for an IDE CDROM. */ - if ((cdletter = findidetype(IDE_CDROM))) - { - sprintf(cdromdrive, "hd%c", cdletter); - ide_cdrom = 1; - goto FOUND_SOURCE; - } - - /* If we have a USB attached CDROM then it will - * have already appeared at /dev/scd0, so we - * try to access it first, before asking for the - * SCSI drivers disk. - */ - if (try_scsi("scd0")) { - sprintf(cdromdrive, "scd0"); - scsi_cdrom = 1; - goto FOUND_SOURCE; - } - - /* ask for supplemental SCSI driver */ - snprintf(insertmessage, STRING_SIZE, ctr[TR_INSERT_FLOPPY], NAME" SCSI"); - if (newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage) != 1) - { - errorbox(ctr[TR_INSTALLATION_CANCELED]); - goto EXIT; - } - - /* extract new modules */ - if (runcommandwithstatus("/bin/tar -C / -xvzf /dev/floppy", ctr[TR_EXTRACTING_MODULES])) - { - errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); - goto EXIT; - } - /* and load PCMCIA */ - if (pcmcia) + + if (installtype == CDROM_INSTALL) + { + /* First look for an IDE CDROM. */ + if (!(cdletter = findidetype(IDE_CDROM))) { - /* trying to support SCSI pcmcia :-) */ - runcommandwithstatus("cardmgr -o -c /etc/pcmcia/scsi", - ctr[TR_LOADING_PCMCIA]); - if (try_scsi("scd0")) { - sprintf(cdromdrive, "scd0"); - pcmcia_cdrom = 1; - goto FOUND_SOURCE; + /* If we have a USB attached CDROM then it will + * have already appeared at /dev/scd0, so we + * try to access it first, before asking for the + * SCSI drivers disk. + */ + if (!(try_scsi("scd0"))) { + sprintf(insertmessage, ctr[TR_INSERT_FLOPPY], NAME" SCSI"); + rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); + if (rc != 1) + { + errorbox(ctr[TR_INSTALLATION_CANCELED]); + goto EXIT; + } + + if (runcommandwithstatus("/bin/tar -C / -xvzf /dev/floppy", ctr[TR_EXTRACTING_MODULES])) + { + errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); + goto EXIT; + } + + if (pcmcia) + { + /* trying to support SCSI pcmcia :-) */ + runcommandwithstatus("cardmgr -o -c /etc/pcmcia/scsi", + ctr[TR_LOADING_PCMCIA]); + if (try_scsi("scd0")) + pcmcia_cdrom = 1; + } + + /* try loading all SCSI modules with default options */ + /* Should expand this to allow options later though */ + if (!pcmcia_cdrom) + runcommandwithstatus("/bin/probescsi.sh", + ctr[TR_PROBING_SCSI]); + + /* If it fails, give up. */ + if (!(try_scsi("scd0"))) { + errorbox(ctr[TR_NO_CDROM]); + goto EXIT; + } } - } - - /* try loading all SCSI modules with default options */ - /* Should expand this to allow options later though */ - runcommandwithstatus("/bin/probescsi.sh", ctr[TR_PROBING_SCSI]); - /* If it fails, give up. */ - if (try_scsi("scd0")) { sprintf(cdromdrive, "scd0"); scsi_cdrom = 1; - goto FOUND_SOURCE; + } else { + sprintf(cdromdrive, "hd%c", cdletter); + ide_cdrom = 1; } - /* Unable to find a valid source, give up */ - errorbox(ctr[TR_NO_CDROM]); - goto EXIT; - - FOUND_SOURCE: - sprintf(cdromparams.devnode_disk, "/dev/%s", cdromdrive); -// cdromparams.module = 0; - - snprintf(insertmessage,STRING_SIZE ,ctr[TR_INSERT_CDROM], NAME); - strcpy (insertdevnode, cdromparams.devnode_disk); + snprintf(cdromparams.devnode, STRING_SIZE, "/dev/%s", cdromdrive); + cdromparams.module = 0; + + sprintf(insertmessage, ctr[TR_INSERT_CDROM], NAME); + strcpy (insertdevnode, cdromparams.devnode); } - else /* don't understand why this follows... */ + else { /* If we've done a PXE boot, we can skip the Drivers floppy, * as we've already got the modules in our instroot.gz */ if (!(handle = fopen("/CDROMBOOT", "r"))) { - snprintf(insertmessage, STRING_SIZE-12, ctr[TR_INSERT_FLOPPY], NAME); + sprintf(insertmessage, ctr[TR_INSERT_FLOPPY], NAME); strcpy (insertdevnode , "/dev/floppy"); } else { fclose(handle); @@ -380,62 +271,44 @@ int main(int argc, char *argv[]) } } - /* Try to mount /cdrom with the device discovered */ - if (scsi_cdrom || ide_cdrom || usb_cdrom) { + if (scsi_cdrom || ide_cdrom) { + /* Try to mount /cdrom in a loop. */ snprintf(commandstring, STRING_SIZE, "/bin/mount -o ro %s /cdrom", insertdevnode); - int skip_dialog = 1; - int sd_test = 0; while (!cdmounted) { - /* for usb-key, we have to try sda then sda1. The key cannot be unpluged */ - if (sd_test == 1) { //change to sda1 - sprintf(commandstring, "/bin/mount -o ro %s1 /cdrom", insertdevnode); - } - if (sd_test == 2) { //the key do not contains a vfat file system - errorbox(ctr[TR_USB_KEY_VFAT_ERR]); - goto EXIT; - } - if (usb_cdrom) sd_test++; // next USB test - - if (!skip_dialog && !usb_cdrom) { - rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); - if (rc != 1) - { + rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); + if (rc != 1) + { errorbox(ctr[TR_INSTALLATION_CANCELED]); goto EXIT; - } - } - skip_dialog = 0; - if (mysystem(commandstring)) - continue; //mount failed, try again - - /*verify it's what we want */ - handle = fopen ("/cdrom/" SNAME "-" VERSION ".tgz", "r"); - if (handle == NULL) { - mysystem ("/bin/umount /cdrom"); - continue; /* bad disk ! */ - } - - fclose (handle); - cdmounted = 1; - /* If we've booted from CDROM, then - * we've already got the drivers, - * so we can skip this unpack. */ - if ((handle = fopen("/CDROMBOOT", "r"))) { - fclose(handle); - break; /* ok we go everything */ } - /* unpack drivers */ - if (runcommandwithprogress(60, 4, title, - "/bin/tar -C / -xvzf /cdrom/images/drivers-"VERSION".img", - 175, ctr[TR_EXTRACTING_MODULES])) - { - errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); - goto EXIT; + if (!(mysystem(commandstring))) { + handle = fopen ("/cdrom/" SNAME "-" VERSION ".tgz", "r"); + if (handle != NULL) { + fclose (handle); + cdmounted = 1; + /* If we've booted from CDROM, then + * we've already got the drivers, + * so we can skip this unpack. */ + if (!(handle = fopen("/CDROMBOOT", "r"))) { + sprintf(string, "/bin/tar -C / -xvzf /cdrom/images/drivers-%s.img", VERSION); + if (runcommandwithprogress(60, 4, title, + string, + 175, ctr[TR_EXTRACTING_MODULES])) + { + errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); + + goto EXIT; + } + } else + fclose(handle); + } else { + mysystem ("/bin/umount /cdrom"); + } } } - } else { /* no cd device were discovered, ask second diskette */ - sprintf(commandstring, "/bin/tar -C / -xvzf /dev/floppy"); + } else { + snprintf(commandstring, STRING_SIZE, "/bin/tar -C / -xvzf /dev/floppy"); while (!cdmounted) { rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); @@ -510,148 +383,118 @@ int main(int argc, char *argv[]) } /* Get device for the HD. This has to succeed. */ - /* first try an IDE disk */ - if ((hdletter = findidetype(IDE_HD))) + if (!(hdletter = findidetype(IDE_HD))) { - sprintf(harddrive, "hd%c", hdletter); - goto FOUND_DESTINATION; - } - /* unpack SCSI driver if not done during CD detection */ - if (installtype == URL_INSTALL) - { - /* If we've done a PXE boot, we can skip the SCSI - * floppy as we've already got the modules in our - * instroot.gz */ - if (!(handle = fopen("/CDROMBOOT", "r"))) + if (installtype == URL_INSTALL) { - /* search img where it is on a mounted loop iso */ - if (!(checktarball("images/scsidrv-"VERSION".img"))) + /* If we've done a PXE boot, we can skip the SCSI + * floppy as we've already got the modules in our + * instroot.gz */ + if (!(handle = fopen("/CDROMBOOT", "r"))) { - /* Couldn't find the SCSI drivers on the URL page, - * so after 3 failed attempts, ask the user for the - * SCSI drivers floppy disk. */ - errorbox(ctr[TR_NO_SCSI_IMAGE_FOUND]); - snprintf(insertmessage, STRING_SIZE, ctr[TR_INSERT_FLOPPY], NAME" SCSI"); - rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); - if (rc != 1) + /* search img where it is on a mounted loop iso */ + sprintf(string, "images/scsidrv-%s.img", VERSION); + if (!(checktarball(string))) { - errorbox(ctr[TR_INSTALLATION_CANCELED]); - goto EXIT; + /* Couldn't find the SCSI drivers on the URL page, + * so after 3 failed attempts, ask the user for the + * SCSI drivers floppy disk. */ + errorbox(ctr[TR_NO_SCSI_IMAGE_FOUND]); + sprintf(insertmessage, ctr[TR_INSERT_FLOPPY], NAME" SCSI"); + rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], insertmessage); + if (rc != 1) + { + errorbox(ctr[TR_INSTALLATION_CANCELED]); + goto EXIT; + } + + if (runcommandwithstatus("/bin/tar -C / -xvzf /dev/floppy", ctr[TR_EXTRACTING_MODULES])) + { + errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); + goto EXIT; + } + } else { + /* unpack... */ + snprintf(commandstring, STRING_SIZE, + "/bin/wget -O - %s/%s | /bin/tar -C / -xvzf -", + url, string); + if (runcommandwithprogress(60, 4, title, commandstring, + 4500, ctr[TR_INSTALLING_FILES])) + { + errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]); + goto EXIT; + } } - - if (runcommandwithstatus("/bin/tar -C / -xvzf /dev/floppy", ctr[TR_EXTRACTING_MODULES])) + } else + fclose(handle); + } else { + if (ide_cdrom) { + sprintf(string, "/bin/tar -C / -xvzf /cdrom/images/scsidrv-%s.img", VERSION); + if (runcommandwithstatus(string, ctr[TR_EXTRACTING_MODULES])) { errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); goto EXIT; } - } else { - /* unpack... THIS DO NOT WORK BECAUSE var "string" is empty*/ - snprintf(commandstring, STRING_SIZE, - "/bin/wget -O - %s/%s | /bin/tar -C / -xvzf -", - url, string); - if (runcommandwithprogress(60, 4, title, commandstring, - 4500, ctr[TR_INSTALLING_FILES])) - { - errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]); - goto EXIT; - } - } - } else - fclose(handle); - } else { /* cdrom/usb install, install SCSI id not done */ - if (ide_cdrom) { - if (runcommandwithstatus("/bin/tar -C / -xvzf /cdrom/images/scsidrv-"VERSION".img", ctr[TR_EXTRACTING_MODULES])) - { - errorbox(ctr[TR_UNABLE_TO_EXTRACT_MODULES]); - goto EXIT; } } - } - /* load SCSI/pcmcia drivers if not done during CD detection */ - if (!scsi_cdrom) { + if (!scsi_cdrom) { + #if 0 /* not yet */ - if (pcmcia) - { - /* trying to support SCSI pcmcia :-) */ - runcommandwithstatus("cardmgr -o -c /etc/pcmcia/scsi", - ctr[TR_LOADING_PCMCIA]); - if (try_scsi(usb_cdrom ? "sdb":"sda")) { - scsi_disk = 1; - pcmcia_disk = 1; + if (pcmcia) + { + /* trying to support SCSI pcmcia :-) */ + runcommandwithstatus("cardmgr -o -c /etc/pcmcia/scsi", + ctr[TR_LOADING_PCMCIA]); + if (try_scsi("sda")) + pcmcia_disk = 1; } - if (checkusb("sdb") && try_scsi("sdc")) { - scsi_disk = 1; - pcmcia_disk = 1; +#endif + + /* try loading all SCSI modules with default options */ + /* Should expand this to allow options later though */ + if (!pcmcia_disk) + runcommandwithstatus("/bin/probescsi.sh", + ctr[TR_PROBING_SCSI]); + } + + /* Need to clean this up at some point */ + if (!try_scsi("sda")) { + if (!try_scsi("ida/c0d0")) { + if (!try_scsi("cciss/c0d0")) { + if (!try_scsi("rd/c0d0")) { + if (!try_scsi("ataraid/d0")) { + errorbox(ctr[TR_NO_HARDDISK]); + goto EXIT; + } else { + raid_disk = 1; + sprintf(harddrive, "ataraid/d0"); + } + } else { + raid_disk = 1; + sprintf(harddrive, "rd/c0d0"); + } + } else { + raid_disk = 1; + sprintf(harddrive, "cciss/c0d0"); + } + } else { + raid_disk = 1; + sprintf(harddrive, "ida/c0d0"); } + } else { + sprintf(harddrive, "sda"); } -#endif - /* try loading all SCSI modules with default options */ - /* Should expand this to allow options later though */ - if (!pcmcia_disk) - runcommandwithstatus("/bin/probescsi.sh", - ctr[TR_PROBING_SCSI]); - } - /* Now try to find destination device... - Need to clean this up at some point - scsi disk is sdb/sdc when sda/sdb is used for usb-key - if scsi-disk is is sdd or more, it is not discovered - */ - if (try_scsi(usb_cdrom ? "sdb":"sda")) { - scsi_disk = 1; - sprintf(harddrive, usb_cdrom ? "sdb":"sda"); - goto FOUND_DESTINATION; - } - if (checkusb("sdb") && try_scsi("sdc")) { scsi_disk = 1; - sprintf(harddrive, "sdc"); - goto FOUND_DESTINATION; - } - if (try_scsi("ida/c0d0")) { - raid_disk = 1; - sprintf(harddrive, "ida/c0d0"); - goto FOUND_DESTINATION; - } - if (try_scsi("cciss/c0d0")) { - raid_disk = 1; - sprintf(harddrive, "cciss/c0d0"); - goto FOUND_DESTINATION; - } - if (try_scsi("rd/c0d0")) { - raid_disk = 1; - sprintf(harddrive, "rd/c0d0"); - goto FOUND_DESTINATION; - } - if (try_scsi("ataraid/d0")) { - raid_disk = 1; - sprintf(harddrive, "ataraid/d0"); - goto FOUND_DESTINATION; - } - /* nothing worked, give up */ - errorbox(ctr[TR_NO_HARDDISK]); - goto EXIT; - - FOUND_DESTINATION: - /* Make the hdparms struct and print the contents. - With USB-KEY install and SCSI disk, while installing, the disk - is named 'sdb,sdc,...' (following keys) - On reboot, it will become 'sda' - To avoid many test, all names are built in the struct. - */ - sprintf(hdparams.devnode_disk, "/dev/%s", harddrive); - /* Address the partition or raid partition (eg dev/sda or /dev/sdap1 */ - sprintf(hdparams.devnode_part, "/dev/%s%s", harddrive,raid_disk ? "p" : ""); - /* now the names after the machine is booted. Today only scsi is affected - and we only install on the first scsi disk. - */ - { char tmp[30]; - strcpy(tmp, scsi_disk ? "sda" : harddrive); - sprintf(hdparams.devnode_disk_run, "/dev/%s", tmp); - sprintf(hdparams.devnode_part_run, "/dev/%s%s", tmp, raid_disk ? "p" : ""); - } + } else + sprintf(harddrive, "hd%c", hdletter); + + /* Make the hdparms struct and print the contents. */ + snprintf(hdparams.devnode, STRING_SIZE, "/dev/%s", harddrive); + hdparams.module = 0; rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], - ctr[TR_PREPARE_HARDDISK], hdparams.devnode_disk_run); + ctr[TR_PREPARE_HARDDISK], hdparams.devnode); if (rc != 1) goto EXIT; @@ -685,7 +528,8 @@ int main(int argc, char *argv[]) fclose(handle); } - fprintf(flog, "maximum_free = %d, memory = %d", maximum_free, memory); + fprintf(flog, "maximum_free = %d, memory = %d", + maximum_free, memory); /* If you need more than this, you should really add physical memory */ /* Minimum: 192 = 64 real + 128 swap */ @@ -722,6 +566,7 @@ int main(int argc, char *argv[]) fprintf(flog, "boot = %d, swap = %d, mylog = %d, root = %d\n", boot_partition, swap_file, log_partition, root_partition); + #ifdef __alpha__ fdisk = 1; #endif @@ -739,7 +584,7 @@ int main(int argc, char *argv[]) fclose(handle); - sprintf(commandstring, "/bin/sfdisk -uM %s < /tmp/partitiontable", hdparams.devnode_disk); + snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -uM %s < /tmp/partitiontable", hdparams.devnode); if (runcommandwithstatus(commandstring, ctr[TR_PARTITIONING_DISK])) { errorbox(ctr[TR_UNABLE_TO_PARTITION]); @@ -747,71 +592,86 @@ int main(int argc, char *argv[]) } #endif } - /* create filesystem boot partition 1 */ - sprintf(commandstring, "/bin/mke2fs -m 0 -j %s1", hdparams.devnode_part); + + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -m 0 -j %sp1", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -m 0 -j %s1", hdparams.devnode); if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]); goto EXIT; } - - /* create filesystem log partition 2 */ - sprintf(commandstring, "/bin/mke2fs -j %s2", hdparams.devnode_part); + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -j %sp2", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -j %s2", hdparams.devnode); if (runcommandwithstatus(commandstring, ctr[TR_MAKING_LOG_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MAKE_LOG_FILESYSTEM]); goto EXIT; } + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -m 1 -j %sp4", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -m 1 -j %s4", hdparams.devnode); - /* create filesystem root partition 4 */ - sprintf(commandstring, "/bin/mke2fs -m 1 -j %s4", hdparams.devnode_part); if (runcommandwithstatus(commandstring, ctr[TR_MAKING_ROOT_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]); goto EXIT; } - - /* Mount root on partition 4 */ - sprintf(commandstring, "/sbin/mount -t ext2 %s4 /harddisk", hdparams.devnode_part); + /* Mount harddisk. */ + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %sp4 /harddisk", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %s4 /harddisk", hdparams.devnode); if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_ROOT_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MOUNT_ROOT_FILESYSTEM]); goto EXIT; } - mkdir("/harddisk/boot", S_IRWXU|S_IRWXG|S_IRWXO); - mkdir("/harddisk/var", S_IRWXU|S_IRWXG|S_IRWXO); - mkdir("/harddisk/var/log", S_IRWXU|S_IRWXG|S_IRWXO); - - /* Make,mount swapfile */ + /* Make swapfile */ if (swap_file) { - sprintf(commandstring, "/bin/dd if=/dev/zero of=/harddisk/swapfile bs=1024k count=%d", swap_file); + snprintf(commandstring, STRING_SIZE, "/bin/dd if=/dev/zero of=/harddisk/swapfile bs=1024k count=%d", swap_file); if (runcommandwithstatus(commandstring, ctr[TR_MAKING_SWAPSPACE])) { errorbox(ctr[TR_UNABLE_TO_MAKE_SWAPSPACE]); goto EXIT; } - if (runcommandwithstatus("/bin/mkswap /harddisk/swapfile", ctr[TR_MAKING_SWAPSPACE])) + snprintf(commandstring, STRING_SIZE, "/bin/mkswap /harddisk/swapfile"); + if (runcommandwithstatus(commandstring, ctr[TR_MAKING_SWAPSPACE])) { errorbox(ctr[TR_UNABLE_TO_MAKE_SWAPSPACE]); goto EXIT; } - if (runcommandwithstatus("/bin/swapon /harddisk/swapfile", ctr[TR_MOUNTING_SWAP_PARTITION])) - { - errorbox(ctr[TR_UNABLE_TO_MOUNT_SWAP_PARTITION]); - goto EXIT; - } } + mkdir("/harddisk/boot", S_IRWXU|S_IRWXG|S_IRWXO); + mkdir("/harddisk/var", S_IRWXU|S_IRWXG|S_IRWXO); + mkdir("/harddisk/var/log", S_IRWXU|S_IRWXG|S_IRWXO); + + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %sp1 /harddisk/boot", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %s1 /harddisk/boot", hdparams.devnode); - /* Mount boot on partition 1 */ - sprintf(commandstring, "/sbin/mount -t ext2 %s1 /harddisk/boot", hdparams.devnode_part); if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_BOOT_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MOUNT_BOOT_FILESYSTEM]); goto EXIT; } - - /* Mount log on partition 2 */ - sprintf(commandstring, "/sbin/mount -t ext2 %s2 /harddisk/var/log", hdparams.devnode_part); + if (swap_file) { + snprintf(commandstring, STRING_SIZE, "/bin/swapon /harddisk/swapfile"); + if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_SWAP_PARTITION])) + { + errorbox(ctr[TR_UNABLE_TO_MOUNT_SWAP_PARTITION]); + goto EXIT; + } + } + if (raid_disk) + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %sp2 /harddisk/var/log", hdparams.devnode); + else + snprintf(commandstring, STRING_SIZE, "/sbin/mount -t ext2 %s2 /harddisk/var/log", hdparams.devnode); if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_LOG_FILESYSTEM])) { errorbox(ctr[TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM]); @@ -837,9 +697,15 @@ int main(int argc, char *argv[]) write_usb_modules_conf(); /* touch the modules.dep files */ - mysystem("/bin/chroot /harddisk /bin/touch /lib/modules/"KERNEL_VERSION"/modules.dep"); + snprintf(commandstring, STRING_SIZE, + "/bin/chroot /harddisk /bin/touch /lib/modules/%s/modules.dep", + KERNEL_VERSION); + mysystem(commandstring); #ifdef __i386__ - mysystem("/bin/chroot /harddisk /bin/touch /lib/modules/"KERNEL_VERSION"-smp/modules.dep"); + snprintf(commandstring, STRING_SIZE, + "/bin/chroot /harddisk /bin/touch /lib/modules/%s-smp/modules.dep", + KERNEL_VERSION); + mysystem(commandstring); #endif /* Rename uname */ @@ -871,8 +737,8 @@ int main(int argc, char *argv[]) /* *always* write disk configuration */ if (!(write_disk_configs(&hdparams))){ - errorbox(ctr[TR_ERROR_WRITING_CONFIG]); - goto EXIT; + errorbox(ctr[TR_ERROR_WRITING_CONFIG]); + goto EXIT; } /* @@ -880,50 +746,156 @@ int main(int argc, char *argv[]) It uses tar. If the tar fails for any reason, show user an error and go back to the restore/skip question. This gives the user the chance to have another go. */ - - /* Program is outside install to save space on floppy - */ - fprintf(flog, "Passing control to install2.\n"); - fflush(flog); - //newtSuspend(); - /* pass needed parameter for install 2 by position - choice: index of langage selected - devnode_disk: to prevent unmounting of it - url: if network, allow restaure from it - */ - sprintf(commandstring, "/harddisk/usr/local/bin/install2 %d %s %s", - choice, - strlen(cdromparams.devnode_disk ) ? cdromparams.devnode_disk : "none", - strlen(url) ? url : "none" - ); - no_restore = system(commandstring); - //newtResume(); + +RESTORE: + /* set status variables to nonsense values */ + allok_fastexit = 0; + /* loop until floppy succeeds or user skips out */ + while (1) + { + sprintf(message, ctr[TR_RESTORE_CONFIGURATION], NAME); + if (newtWinChoice(title, ctr[TR_RESTORE], ctr[TR_SKIP], message) == 1) + { + /* Temporarily mount /proc under /harddisk/proc, + * run updfstab to locate the floppy, and unmount /harddisk/proc + * again. This should be run each time the user tries to restore + * so it can properly detect removable devices */ + if (mysystem("/bin/mount -n -t proc /proc /harddisk/proc")) { + errorbox(ctr[TR_UNABLE_TO_MOUNT_PROC_FILESYSTEM]); + goto EXIT; + } + if (mysystem("/bin/chroot /harddisk /usr/sbin/updfstab")) { + errorbox(ctr[TR_UNABLE_TO_WRITE_ETC_FSTAB]); + goto EXIT; + } + mysystem("/bin/umount /harddisk/proc"); + + mkdir("/harddisk/tmp/ipcop", S_IRWXU|S_IRWXG|S_IRWXO); + + /* Always extract to /tmp/ipcop for temporary extraction + * just in case floppy fails */ + + /* try a compressed backup first because it's quicker to fail. + * In exclude.system, files name must be without leading / or + * on extraction, name will never match */ + snprintf(commandstring, STRING_SIZE, + "/bin/chroot /harddisk /bin/tar -X " CONFIG_ROOT "/backup/exclude.system -C /tmp/ipcop -xvzf /dev/floppy > %s 2> /dev/null", mylog); - /* if we installed from CD ROM then we didn't set up the - network interface yet. Therefore, set up Network - driver and params just before we need them. - */ - if (no_restore && (installtype == CDROM_INSTALL)) { - if (!(networkmenu(ethernetkv))){ - errorbox(ctr[TR_NETWORK_SETUP_FAILED]); - goto EXIT; + statuswindow(45, 4, title, ctr[TR_INSTALLING_FILES]); + rc = system(commandstring); + + if (rc) { + /* if it's not compressed, try uncompressed first before failing*/ + snprintf(commandstring, STRING_SIZE, + "/bin/chroot /harddisk /bin/tar -X " CONFIG_ROOT "/backup/exclude.system -C /tmp/ipcop -xvf /dev/floppy > %s 2> /dev/null", mylog); + rc = system(commandstring); + if (rc) { + newtPopWindow(); + /* command failed trying to read from floppy */ + errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]); + + /* remove badly restored files */ + mysystem("/bin/chroot /harddisk /bin/rm -rf /tmp/ipcop"); + goto RESTORE; + } else { + /* Now copy to correct location */ + mysystem("/bin/chroot /harddisk /bin/cp -af /tmp/ipcop/. /"); + mysystem("/bin/chroot /harddisk /bin/rm -rf /tmp/ipcop"); + newtPopWindow(); + allok_fastexit=1; + + /* Upgrade necessary files from v1.2 to v1.3 to v1.4 */ + upgrade_v12_v13(); + upgrade_v130_v140(); + break; /* out of loop at this point because floppy has + successfully restored */ + } + } + else { /* success */ + /* Now copy to correct location */ + mysystem("/bin/chroot /harddisk /bin/cp -af /tmp/ipcop/. /"); + mysystem("/bin/chroot /harddisk /bin/rm -rf /tmp/ipcop"); + newtPopWindow(); + allok_fastexit=1; + + /* Upgrade necessary files from v1.2 to v1.3 to v1.4 */ + upgrade_v12_v13(); + upgrade_v130_v140(); + break; /* out of loop at this point because floppy has + successfully restored */ + } + } + else{ /* user chose to skip install from floppy */ + if (installtype == CDROM_INSTALL){ + /* if we installed from CD ROM then we didn't set up the + network interface yet. Therefore, set up Network + driver and params just before we need them. */ + + if (!(networkmenu(ethernetkv))){ + /* network setup failed, tell the world */ + errorbox(ctr[TR_NETWORK_SETUP_FAILED]); + goto EXIT; + } + } + break; /* out of loop because we succeeded with ethernet + set up and user is notrestarting from floppy*/ + } + } + + /* Check the SQUID acl file exists, if not use our 1.4 copy */ + { + FILE *aclreadfile; + + if (!(aclreadfile = fopen ("/harddisk" CONFIG_ROOT "/proxy/acl", "r"))) { + rename ("/harddisk" CONFIG_ROOT "/proxy/acl-1.4", + "/harddisk" CONFIG_ROOT "/proxy/acl"); + } else { + unlink ("/harddisk" CONFIG_ROOT "/proxy/acl-1.4"); + fclose(aclreadfile); } + chown ("/harddisk" CONFIG_ROOT "/proxy/acl", 99, 99); } /* Build cache lang file */ mysystem("/bin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\""); - /* write ethernet and lang configs only if they have not - been restored from floppy already. */ - if (no_restore) { - if (!write_ethernet_configs(ethernetkv)|| - !write_lang_configs(shortlangname)) { - errorbox(ctr[TR_ERROR_WRITING_CONFIG]); - goto EXIT; + if (!allok_fastexit){ + /* write ethernet and lang configs only if they have not + been restored from floppy already. */ + if (!(write_ethernet_configs( ethernetkv))|| + !(write_lang_configs(shortlangname))){ + errorbox(ctr[TR_ERROR_WRITING_CONFIG]); + goto EXIT; + } + } + + /* if we detected SCSI then fixup */ + if ((handle = fopen("/scsidriver", "r"))) + { + char *driver; + fgets(line, STRING_SIZE-1, handle); + fclose(handle); + line[strlen(line) - 1] = 0; + driver = strtok(line, "."); + fprintf(flog, "Detected SCSI driver %s\n",driver); + if (strlen(driver) > 1) { + fprintf(flog, "Fixing up ipcoprd.img\n"); + mysystem("/bin/chroot /harddisk /sbin/modprobe loop"); + mkdir("/harddisk/initrd", S_IRWXU|S_IRWXG|S_IRWXO); + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod --with=%s --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipcoprd.img %s", driver, KERNEL_VERSION); + runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); +#ifdef __i386__ + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod --with=%s --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipcoprd-smp.img %s-smp", driver, KERNEL_VERSION); + runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); + mysystem("/bin/chroot /harddisk /bin/mv /boot/grub/scsigrub.conf /boot/grub/grub.conf"); +#endif +#ifdef __alpha__ + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /bin/mv /boot/etc/scsiaboot.conf /boot/etc/aboot.conf"); + runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]); +#endif } } - #if 0 /* not yet */ if (pcmcia_disk) { @@ -931,7 +903,8 @@ int main(int argc, char *argv[]) fprintf(flog, "Fixing up ipcoprd.img\n"); mysystem("/bin/chroot /harddisk /sbin/modprobe loop"); mkdir("/harddisk/initrd", S_IRWXU|S_IRWXG|S_IRWXO); - mysystem("/bin/chroot /harddisk /sbin/pcinitrd -r "KERNEL_VERSION" /boot/ipcoprd.img"); + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/pcinitrd -r %s /boot/ipcoprd.img", KERNEL_VERSION); + mysystem(commandstring); #ifdef __i386__ mysystem("/bin/chroot /harddisk /bin/mv /boot/grub/scsigrub.conf /boot/grub/grub.conf"); #endif @@ -942,17 +915,21 @@ int main(int argc, char *argv[]) #endif #ifdef __i386__ - // to verify: with USB-key grubbatch install on sdb and boot sda.... - replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode_disk); + replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode); /* restore permissions */ chmod("/harddisk/boot/grub/grubbatch", S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH); - sprintf(string, "root=%s4", hdparams.devnode_part_run); + if (raid_disk) + sprintf(string, "root=%sp4", hdparams.devnode); + else + sprintf(string, "root=%s4", hdparams.devnode); replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string); mysystem("/bin/chroot /harddisk /bin/mount -n -t proc none /proc"); - if (runcommandwithstatus("/bin/chroot /harddisk /boot/grub/grubbatch", ctr[TR_INSTALLING_GRUB])) + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /boot/grub/grubbatch"); + + if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) { errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]); goto EXIT; @@ -960,59 +937,60 @@ int main(int argc, char *argv[]) mysystem("/bin/chroot /harddisk /bin/umount -n /proc"); #endif #ifdef __alpha__ - sprintf(commandstring, "/bin/chroot /harddisk /sbin/swriteboot -f3 %s /boot/bootlx", hdparams.devnode_disk); + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/swriteboot -f3 %s /boot/bootlx", hdparams.devnode); mysystem(commandstring); - sprintf(commandstring, "/bin/chroot /harddisk /sbin/abootconf %s 1", hdparams.devnode_disk_run); + snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/abootconf %s 1", hdparams.devnode); mysystem(commandstring); - sprintf(string, "root=%s4", hdparams.devnode_part_run); + if (raid_disk) + sprintf(string, "root=%sp4", hdparams.devnode); + else + sprintf(string, "root=%s4", hdparams.devnode); replace( "/harddisk/boot/etc/aboot.conf", "root=ROOT", string); #endif /* unmounting happens everywhere because there are places which require device is to be unmounted under certain circumstances. This is the last place we can unmount - anything and still succeed. - */ + anything and still succeed. */ - if (!unmount_before && !usb_cdrom && installtype == CDROM_INSTALL){ - if (mysystem("/sbin/umount /cdrom")) - { - errorbox(ctr[TR_UNABLE_TO_UNMOUNT_CDROM]); - goto EXIT; - } + if (!unmount_before && installtype == CDROM_INSTALL){ + if (mysystem("/sbin/umount /cdrom")) + { + errorbox(ctr[TR_UNABLE_TO_UNMOUNT_CDROM]); + goto EXIT; + } } - if ((installtype == CDROM_INSTALL) && !usb_cdrom) + if (installtype == CDROM_INSTALL) { - if (!(ejectcdrom(cdromparams.devnode_disk))) + + if (!(ejectcdrom(cdromparams.devnode))) { errorbox(ctr[TR_UNABLE_TO_EJECT_CDROM]); // goto EXIT; } } - - snprintf(message, STRING_SIZE, ctr[TR_CONGRATULATIONS_LONG], + + + sprintf(message, ctr[TR_CONGRATULATIONS_LONG], NAME, SNAME, SNAME, NAME, NAME, NAME); newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message); - + allok = 1; - + EXIT: - fprintf(flog, "Install program ended.\n"); + fprintf(flog, "Install program ended.\n"); fflush(flog); fclose(flog); - if (!allok) + if (!(allok)) newtWinMessage(title, ctr[TR_OK], ctr[TR_PRESS_OK_TO_REBOOT]); - + newtFinished(); - + freekeyvalues(ethernetkv); - //no more needed - mysystem("/bin/chroot /harddisk /bin/rm /usr/local/bin/install2"); - /* run setup only if config not restored from floppy already. */ - if (allok && no_restore) + if (allok && !allok_fastexit) { /* /proc is needed by the module checker. We have to mount it * so it can be seen by setup, which is run chrooted. */ @@ -1033,19 +1011,8 @@ EXIT: system("/sbin/umount /harddisk/var/log"); system("/sbin/umount /harddisk/boot"); system("/sbin/umount /harddisk"); + system("/etc/halt"); return 0; } - -int modprobe (char *mod) { - char commandstring[STRING_SIZE]; - sprintf (commandstring,"/sbin/modprobe %s", mod); - return mysystem (commandstring); -} - -int rmmod (char *mod) { - char commandstring[STRING_SIZE]; - sprintf (commandstring,"/sbin/rmmod %s", mod); - return mysystem (commandstring); -} diff --git a/src/install+setup/install/nic.c b/src/install+setup/install/nic.c index 23c90f59e1..73368e00a2 100644 --- a/src/install+setup/install/nic.c +++ b/src/install+setup/install/nic.c @@ -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; } diff --git a/src/install+setup/install/pcmcia.c b/src/install+setup/install/pcmcia.c index 048f979896..3c50c1abd4 100644 --- a/src/install+setup/install/pcmcia.c +++ b/src/install+setup/install/pcmcia.c @@ -21,7 +21,7 @@ * . 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; } diff --git a/src/install+setup/install/scsi.c b/src/install+setup/install/scsi.c index 96bf787d5c..1492a18643 100644 --- a/src/install+setup/install/scsi.c +++ b/src/install+setup/install/scsi.c @@ -23,6 +23,6 @@ try_scsi(char *disk_device) return 0; close(fd); - // remove usb scsi - return ( checkusb(disk_device) ? 0:1 ); + + return 1; } diff --git a/src/install+setup/install/usb.c b/src/install+setup/install/usb.c index 90bba2caf2..ce6f01118b 100644 --- a/src/install+setup/install/usb.c +++ b/src/install+setup/install/usb.c @@ -17,7 +17,7 @@ * * Copyright 2002: Mark Wormgoor * - * $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); -} -- 2.39.5