From 2cbfdf51d83d2fc0f0396562250a188cb6faba48 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Sun, 6 Oct 1996 07:58:04 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'RELENG_2_1_5_RELEASE'. --- lib/libc/stdio/asprintf.c | 59 --- release/floppies/boot/Makefile | 4 - release/floppies/boot/crunch/crunch.conf | 20 - release/floppies/boot/verbatim/etc/services | 4 - release/floppies/doFS.sh | 120 ----- release/floppies/fixit/Makefile | 6 - release/floppies/fixit/crunch/crunch.conf | 45 -- release/floppies/fixit/image/Makefile | 16 - release/floppies/fixit/verbatim/.profile | 15 - release/floppies/write_mfs_in_kernel.c | 70 --- release/sysinstall/anonFTP.c | 476 +++++++++++++++++++ release/sysinstall/apache.c | 611 +++++++++++++++++++++++++ release/sysinstall/doc.c | 125 +++++ release/sysinstall/help/anonftp.hlp | 19 + release/sysinstall/help/apache.hlp | 51 +++ release/sysinstall/help/upgrade.hlp | 38 ++ release/sysinstall/index.c | 582 +++++++++++++++++++++++ release/sysinstall/installUpgrade.c | 387 ++++++++++++++++ release/sysinstall/lndir.c | 218 +++++++++ release/sysinstall/options.c | 285 ++++++++++++ release/sysinstall/package.c | 201 ++++++++ release/sysinstall/version.h | 1 + share/man/man4/man4.i386/aic.4 | 47 ++ share/man/man4/man4.i386/eg.4 | 44 ++ share/man/man4/man4.i386/el.4 | 44 ++ share/man/man4/man4.i386/ep.4 | 123 +++++ share/man/man4/man4.i386/ncr.4 | 43 ++ share/man/man4/man4.i386/wt.4 | 44 ++ sys/dev/aic7xxx/aicasm.c | 685 ---------------------------- usr.sbin/mrouted/RELEASE | 326 ------------- 30 files changed, 3339 insertions(+), 1370 deletions(-) delete mode 100644 lib/libc/stdio/asprintf.c delete mode 100644 release/floppies/boot/Makefile delete mode 100644 release/floppies/boot/crunch/crunch.conf delete mode 100644 release/floppies/boot/verbatim/etc/services delete mode 100644 release/floppies/doFS.sh delete mode 100644 release/floppies/fixit/Makefile delete mode 100644 release/floppies/fixit/crunch/crunch.conf delete mode 100644 release/floppies/fixit/image/Makefile delete mode 100644 release/floppies/fixit/verbatim/.profile delete mode 100644 release/floppies/write_mfs_in_kernel.c create mode 100644 release/sysinstall/anonFTP.c create mode 100644 release/sysinstall/apache.c create mode 100644 release/sysinstall/doc.c create mode 100644 release/sysinstall/help/anonftp.hlp create mode 100644 release/sysinstall/help/apache.hlp create mode 100644 release/sysinstall/help/upgrade.hlp create mode 100644 release/sysinstall/index.c create mode 100644 release/sysinstall/installUpgrade.c create mode 100644 release/sysinstall/lndir.c create mode 100644 release/sysinstall/options.c create mode 100644 release/sysinstall/package.c create mode 100644 release/sysinstall/version.h create mode 100644 share/man/man4/man4.i386/aic.4 create mode 100644 share/man/man4/man4.i386/eg.4 create mode 100644 share/man/man4/man4.i386/el.4 create mode 100644 share/man/man4/man4.i386/ep.4 create mode 100644 share/man/man4/man4.i386/ncr.4 create mode 100644 share/man/man4/man4.i386/wt.4 delete mode 100644 sys/dev/aic7xxx/aicasm.c delete mode 100644 usr.sbin/mrouted/RELEASE diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c deleted file mode 100644 index 9b4d05b4397b..000000000000 --- a/lib/libc/stdio/asprintf.c +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 1996 Peter Wemm - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_RCS) && !defined(lint) -static char rcsid[] = "$Id$"; -#endif /* LIBC_RCS and not lint */ - -#include -#if __STDC__ -#include -#else -#include -#endif - -#if __STDC__ -int -asprintf(char **str, char const *fmt, ...) -#else -int -asprintf(str, fmt, va_alist) - char **str; - char *fmt; - va_dcl -#endif -{ - int ret; - va_list ap; - -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - ret = vasprintf(str, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/release/floppies/boot/Makefile b/release/floppies/boot/Makefile deleted file mode 100644 index 2dd894d898d9..000000000000 --- a/release/floppies/boot/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ -SUBDIR= crunch mfs floppy - -.include diff --git a/release/floppies/boot/crunch/crunch.conf b/release/floppies/boot/crunch/crunch.conf deleted file mode 100644 index b9d6f14b65f7..000000000000 --- a/release/floppies/boot/crunch/crunch.conf +++ /dev/null @@ -1,20 +0,0 @@ -# $Id: boot_crunch.conf,v 1.23 1996/02/08 18:02:51 phk Exp $ - -srcdirs /usr/src/bin -srcdirs /usr/src/release -srcdirs /usr/src/sbin/i386 -srcdirs /usr/src/sbin -srcdirs /usr/src/usr.bin -srcdirs /usr/src/gnu/usr.bin -srcdirs /usr/src/usr.sbin - -progs sh find -progs pwd ft ppp -progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach -progs mount_nfs -ln gzip gunzip -ln gzip zcat -ln sh -sh - -libs -ll -ledit -lutil -lkvm -lmd -libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk -lipx diff --git a/release/floppies/boot/verbatim/etc/services b/release/floppies/boot/verbatim/etc/services deleted file mode 100644 index bd1beff4d9a7..000000000000 --- a/release/floppies/boot/verbatim/etc/services +++ /dev/null @@ -1,4 +0,0 @@ -nameserver 42/tcp name -ftp 21/tcp -domain 53/tcp nameserver -domain 53/udp nameserver diff --git a/release/floppies/doFS.sh b/release/floppies/doFS.sh deleted file mode 100644 index 16932269363f..000000000000 --- a/release/floppies/doFS.sh +++ /dev/null @@ -1,120 +0,0 @@ -: -#set -ex - -VNDEVICE=vn0 -export BLOCKSIZE=512 - -LABELDIR=$1 ; shift -MNT=$1 ; shift -FSSIZE=$1 ; shift -FSPROTO=$1 ; shift -FSINODE=$1 ; shift -FSLABEL=$1 ; shift -OLDFSSIZE=${FSSIZE} -OLDFSINODE=${FSINODE} - -deadlock=40 - -while true -do - rm -f fs-image - - if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then - ( cd /dev && sh MAKEDEV ${VNDEVICE} ) - fi - - umount /dev/${VNDEVICE} 2>/dev/null || true - - umount ${MNT} 2>/dev/null || true - - vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true - - dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null - # this suppresses the `invalid primary partition table: no magic' - awk 'BEGIN {printf "%c%c", 85, 170}' |\ - dd of=fs-image obs=1 seek=510 conv=notrunc 2>/dev/null - - vnconfig -s labels -c /dev/r${VNDEVICE} fs-image - - sed '/^minimum:/,$d' /etc/disktab > /etc/disktab.tmp - cat /etc/disktab.tmp > /etc/disktab - rm -f /etc/disktab.tmp - ( - a=`expr ${FSSIZE} \* 2` - echo - echo "minimum:ty=mfs:se#512:nt#1:rm#300:\\" - echo " :ns#$a:nc#1:\\" - echo " :pa#$a:oa#0:ba#4096:fa#512:\\" - echo " :pc#$a:oc#0:bc#4096:fc#512:" - echo - ) >> /etc/disktab - - disklabel -w -r -B \ - -b ${LABELDIR}/boot1 \ - -s ${LABELDIR}/boot2 \ - /dev/r${VNDEVICE} minimum - - newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T minimum /dev/r${VNDEVICE}a - - mount /dev/${VNDEVICE}a ${MNT} - - if ( set -e && cd ${FSPROTO} && find . -print | cpio -dump ${MNT} ) - then - ; - else - echo " $FSINODE and $FSSIZE failed, reverting.." - FSSIZE=`expr ${FSSIZE} + 10` - #FSSIZE=${OLDFSSIZE} - FSINODE=${FSINODE} - continue - fi - - set `df -i /mnt | tail -1` -#/dev/vn0a 937 932 5 99% 342 328 51% /mnt - - umount ${MNT} - - fsck -p /dev/r${VNDEVICE}a < /dev/null - - vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true - - if [ $FSLABEL != "minimum" ] ; then - echo ${FSSIZE} > fs-image.size - break - fi - - OLDFSSIZE=${FSSIZE} - OLDFSINODE=${FSINODE} - echo ">>> Filesystem is ${FSSIZE} K, $4 left" - echo ">>> ${FSINODE} bytes/inode, $7 left" - echo ">>> `expr ${FSSIZE} \* 1024 / ${FSINODE}`" - if [ $4 -gt 128 ] ; then - echo "Reducing size" - FSSIZE=`expr ${FSSIZE} - $4 / 2` - continue - fi - if [ $7 -gt 128 ] ; then - echo "Increasing bytes per inode" - FSINODE=`expr ${FSINODE} + 8192` - continue - fi - if [ $4 -gt 32 ] ; then - echo "Reducing size" - FSSIZE=`expr ${FSSIZE} - 4` - FSINODE=`expr ${FSINODE} - 1024` - continue - fi - if [ $7 -gt 64 ] ; then - echo "Increasing bytes per inode" - FSINODE=`expr ${FSINODE} + 8192` - continue - fi - if [ $deadlock -eq 0 ] ; then - echo "Avoiding deadlock, giving up" - echo ${FSSIZE} > fs-image.size - break - fi - deadlock=`expr $deadlock - 1` - echo ${FSSIZE} > fs-image.size - break; -done diff --git a/release/floppies/fixit/Makefile b/release/floppies/fixit/Makefile deleted file mode 100644 index ee278f76ab4c..000000000000 --- a/release/floppies/fixit/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -### -# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ -# -SUBDIR= crunch image - -.include diff --git a/release/floppies/fixit/crunch/crunch.conf b/release/floppies/fixit/crunch/crunch.conf deleted file mode 100644 index f31652ea1e87..000000000000 --- a/release/floppies/fixit/crunch/crunch.conf +++ /dev/null @@ -1,45 +0,0 @@ -# $Id: fixit_crunch.conf,v 1.6 1996/01/03 23:41:03 joerg Exp $ - -# first, we list the source dirs that our programs reside in. These are -# searched in order listed to find the dir containing each program. - -srcdirs /usr/src/bin -srcdirs /usr/src/sbin/i386 -srcdirs /usr/src/sbin -srcdirs /usr/src/gnu/usr.bin -srcdirs /usr/src/usr.bin -srcdirs /usr/src/usr.sbin -srcdirs /usr/src/usr.bin/vi - -# second, we list all the programs we want to include in our crunched binary. -# The order doesn't matter. Any program that needs hard links to it gets an -# `ln' directive. - -# /bin stuff - -progs cat chmod chroot cp date dd df echo ed expr hostname kill ln ls mkdir -progs mt mv pwd rcp rm rmdir sleep stty sync test - -ln test [ - -# /sbin stuff - -progs badsect chown clri disklabel dump dmesg fdisk -progs mknod mount newfs ping reboot restore scsi swapon umount - -progs mount_msdos mount_cd9660 mount_nfs -ln dump rdump -ln restore rrestore -ln newfs mount_mfs - -# /usr/bin stuff - -progs ftp rsh sed telnet rlogin common find grep -ln common vi -ln common view -ln common ex - -# finally, we specify the libraries to link in with our binary - -libs -lcrypt -ltelnet -lutil -ll -libs -lcurses -ltermcap -ledit -lgnuregex -lkvm -lscsi diff --git a/release/floppies/fixit/image/Makefile b/release/floppies/fixit/image/Makefile deleted file mode 100644 index a8a80c4403be..000000000000 --- a/release/floppies/fixit/image/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -### -# $Id: Makefile,v 1.214 1996/05/02 08:18:28 jkh Exp $ -# -# What are we if we weren't told.. -CRUNCH?= fixit -CRUNCHDIRS= ../crunch -TOP=${.CURDIR}/../../../.. -FS_BIN=${.CURDIR}/../.. - -# the directories you want on the fs -FS_DIRS= dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp -# a subdir that contains a verbatim image to be copied to the fs -VERBATIM= ../verbatim - -.include "../../crunch_fs.mk" -all: fs_image diff --git a/release/floppies/fixit/verbatim/.profile b/release/floppies/fixit/verbatim/.profile deleted file mode 100644 index f5664e8d6eb8..000000000000 --- a/release/floppies/fixit/verbatim/.profile +++ /dev/null @@ -1,15 +0,0 @@ -: -# $Id: fixit.profile,v 1.1 1995/03/15 06:14:19 phk Exp $ -PATH=/stand -BLOCKSIZE=K -PS1="Fixit# " - -echo '+---------------------------------------------------+' -echo '| You are now running from a FreeBSD "fixit" floppy |' -echo '+---------------------------------------------------+' -echo -echo 'Good Luck!' -echo - -export PATH BLOCKSIZE PS1 - diff --git a/release/floppies/write_mfs_in_kernel.c b/release/floppies/write_mfs_in_kernel.c deleted file mode 100644 index 886bdd234dd8..000000000000 --- a/release/floppies/write_mfs_in_kernel.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $Id: write_mfs_in_kernel.c,v 1.1 1995/04/25 03:45:18 phk Exp $ - * - * This program patches a filesystem into a kernel made with MFS_ROOT - * option. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -main(int argc, char **argv) -{ - unsigned char *buf_kernel, *buf_fs, *p,*q; - int fd_kernel, fd_fs; - struct stat st_kernel, st_fs; - u_long l; - - if (argc < 3) { - fprintf(stderr,"Usage:\n\t%s kernel fs\n"); - exit(2); - } - fd_kernel = open(argv[1],O_RDWR); - if (fd_kernel < 0) { perror(argv[1]); exit(2); } - fstat(fd_kernel,&st_kernel); - fd_fs = open(argv[2],O_RDONLY); - if (fd_fs < 0) { perror(argv[2]); exit(2); } - fstat(fd_fs,&st_fs); - buf_kernel = malloc(st_kernel.st_size); - if (!buf_kernel) { perror("malloc"); exit(2); } - buf_fs = malloc(st_fs.st_size); - if (!buf_fs) { perror("malloc"); exit(2); } - if (st_kernel.st_size != read(fd_kernel,buf_kernel,st_kernel.st_size)) - { perror(argv[1]); exit(2); } - if (st_fs.st_size != read(fd_fs,buf_fs,st_fs.st_size)) - { perror(argv[2]); exit(2); } - for(l=0,p=buf_kernel; l < st_kernel.st_size - st_fs.st_size ; l++,p++ ) - if(*p == 'M' && !strcmp(p,"MFS Filesystem goes here")) - goto found; - fprintf(stderr,"MFS filesystem signature not found in %s\n",argv[1]); - exit(1); - found: - for(l=0,q= p + SBOFF; l < st_fs.st_size - SBOFF ; l++,q++ ) - if (*q) - goto fail; - memcpy(p+SBOFF,buf_fs+SBOFF,st_fs.st_size-SBOFF); - lseek(fd_kernel,0L,SEEK_SET); - if (st_kernel.st_size != write(fd_kernel,buf_kernel,st_kernel.st_size)) - { perror(argv[1]); exit(2); } - exit(0); - fail: - l += SBOFF; - fprintf(stderr,"Obstruction in kernel after %ld bytes (%ld Kbyte)\n", - l, l/1024); - fprintf(stderr,"Filesystem is %ld bytes (%ld Kbyte)\n", - (u_long)st_fs.st_size, (u_long)st_fs.st_size/1024); - exit(1); -} diff --git a/release/sysinstall/anonFTP.c b/release/sysinstall/anonFTP.c new file mode 100644 index 000000000000..591589fa8141 --- /dev/null +++ b/release/sysinstall/anonFTP.c @@ -0,0 +1,476 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id: anonFTP.c,v 1.13 1996/04/28 01:07:19 jkh Exp $ + * + * Copyright (c) 1995 + * Coranth Gryphon. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY CORANTH GRYPHON ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CORANTH GRYPHON OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ui_objects.h" +#include "dir.h" +#include "dialog.priv.h" +#include "colors.h" +#include "sysinstall.h" + +/* This doesn't change until FTP itself changes */ + +#define FTP_NAME "ftp" +#define MOTD_FILE "ftpmotd" + +/* These change if we want to use different defaults */ + +#define FTP_UID 14 +#define FTP_GID 5 +#define FTP_GROUP "operator" +#define FTP_UPLOAD "incoming" +#define FTP_COMMENT "Anonymous FTP Admin" +#define FTP_HOMEDIR "/var/ftp" + +#define ANONFTP_HELPFILE "anonftp" + +/* Set up the structure to hold configuration information */ +/* Note that this is only what we could fit onto the one screen */ + +typedef struct +{ + char homedir[64]; /* Home Dir for Anon FTP */ + char group[32]; /* Group */ + char uid[8]; /* UID */ + char comment[64]; /* PWD Comment */ + char upload[32]; /* Upload Dir */ +} FTPConf; + +static FTPConf tconf; + +#define ANONFTP_HOMEDIR_LEN 64 +#define ANONFTP_COMMENT_LEN 64 +#define ANONFTP_UPLOAD_LEN 32 +#define ANONFTP_GROUP_LEN 32 +#define ANONFTP_UID_LEN 8 + +static int okbutton, cancelbutton; + +/* What the screen size is meant to be */ +#define ANONFTP_DIALOG_Y 0 +#define ANONFTP_DIALOG_X 8 +#define ANONFTP_DIALOG_WIDTH COLS - 16 +#define ANONFTP_DIALOG_HEIGHT LINES - 2 + +/* The screen layout structure */ +typedef struct _layout { + int y; /* x & Y co-ordinates */ + int x; + int len; /* The size of the dialog on the screen */ + int maxlen; /* How much the user can type in ... */ + char *prompt; /* The string for the prompt */ + char *help; /* The display for the help line */ + void *var; /* The var to set when this changes */ + int type; /* The type of the dialog to create */ + void *obj; /* The obj pointer returned by libdialog */ +} Layout; + +static Layout layout[] = { + { 2, 3, 8, ANONFTP_UID_LEN - 1, + "UID:", "What user ID to assign to FTP Admin", + tconf.uid, STRINGOBJ, NULL }, +#define LAYOUT_UID 1 + + { 2, 15, 15, ANONFTP_GROUP_LEN - 1, + "Group:", "Group name that ftp process belongs to", + tconf.group, STRINGOBJ, NULL }, +#define LAYOUT_GROUP 2 + + { 2, 35, 24, ANONFTP_COMMENT_LEN - 1, + "Comment:", "Password file comment for FTP Admin", + tconf.comment, STRINGOBJ, NULL }, +#define LAYOUT_COMMENT 3 + + { 9, 10, 43, ANONFTP_HOMEDIR_LEN - 1, + "FTP Root Directory:", + "The top directory to chroot to when doing anonymous ftp", + tconf.homedir, STRINGOBJ, NULL }, +#define LAYOUT_HOMEDIR 4 + + { 14, 20, 22, ANONFTP_UPLOAD_LEN - 1, + "Upload Subdirectory:", "Designated sub-directory that holds uploads", + tconf.upload, STRINGOBJ, NULL }, +#define LAYOUT_UPLOAD 5 + + { 19, 15, 0, 0, + "OK", "Select this if you are happy with these settings", + &okbutton, BUTTONOBJ, NULL }, +#define LAYOUT_OKBUTTON 6 + + { 19, 35, 0, 0, + "CANCEL", "Select this if you wish to cancel this screen", + &cancelbutton, BUTTONOBJ, NULL }, +#define LAYOUT_CANCELBUTTON 7 + { NULL }, +}; + +int +createFtpUser(void) +{ + struct passwd *tpw; + struct group *tgrp; + char pwline[256]; + char *tptr; + int gid; + FILE *fptr; + + if ((gid = atoi(tconf.group)) <= 0) { + if (!(tgrp = getgrnam(tconf.group))) { + /* group does not exist, create it by name */ + + tptr = msgGetInput("14", "What group ID to use for group %s ?", tconf.group); + if (tptr && *tptr && ((gid = atoi(tptr)) > 0)) { + if ((fptr = fopen(_PATH_GROUP,"a"))) { + fprintf(fptr,"%s:*:%d:%s\n",tconf.group,gid,FTP_NAME); + fclose(fptr); + } + } + else + gid = FTP_GID; + } + else + gid = tgrp->gr_gid; + } + else if (!getgrgid(gid)) { + /* group does not exist, create it by number */ + + tptr = msgGetInput("14", "What group name to use for gid %d ?", gid); + if (tptr && *tptr) { + strcpy(tconf.group, tptr); + if ((tgrp = getgrnam(tconf.group))) { + gid = tgrp->gr_gid; + } + else if ((fptr = fopen(_PATH_GROUP,"a"))) { + fprintf(fptr,"%s:*:%d:%s\n",tconf.group,gid,FTP_NAME); + fclose(fptr); + } + } + } + + if ((tpw = getpwnam(FTP_NAME))) { + if (tpw->pw_uid != FTP_UID) + msgConfirm("FTP user already exists with a different uid."); + + return (DITEM_SUCCESS); /* succeeds if already exists */ + } + + sprintf(pwline, "%s::%s:%d::0:0:%s:%s:/bin/date\n", FTP_NAME, tconf.uid, gid, tconf.comment, tconf.homedir); + + fptr = fopen(_PATH_MASTERPASSWD,"a"); + if (! fptr) { + msgConfirm("Could not open master password file."); + return (DITEM_FAILURE); + } + fprintf(fptr, pwline); + fclose(fptr); + msgNotify("Remaking password file: %s", _PATH_MASTERPASSWD); + vsystem("pwd_mkdb -p %s", _PATH_MASTERPASSWD); + return (DITEM_SUCCESS); +} + +/* This is it - how to get the setup values */ +static int +anonftpOpenDialog(void) +{ + WINDOW *ds_win; + ComposeObj *obj = NULL; + ComposeObj *first, *last; + int n=0, quit=FALSE, cancel=FALSE, ret; + int max; + char help[FILENAME_MAX]; + char title[80]; + + /* We need a curses window */ + ds_win = newwin(LINES, COLS, 0, 0); + if (ds_win == 0) { + beep(); + msgConfirm("Cannot open anonymous ftp dialog window!!"); + return(DITEM_FAILURE); + } + + /* Say where our help comes from */ + systemHelpFile(ANONFTP_HELPFILE, help); + use_helpfile(help); + + /* Setup a nice screen for us to splat stuff onto */ + draw_box(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X, ANONFTP_DIALOG_HEIGHT, ANONFTP_DIALOG_WIDTH, dialog_attr, border_attr); + wattrset(ds_win, dialog_attr); + mvwaddstr(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X + 20, " Anonymous FTP Configuration "); + + draw_box(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 8, ANONFTP_DIALOG_HEIGHT - 11, ANONFTP_DIALOG_WIDTH - 17, + dialog_attr, border_attr); + wattrset(ds_win, dialog_attr); + sprintf(title, " Path Configuration "); + mvwaddstr(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 22, title); + + /** Initialize the config Data Structure **/ + + bzero(&tconf, sizeof(tconf)); + + strcpy(tconf.group, FTP_GROUP); + strcpy(tconf.upload, FTP_UPLOAD); + strcpy(tconf.comment, FTP_COMMENT); + strcpy(tconf.homedir, FTP_HOMEDIR); + sprintf(tconf.uid, "%d", FTP_UID); + + /* Loop over the layout list, create the objects, and add them + onto the chain of objects that dialog uses for traversal*/ + + n = 0; +#define lt layout[n] + + while (lt.help != NULL) { + switch (lt.type) { + case STRINGOBJ: + lt.obj = NewStringObj(ds_win, lt.prompt, lt.var, + lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X, + lt.len, lt.maxlen); + break; + + case BUTTONOBJ: + lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var, + lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X); + break; + + default: + msgFatal("Don't support this object yet!"); + } + AddObj(&obj, lt.type, (void *) lt.obj); + n++; + } + max = n - 1; + + /* Find the last object we can traverse to */ + last = obj; + while (last->next) + last = last->next; + + /* Find the first object in the list */ + first = obj; + while (first->prev) + first = first->prev; + + /* Some more initialisation before we go into the main input loop */ + n = 0; + cancelbutton = 0; + cancel = FALSE; + okbutton = 0; + + /* Incoming user data - DUCK! */ + while (!quit) { + char help_line[80]; + int i, len = strlen(lt.help); + + /* Display the help line at the bottom of the screen */ + for (i = 0; i < 79; i++) + help_line[i] = (i < len) ? lt.help[i] : ' '; + help_line[i] = '\0'; + use_helpline(help_line); + display_helpline(ds_win, LINES - 1, COLS - 1); + + /* Ask for libdialog to do its stuff */ + ret = PollObj(&obj); + + /* Handle special case stuff that libdialog misses. Sigh */ + switch (ret) { + /* Bail out */ + case SEL_ESC: + quit = TRUE, cancel=TRUE; + break; + + /* This doesn't work for list dialogs. Oh well. Perhaps + should special case the move from the OK button ``up'' + to make it go to the interface list, but then it gets + awkward for the user to go back and correct screw up's + in the per-interface section */ + + case KEY_UP: + if (obj->prev !=NULL ) { + obj = obj->prev; + --n; + } else { + obj = last; + n = max; + } + break; + + case KEY_DOWN: + if (obj->next != NULL) { + obj = obj->next; + ++n; + } else { + obj = first; + n = 0; + } + break; + + case SEL_TAB: + if (n < max) + ++n; + else + n = 0; + break; + + /* The user has pressed enter over a button object */ + case SEL_BUTTON: + quit = TRUE; + if (cancelbutton) + cancel = TRUE; + break; + + /* Generic CR handler */ + case SEL_CR: + if (n < max) + ++n; + else + n = 0; + break; + + case SEL_BACKTAB: + if (n) + --n; + else + n = max; + break; + + case KEY_F(1): + display_helpfile(); + + /* They tried some key combination we don't support - tell them! */ + default: + beep(); + } + } + + /* Clear this crap off the screen */ + dialog_clear(); + refresh(); + use_helpfile(NULL); + + if (cancel) + return DITEM_FAILURE; + return DITEM_SUCCESS; +} + +int +configAnonFTP(dialogMenuItem *self) +{ + int i; + + /* Be optimistic */ + i = DITEM_SUCCESS; + + dialog_clear(); + i = anonftpOpenDialog(); + if (DITEM_STATUS(i) != DITEM_SUCCESS) { + msgConfirm("Configuration of Anonymous FTP cancelled per user request."); + return i | DITEM_RESTORE; + } + + /*** Use defaults for any invalid values ***/ + if (atoi(tconf.uid) <= 0) + sprintf(tconf.uid, "%d", FTP_UID); + + if (!tconf.group[0]) + strcpy(tconf.group, FTP_GROUP); + + if (!tconf.upload[0]) + strcpy(tconf.upload, FTP_UPLOAD); + + /*** If the user did not specify a directory, use default ***/ + + if (tconf.homedir[strlen(tconf.homedir) - 1] == '/') + tconf.homedir[strlen(tconf.homedir) - 1] = '\0'; + + if (!tconf.homedir[0]) + strcpy(tconf.homedir, FTP_HOMEDIR); + + /*** If HomeDir does not exist, create it ***/ + + if (!directory_exists(tconf.homedir)) + vsystem("mkdir -p %s", tconf.homedir); + + if (directory_exists(tconf.homedir)) { + msgNotify("Configuring %s for use by anon FTP.", tconf.homedir); + vsystem("chmod 555 %s && chown root.%s %s", tconf.homedir, tconf.group, tconf.homedir); + vsystem("mkdir %s/bin && chmod 555 %s/bin", tconf.homedir, tconf.homedir); + vsystem("cp /bin/ls %s/bin && chmod 111 %s/bin/ls", tconf.homedir, tconf.homedir); + vsystem("cp /bin/date %s/bin && chmod 111 %s/bin/date", tconf.homedir, tconf.homedir); + vsystem("mkdir %s/etc && chmod 555 %s/etc", tconf.homedir, tconf.homedir); + vsystem("mkdir -p %s/pub", tconf.homedir); + vsystem("mkdir -p %s/%s", tconf.homedir, tconf.upload); + vsystem("chmod 1777 %s/%s", tconf.homedir, tconf.upload); + + if (DITEM_STATUS(createFtpUser()) == DITEM_SUCCESS) { + msgNotify("Copying password information for anon FTP."); + vsystem("cp /etc/pwd.db %s/etc && chmod 444 %s/etc/pwd.db", tconf.homedir, tconf.homedir); + vsystem("cp /etc/passwd %s/etc && chmod 444 %s/etc/passwd", tconf.homedir, tconf.homedir); + vsystem("cp /etc/group %s/etc && chmod 444 %s/etc/group", tconf.homedir, tconf.homedir); + vsystem("chown -R %s.%s %s/pub", FTP_NAME, tconf.group, tconf.homedir); + } + else { + msgConfirm("Unable to create FTP user! Anonymous FTP setup failed."); + i = DITEM_FAILURE; + } + + if (!msgYesNo("Create a welcome message file for anonymous FTP users?")) { + char cmd[256]; + dialog_clear(); + vsystem("echo Your welcome message here. > %s/etc/%s", tconf.homedir, MOTD_FILE); + sprintf(cmd, "%s %s/etc/%s", variable_get(VAR_EDITOR), tconf.homedir, MOTD_FILE); + if (!systemExecute(cmd)) + i = DITEM_SUCCESS; + else + i = DITEM_FAILURE; + } + } + else { + msgConfirm("Invalid Directory: %s\n" + "Anonymous FTP will not be set up.", tconf.homedir); + i = DITEM_FAILURE; + } + if (DITEM_STATUS(i) == DITEM_SUCCESS) + variable_set2("anon_ftp", "YES"); + return i | DITEM_RESTORE; +} diff --git a/release/sysinstall/apache.c b/release/sysinstall/apache.c new file mode 100644 index 000000000000..debf7a502232 --- /dev/null +++ b/release/sysinstall/apache.c @@ -0,0 +1,611 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id: apache.c,v 1.24 1996/06/15 17:58:49 jkh Exp $ + * + * Copyright (c) 1995 + * Coranth Gryphon. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY CORANTH GRYPHON ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CORANTH GRYPHON OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include "ui_objects.h" +#include "dir.h" +#include "dialog.priv.h" +#include "colors.h" +#include "sysinstall.h" + + +#define APACHE_HELPFILE "apache" +#define APACHE_PACKAGE "apache-1.1.1" +#define FREEBSD_GIF "http://www.freebsd.org/gifs/powerlogo.gif" + +/* These change if the package uses different defaults */ + +#define DEFAULT_USER "bin" +#define DEFAULT_GROUP "bin" +#define WELCOME_FILE "index.html" +#define USER_HOMEDIR "public_html" + +#define APACHE_BASE "/usr/local/www" +#define DATA_SUBDIR "data" +#define CONFIG_SUBDIR "server/conf" + +#define LOGS_SUBDIR "/var/log" +#define ACCESS_LOGNAME "httpd.access" +#define ERROR_LOGNAME "httpd.error" + +/* Set up the structure to hold configuration information */ +/* Note that this is only what we could fit onto the one screen */ + +typedef struct { + char docroot[128]; /* DocumentRoot */ + char userdir[128]; /* UserDir */ + char welcome[32]; /* Welcome Doc */ + char email[64]; /* ServerAdmin */ + char hostname[64]; /* ServerName */ + char logdir[64]; /* Where to put Logs */ + char accesslog[32]; /* access_log */ + char errorlog[32]; /* error_log */ + char defuser[16]; /* default user id */ + char defgroup[16]; /* default group id */ +} ApacheConf; + +static ApacheConf tconf; + +#define APACHE_DOCROOT_LEN 128 +#define APACHE_USERDIR_LEN 128 +#define APACHE_WELCOME_LEN 32 +#define APACHE_EMAIL_LEN 64 +#define APACHE_HOSTNAME_LEN 64 +#define APACHE_LOGDIR_LEN 64 +#define APACHE_ACCESSLOG_LEN 32 +#define APACHE_ERRORLOG_LEN 32 +#define APACHE_DEFUSER_LEN 16 +#define APACHE_DEFGROUP_LEN 16 + +static int okbutton, cancelbutton; + +/* What the screen size is meant to be */ +#define APACHE_DIALOG_Y 0 +#define APACHE_DIALOG_X 0 +#define APACHE_DIALOG_WIDTH COLS +#define APACHE_DIALOG_HEIGHT LINES - 2 + +/* The screen layout structure */ +typedef struct _layout { + int y; /* x & Y co-ordinates */ + int x; + int len; /* The size of the dialog on the screen */ + int maxlen; /* How much the user can type in ... */ + char *prompt; /* The string for the prompt */ + char *help; /* The display for the help line */ + void *var; /* The var to set when this changes */ + int type; /* The type of the dialog to create */ + void *obj; /* The obj pointer returned by libdialog */ +} Layout; + +static Layout layout[] = { + { 1, 2, 30, HOSTNAME_FIELD_LEN - 1, + "Host Name:", + "What name to report this host as to client browsers", + tconf.hostname, STRINGOBJ, NULL }, +#define LAYOUT_HOSTNAME 0 + + { 1, 40, 32, APACHE_EMAIL_LEN - 1, + "Email Address:", + "The email address of the site maintainer, e.g. webmaster@bar.com", + tconf.email, STRINGOBJ, NULL }, +#define LAYOUT_EMAIL 1 + + { 5, 5, 20, APACHE_WELCOME_LEN - 1, + "Default Document:", + "The name of the default document found in each directory", + tconf.welcome, STRINGOBJ, NULL }, +#define LAYOUT_WELCOME 2 + + { 5, 40, 14, APACHE_DEFUSER_LEN - 1, + "Default UserID:", "Default UID for access to web pages", + tconf.defuser, STRINGOBJ, NULL }, +#define LAYOUT_DEFUSER 3 + + { 5, 60, 14, APACHE_DEFGROUP_LEN - 1, + "Default Group ID:", "Default GID for access to web pages", + tconf.defgroup, STRINGOBJ, NULL }, +#define LAYOUT_DEFGROUP 4 + + { 10, 4, 36, APACHE_DOCROOT_LEN - 1, + "Root Document Path:", + "The top directory that holds the system web pages", + tconf.docroot, STRINGOBJ, NULL }, +#define LAYOUT_DOCROOT 5 + + { 10, 50, 14, APACHE_USERDIR_LEN - 1, + "User Directory:", + "Personal sub-directory that holds users' web pages (eg. ~/Web)", + tconf.userdir, STRINGOBJ, NULL }, +#define LAYOUT_USERDIR 6 + + { 14, 4, 28, APACHE_LOGDIR_LEN - 1, + "Log Dir:", "Directory to put httpd log files", + tconf.logdir, STRINGOBJ, NULL }, +#define LAYOUT_LOGDIR 7 + + { 14, 38, 16, APACHE_ACCESSLOG_LEN - 1, + "Access Log:", "Name of log file to report access", + tconf.accesslog, STRINGOBJ, NULL }, +#define LAYOUT_ACCESSLOG 8 + + { 14, 60, 16, APACHE_ERRORLOG_LEN - 1, + "Error Log:", "Name of log file to report errors", + tconf.errorlog, STRINGOBJ, NULL }, +#define LAYOUT_ERRORLOG 9 + + { 19, 15, 0, 0, + "OK", "Select this if you are happy with these settings", + &okbutton, BUTTONOBJ, NULL }, +#define LAYOUT_OKBUTTON 10 + + { 19, 45, 0, 0, + "CANCEL", "Select this if you wish to cancel this screen", + &cancelbutton, BUTTONOBJ, NULL }, +#define LAYOUT_CANCELBUTTON 11 + { NULL }, +}; + +/* This is it - how to get Apache setup values */ +static int +apacheOpenDialog(void) +{ + WINDOW *ds_win; + ComposeObj *obj = NULL; + ComposeObj *first, *last; + int n=0, quit=FALSE, cancel=FALSE, ret; + int max; + char *tmp; + char help[FILENAME_MAX]; + char title[80]; + + /* We need a curses window */ + ds_win = newwin(LINES, COLS, 0, 0); + if (ds_win == 0) + { + beep(); + msgConfirm("Cannot open apache dialog window!!"); + return(DITEM_SUCCESS); + } + + /* Say where our help comes from */ + systemHelpFile(APACHE_HELPFILE, help); + use_helpfile(help); + + /* Setup a nice screen for us to splat stuff onto */ + draw_box(ds_win, APACHE_DIALOG_Y, APACHE_DIALOG_X, APACHE_DIALOG_HEIGHT, APACHE_DIALOG_WIDTH, dialog_attr, border_attr); + wattrset(ds_win, dialog_attr); + mvwaddstr(ds_win, APACHE_DIALOG_Y, APACHE_DIALOG_X + 20, " Apache HTTPD Configuration "); + + draw_box(ds_win, APACHE_DIALOG_Y + 9, APACHE_DIALOG_X + 1, APACHE_DIALOG_HEIGHT - 13, APACHE_DIALOG_WIDTH - 2, + dialog_attr, border_attr); + wattrset(ds_win, dialog_attr); + sprintf(title, " Path Configuration "); + mvwaddstr(ds_win, APACHE_DIALOG_Y + 9, APACHE_DIALOG_X + 22, title); + + /** Initialize the config Data Structure **/ + + bzero(&tconf, sizeof(tconf)); + + tmp = variable_get(VAR_DOMAINNAME); + if (tmp) { + sprintf(tconf.email, "webmaster@%s", tmp); + sprintf(tconf.hostname, "www.%s", tmp); + } + + strcpy(tconf.defuser, DEFAULT_USER); + strcpy(tconf.defgroup, DEFAULT_GROUP); + + strcpy(tconf.userdir, USER_HOMEDIR); + strcpy(tconf.welcome, WELCOME_FILE); + + strcpy(tconf.logdir, LOGS_SUBDIR); + strcpy(tconf.accesslog, ACCESS_LOGNAME); + strcpy(tconf.errorlog, ERROR_LOGNAME); + + sprintf(tconf.docroot, "%s/%s", APACHE_BASE,DATA_SUBDIR); + + /* Loop over the layout list, create the objects, and add them + onto the chain of objects that dialog uses for traversal*/ + + n = 0; + +#define lt layout[n] + + while (lt.help != NULL) { + switch (lt.type) { + case STRINGOBJ: + lt.obj = NewStringObj(ds_win, lt.prompt, lt.var, + lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X, + lt.len, lt.maxlen); + break; + + case BUTTONOBJ: + lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var, + lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X); + break; + + default: + msgFatal("Don't support this object yet!"); + } + AddObj(&obj, lt.type, (void *) lt.obj); + n++; + } + max = n - 1; + + /* Find the last object we can traverse to */ + last = obj; + while (last->next) + last = last->next; + + /* Find the first object in the list */ + first = obj; + while (first->prev) + first = first->prev; + + /* Some more initialisation before we go into the main input loop */ + n = 0; + cancelbutton = 0; + cancel = FALSE; + okbutton = 0; + + /* Incoming user data - DUCK! */ + while (!quit) { + char help_line[80]; + int i, len = strlen(lt.help); + + /* Display the help line at the bottom of the screen */ + for (i = 0; i < 79; i++) + help_line[i] = (i < len) ? lt.help[i] : ' '; + help_line[i] = '\0'; + use_helpline(help_line); + display_helpline(ds_win, LINES - 1, COLS - 1); + + /* Ask for libdialog to do its stuff */ + ret = PollObj(&obj); + + /* We are in the Hostname field - calculate the e-mail addr */ + if (n == LAYOUT_HOSTNAME) { + if ((tmp = index(tconf.hostname, '.')) != NULL) { + sprintf(tconf.email,"webmaster@%s",tmp+1); + RefreshStringObj(layout[LAYOUT_EMAIL].obj); + } + } + + /* Handle special case stuff that libdialog misses. Sigh */ + switch (ret) { + /* Bail out */ + case SEL_ESC: + quit = TRUE, cancel=TRUE; + break; + + /* This doesn't work for list dialogs. Oh well. Perhaps + should special case the move from the OK button ``up'' + to make it go to the interface list, but then it gets + awkward for the user to go back and correct screw up's + in the per-interface section */ + + case KEY_UP: + if (obj->prev !=NULL ) { + obj = obj->prev; + --n; + } else { + obj = last; + n = max; + } + break; + + case KEY_DOWN: + if (obj->next != NULL) { + obj = obj->next; + ++n; + } else { + obj = first; + n = 0; + } + break; + + case SEL_TAB: + if (n < max) + ++n; + else + n = 0; + break; + + /* The user has pressed enter over a button object */ + case SEL_BUTTON: + quit = TRUE; + if (cancelbutton) + cancel = TRUE; + break; + + /* Generic CR handler */ + case SEL_CR: + if (n < max) + ++n; + else + n = 0; + break; + + case SEL_BACKTAB: + if (n) + --n; + else + n = max; + break; + + case KEY_F(1): + display_helpfile(); + + /* They tried some key combination we don't support - tell them! */ + default: + beep(); + } + + } + + /* Clear this crap off the screen */ + dialog_clear(); + refresh(); + use_helpfile(NULL); + + if (cancel) + return DITEM_FAILURE | DITEM_RESTORE; + return DITEM_SUCCESS | DITEM_RESTORE; +} + +int +configApache(dialogMenuItem *self) +{ + int i; + char company[64], file[128]; + char *tptr; + FILE *fptr; + + /* Be optimistic */ + i = DITEM_SUCCESS; + + dialog_clear(); + msgConfirm("Since you elected to install the WEB server, we'll now add the\n" + "Apache HTTPD package and set up a few configuration files."); + i = package_add(APACHE_PACKAGE); + if (DITEM_STATUS(i) != DITEM_SUCCESS) { + msgConfirm("Hmmmmm. Looks like we weren't able to fetch the Apache WEB server\n" + "package. You may wish to fetch and configure it by hand by looking\n" + "in /usr/ports/net/apache (in the ports collection) or looking for the\n" + "precompiled apache package in packages/networking/%s.", APACHE_PACKAGE); + return i | DITEM_RESTORE; + } + + dialog_clear(); + i = apacheOpenDialog(); + if (DITEM_STATUS(i) != DITEM_SUCCESS) { + msgConfirm("Configuration of the Apache WEB server was cancelled per\n" + "user request."); + return i; + } + /*** Fix defaults for invalid value ***/ + if (!tconf.logdir[0]) + strcpy(tconf.logdir, LOGS_SUBDIR); + if (!tconf.accesslog[0]) + strcpy(tconf.accesslog, ACCESS_LOGNAME); + if (!tconf.errorlog[0]) + strcpy(tconf.errorlog, ERROR_LOGNAME); + + if (!tconf.welcome[0]) + strcpy(tconf.welcome, WELCOME_FILE); + if (!tconf.userdir[0]) + strcpy(tconf.userdir, USER_HOMEDIR); + + if (!tconf.defuser[0]) + strcpy(tconf.defuser, DEFAULT_USER); + if (!tconf.defgroup[0]) + strcpy(tconf.defgroup, DEFAULT_GROUP); + + /*** If the user did not specify a directory, use default ***/ + + if (tconf.docroot[strlen(tconf.docroot) - 1] == '/') + tconf.docroot[strlen(tconf.docroot) - 1] = '\0'; + + if (!tconf.docroot[0]) + sprintf(tconf.docroot, "%s/%s", APACHE_BASE, DATA_SUBDIR); + + /*** If DocRoot does not exist, create it ***/ + + if (!directory_exists(tconf.docroot)) + vsystem("mkdir -p %s", tconf.docroot); + + if (directory_exists(tconf.docroot)) { + sprintf(file, "%s/%s", tconf.docroot, tconf.welcome); + if (!file_readable(file)) { + tptr = msgGetInput(NULL, "What is your company name?"); + if (tptr && tptr[0]) + strcpy(company, tptr); + else + strcpy(company, "our Web Page"); + + msgNotify("Creating sample web page..."); + fptr = fopen(file,"w"); + if (fptr) { + fprintf(fptr, "
\nWelcome Page\n"); + fprintf(fptr, "

Welcome to %s

\n
\n",company); + fprintf(fptr, "


\n
\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "\"Powered\n"); + if (!tconf.email[0]) { + if ((tptr = variable_get(VAR_DOMAINNAME))) + sprintf(tconf.email, "root@%s", tptr); + } + if (tconf.email[0]) { + fprintf(fptr, "

\n"); + fprintf(fptr, " For questions or comments, please send mail to:\n"); + fprintf(fptr, " %s\n", + tconf.email, tconf.email); + fprintf(fptr, "

\n"); + } + fprintf(fptr, "
\n\n"); + fclose(fptr); + } + else { + msgConfirm("Unable to create sample Web Page."); + i = DITEM_FAILURE; + } + } + } + else { + msgConfirm("Unable to create Document Root Directory."); + i = DITEM_FAILURE; + } + + msgNotify("Writing configuration files...."); + + (void)vsystem("mkdir -p %s/%s", APACHE_BASE, CONFIG_SUBDIR); + sprintf(file, "%s/%s/access.conf", APACHE_BASE, CONFIG_SUBDIR); + if (file_readable(file)) + vsystem("mv -f %s %s.ORIG", file, file); + + fptr = fopen(file,"w"); + if (fptr) { + fprintf(fptr, "\n", APACHE_BASE); + fprintf(fptr, "Options Indexes FollowSymLinks\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "\n", tconf.docroot); + fprintf(fptr, "Options Indexes FollowSymLinks\n"); + fprintf(fptr, "AllowOverride All\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "\n"); + fclose(fptr); + } + else { + msgConfirm("Could not create %s",file); + i = DITEM_FAILURE; + } + + sprintf(file, "%s/%s/httpd.conf", APACHE_BASE, CONFIG_SUBDIR); + if (file_readable(file)) + vsystem("mv -f %s %s.ORIG", file, file); + + fptr = fopen(file,"w"); + if (fptr) { + fprintf(fptr, "ServerType standalone\n"); + fprintf(fptr, "Port 80\n"); + fprintf(fptr, "TimeOut 400\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "ErrorLog %s/%s\n", LOGS_SUBDIR, ERROR_LOGNAME); + fprintf(fptr, "TransferLog %s/%s\n", LOGS_SUBDIR, ACCESS_LOGNAME); + fprintf(fptr, "PidFile /var/run/httpd.pid\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "StartServers 5\n"); + fprintf(fptr, "MinSpareServers 5\n"); + fprintf(fptr, "MaxSpareServers 10\n"); + fprintf(fptr, "MaxRequestsPerChild 30\n"); + fprintf(fptr, "MaxClients 150\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "User %s\n",tconf.defuser); + fprintf(fptr, "Group %s\n",tconf.defgroup); + fprintf(fptr, "\n"); + + if (tconf.email[0]) + fprintf(fptr, "ServerAdmin %s\n", tconf.email); + if (tconf.hostname[0]) + fprintf(fptr, "ServerName %s\n", tconf.hostname); + + fclose(fptr); + } + else { + msgConfirm("Could not create %s",file); + i = DITEM_FAILURE; + } + + sprintf(file, "%s/%s/srm.conf", APACHE_BASE, CONFIG_SUBDIR); + if (file_readable(file)) + vsystem("mv -f %s %s.ORIG", file, file); + fptr = fopen(file,"w"); + if (fptr) { + fprintf(fptr, "FancyIndexing on\n"); + fprintf(fptr, "DefaultType text/plain\n"); + fprintf(fptr, "IndexIgnore */.??* *~ *# */HEADER* */README* */RCS\n"); + fprintf(fptr, "HeaderName HEADER\n"); + fprintf(fptr, "ReadmeName README\n"); + fprintf(fptr, "AccessFileName .htaccess\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "AddEncoding x-compress Z\n"); + fprintf(fptr, "AddEncoding x-gzip gz\n"); + fprintf(fptr, "DefaultIcon /icons/unknown.gif\n"); + fprintf(fptr, "\n"); + fprintf(fptr, "AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip\n"); + fprintf(fptr, "AddIconByType (TXT,/icons/text.gif) text/*\n"); + fprintf(fptr, "AddIconByType (IMG,/icons/image2.gif) image/*\n"); + fprintf(fptr, "AddIconByType (SND,/icons/sound2.gif) audio/*\n"); + fprintf(fptr, "AddIconByType (VID,/icons/movie.gif) video/*\n"); + fprintf(fptr, "\n"); + + fprintf(fptr, "AddIcon /icons/text.gif .ps .shtml\n"); + fprintf(fptr, "AddIcon /icons/movie.gif .mpg .qt\n"); + fprintf(fptr, "AddIcon /icons/binary.gif .bin\n"); + fprintf(fptr, "AddIcon /icons/burst.gif .wrl\n"); + fprintf(fptr, "AddIcon /icons/binhex.gif .hqx .sit\n"); + fprintf(fptr, "AddIcon /icons/uu.gif .uu\n"); + fprintf(fptr, "AddIcon /icons/tar.gif .tar\n"); + fprintf(fptr, "AddIcon /icons/back.gif ..\n"); + fprintf(fptr, "AddIcon /icons/dir.gif ^^DIRECTORY^^\n"); + fprintf(fptr, "AddIcon /icons/blank.gif ^^BLANKICON^^\n"); + fprintf(fptr, "\n"); + + fprintf(fptr, "ScriptAlias /cgi_bin/ %s/cgi_bin/\n",APACHE_BASE); + fprintf(fptr, "Alias /icons/ %s/icons/\n",APACHE_BASE); + fprintf(fptr, "DocumentRoot %s\n",tconf.docroot); + fprintf(fptr, "UserDir %s\n", tconf.userdir); + fprintf(fptr, "DirectoryIndex %s\n", tconf.welcome); + fprintf(fptr, "\n"); + + fclose(fptr); + } + else { + msgConfirm("Could not create %s",file); + i = DITEM_FAILURE; + } + if (DITEM_STATUS(i) == DITEM_SUCCESS) + variable_set2("apache_httpd", "YES"); + return i | DITEM_RESTORE; +} diff --git a/release/sysinstall/doc.c b/release/sysinstall/doc.c new file mode 100644 index 000000000000..50fdc900acba --- /dev/null +++ b/release/sysinstall/doc.c @@ -0,0 +1,125 @@ +/* + * The new sysinstall program. + * + * This is probably the last attempt in the `sysinstall' line, the next + * generation being slated for what's essentially a complete rewrite. + * + * $Id: doc.c,v 1.17 1996/07/02 01:03:40 jkh Exp $ + * + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + + * + */ + +#include "sysinstall.h" + +/* + * This is called from the main menu. Try to find a copy of Lynx from somewhere + * and fire it up on the first copy of the handbook we can find. + */ +int +docBrowser(dialogMenuItem *self) +{ + int ret; + char *browser = variable_get(VAR_BROWSER_PACKAGE); + + if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) { + msgConfirm("This option may only be used after the system is installed, sorry!"); + return DITEM_FAILURE; + } + + /* First, make sure we have whatever browser we've chosen is here */ + if (!package_exists(browser)) { + ret = package_add(browser); + if (DITEM_STATUS(ret) != DITEM_SUCCESS) { + msgConfirm("Unable to install the %s HTML browser package. You may\n" + "wish to verify that your media is configured correctly and\n" + "try again.", browser); + return ret; + } + } + + if (!file_executable(variable_get(VAR_BROWSER_BINARY))) { + if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n" + "find its binary in %s! You may wish to try a different\n" + "location to load the package from (go to Media menu) and see if that\n" + "makes a difference.\n\n" + "I suggest that we remove the version that was extracted since it does\n" + "not appear to be correct. Would you like me to do that now?")) + vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser); + return DITEM_FAILURE | DITEM_RESTORE; + } + + /* Run browser on the appropriate doc */ + if (dmenuOpenSimple(&MenuHTMLDoc, FALSE)) + return DITEM_SUCCESS | DITEM_RECREATE; + else + return DITEM_FAILURE | DITEM_RECREATE; +} + +/* Try to show one of the documents requested from the HTML doc menu */ +int +docShowDocument(dialogMenuItem *self) +{ + char tmp[512], target[512]; + char *where = NULL; + char *browser = variable_get(VAR_BROWSER_BINARY); + char *str = self->prompt; + + if (!file_executable(browser)) { + msgConfirm("Can't find the browser in %s! Please ensure that it's\n" + "properly set in the Options editor.", browser); + return DITEM_FAILURE; + } + if (!strcmp(str, "Home")) + where = "http://www.freebsd.org"; + else if (!strcmp(str, "Other")) + where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit."); + else if (!strcmp(str, "FAQ")) { + strcpy(target, "/usr/share/doc/FAQ/freebsd-faq.html"); + if (!file_readable(target)) + strcpy(target, "http://www.freebsd.org/FAQ"); + where = target; + } + else if (!strcmp(str, "Handbook")) { + strcpy(target, "/usr/share/doc/handbook/handbook.html"); + if (!file_readable(target)) + strcpy(target, "http://www.freebsd.org/handbook"); + where = target; + } + if (where) { + sprintf(tmp, "%s %s", browser, where); + dialog_clear(); + systemExecute(tmp); + return DITEM_SUCCESS | DITEM_RESTORE; + } + else { + msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n" + "Have you loaded the bin distribution? Is your network connected?"); + return DITEM_FAILURE; + } +} diff --git a/release/sysinstall/help/anonftp.hlp b/release/sysinstall/help/anonftp.hlp new file mode 100644 index 000000000000..e90985e235fe --- /dev/null +++ b/release/sysinstall/help/anonftp.hlp @@ -0,0 +1,19 @@ +This screen allows you to configure the anonymous FTP user. + +The following configuration values are editable: + +UID: The user ID you wish to assign to the anonymous FTP user. + All files uploaded will be owned by this ID. + +Group: Which group you wish the anonymous FTP user to be in. + +Comment: String describing this user in /etc/passwd + + +FTP Root Directory: + + Where files available for anonymous FTP will be kept. + +Upload subdirectory: + + Where files uploaded by anonymous FTP users will go. diff --git a/release/sysinstall/help/apache.hlp b/release/sysinstall/help/apache.hlp new file mode 100644 index 000000000000..3880dddb2ba6 --- /dev/null +++ b/release/sysinstall/help/apache.hlp @@ -0,0 +1,51 @@ +There are two sets of options that the Apache HTTP Server needs. + +The first set covers how it operates. These are as follows: + + The "HostName" field is the name of this host, as it is + reported to each client connection. Normally, the fully + qualified domain name of the host running the server is + returned. If you want this set to something else, however, + (usually "www.my.domain") then this can be entered here. + + Additionally, the server needs to know how many connections + are allowed at one time - this is the "Max Connections" + field. If more than this number of clients attempt to connect + at once, the additional connections will be refused. This is + used to limit how much system load will be imposed by the HTTP + server. + + The "Email Address" field is the address of the person (or + system alias) who is the administrator for this web site. In + addition to being used by the Apache Server itself, it is also + put at the bottom of the sample web page that is created. + + Finally, the "Default User" and "Default Group" fields specify + what user id and group id should be used by the server for + remote connections. Local connections are kept as the UID and + GID of the local process. + +The second set of options determine what information is made available +to each client: + + The "Document Root Path" is the top of the tree of documents + that are made avaliable. For example, if the value is + "/usr/web", then the URL "http://www.foo.com/doc.html" would + translate as "/usr/web/doc.html". + + Similarly, the "User Directory" is the location in each user's + home directory where their public web documents are + stored. Thus if the value if this is "Public", then the URL + "http://www.foo.com/~joe/doc" would translate to the path + "~joe/Public/doc". + + Finally, if the URL points to a directory, there is always a + "Default Document" that Apache will use. This field holds the + name (not the path) of this document. By default, Apache uses + the file "index.html". However, some sites may be more used to + using the file "welcome.html". + +There are a number of other options that can be configured with +Apache, such as path aliases, masquerading as multiple hosts, server +child process parameters, and so forth. For more information on these, +consult the Apache man pages at http://www.apache.org. diff --git a/release/sysinstall/help/upgrade.hlp b/release/sysinstall/help/upgrade.hlp new file mode 100644 index 000000000000..c58c494c759b --- /dev/null +++ b/release/sysinstall/help/upgrade.hlp @@ -0,0 +1,38 @@ +Welcome to the 2.1 (or 2.0.5) -> 2.1.5 upgrade procedure! + +It must first be said that this upgrade DOES NOT take a particularly +sophisticated approach to the upgrade problem, it being more a question +of providing what seemed "good enough" at the time. A truly polished +upgrade that deals properly with the broad spectrum of installed 2.0.5 / 2.1 +systems would be nice to have, but until that gets written what you get is +this - the brute-force approach! + +What this upgrade will attempt to do is best summarized thusly: + + 1. fsck and mount all file systems chosen in the label editor. + 2. Ask for a location to preserve your /etc directory into and do so. + 3. Extract all selected distributions on top of your existing system. + 4. Copy certain obvious files back from the preserved /etc, leaving the + rest of the /etc file merge up to the user. + 5. Drop user in a shell so that they may perform that merge before + rebooting into the new system. + +And that's it! This "upgrade" is not going to hold your hand in all +major respects, it's simply provided to make one PART of the upgrade +easier. + +IMPORTANT NOTE: What this upgrade procedure may also do, in fact, is +completely destroy your system (though much more quickly than you +would have been able to destroy it yourself). It is simply impossible +to guarantee that this procedure's crude form of upgrade automation +will work in all cases and if you do this upgrade without proper +BACKUPS for any important data then you really must like living life +close to the edge, that's all we can say! + +NOTE to 2.0 users: We're sorry, but the "slice" changes that were +added in FreeBSD 2.0.5 made automated upgrades pretty difficult due to +the fact that a complete reinstall is pretty much called for. Things +may still *work* after a 2.1 upgrade, but you will also no doubt +receive many warnings at boot time about non-aligned slices and such; +we really do recommend a fresh installation for 2.0 systems! (But +back up your user data first :-). diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c new file mode 100644 index 000000000000..ee4d265d3cb1 --- /dev/null +++ b/release/sysinstall/index.c @@ -0,0 +1,582 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id: index.c,v 1.35 1996/06/14 14:33:53 jkh Exp $ + * + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include "sysinstall.h" + +/* Macros and magic values */ +#define MAX_MENU 12 +#define _MAX_DESC 60 + +static int index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended); + +/* Smarter strdup */ +inline char * +_strdup(char *ptr) +{ + return ptr ? strdup(ptr) : NULL; +} + +static char *descrs[] = { + "Package Selection", "To mark a package or select a category, move to it and press SPACE.\n" + "To unmark a package, press SPACE again. To go to a previous menu,\n" + "select the Cancel button. To search for a package by name, press ESC.\n" + "To finally extract packages, you should Cancel all the way out of any\n" + "submenus and then this top menu. NOTE: The All category selection\n" + "creates a very large submenu. If you select it, please be patient.", + "Package Targets", "These are the packages you've selected for extraction.\n\n" + "If you're sure of these choices, select OK.\n" + "If not, select Cancel to go back to the package selection menu.\n", + "All", "All available packages in all categories.", + "applications", "User application software.", + "archivers", "Utilities for archiving and unarchiving data.", + "audio", "Audio utilities - most require a supported sound card.", + "benchmarks", "Utilities for measuring system performance.", + "benchmarking", "Utilities for measuring system performance.", + "cad", "Computer Aided Design utilities.", + "comms", "Communications utilities.", + "databases", "Database software.", + "devel", "Software development utilities and libraries.", + "development", "Software development utilities and libraries.", + "documentation", "Document preparation utilities.", + "editors", "Common text editors.", + "emulation", "Utilities for emulating other OS types.", + "emulators", "Utilities for emulating other OS types.", + "games", "Various and sundry amusements.", + "graphics", "Graphics libraries and utilities.", + "japanese", "Ported software for the Japanese market.", + "lang", "Computer languages.", + "languages", "Computer languages.", + "libraries", "Software development libraries.", + "mail", "Electronic mail packages and utilities.", + "math", "Mathematical computation software.", + "misc", "Miscellaneous utilities.", + "net", "Networking utilities.", + "networking", "Networking utilities.", + "news", "USENET News support software.", + "numeric", "Mathematical computation software.", + "orphans", "Packages without a home elsewhere.", + "plan9", "Software from the plan9 Operating System.", + "print", "Utilities for dealing with printing.", + "printing", "Utilities for dealing with printing.", + "programming", "Software development utilities and libraries.", + "russian", "Ported software for the Russian market.", + "security", "System security software.", + "shells", "Various shells (tcsh, bash, etc).", + "sysutils", "Various system utilities.", + "www", "WEB utilities (browers, HTTP servers, etc).", + "troff", "TROFF Text formatting utilities.", + "utils", "Various user utilities.", + "utilities", "Various user utilities.", + "x11", "X Window System based utilities.", + NULL, NULL, +}; + +static char * +fetch_desc(char *name) +{ + int i; + + for (i = 0; descrs[i]; i += 2) { + if (!strcmp(descrs[i], name)) + return descrs[i + 1]; + } + return "No description provided"; +} + +static PkgNodePtr +new_pkg_node(char *name, node_type type) +{ + PkgNodePtr tmp = safe_malloc(sizeof(PkgNode)); + + tmp->name = _strdup(name); + tmp->type = type; + return tmp; +} + +static char * +strip(char *buf) +{ + int i; + + for (i = 0; buf[i]; i++) + if (buf[i] == '\t' || buf[i] == '\n') + buf[i] = ' '; + return buf; +} + +static IndexEntryPtr +new_index(char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *deps) +{ + IndexEntryPtr tmp = safe_malloc(sizeof(IndexEntry)); + + tmp->name = _strdup(name); + tmp->path = _strdup(pathto); + tmp->prefix = _strdup(prefix); + tmp->comment = _strdup(comment); + tmp->descrfile = strip(_strdup(descr)); + tmp->maintainer = _strdup(maint); + tmp->deps = _strdup(deps); + return tmp; +} + +static void +index_register(PkgNodePtr top, char *where, IndexEntryPtr ptr) +{ + PkgNodePtr p, q; + + for (q = NULL, p = top->kids; p; p = p->next) { + if (!strcmp(p->name, where)) { + q = p; + break; + } + } + if (!p) { + /* Add new category */ + q = new_pkg_node(where, PLACE); + q->desc = fetch_desc(where); + q->next = top->kids; + top->kids = q; + } + p = new_pkg_node(ptr->name, PACKAGE); + p->desc = ptr->comment; + p->data = ptr; + p->next = q->kids; + q->kids = p; +} + +static int +copy_to_sep(char *to, char *from, int sep) +{ + char *tok; + + tok = strchr(from, sep); + if (!tok) { + *to = '\0'; + return 0; + } + *tok = '\0'; + strcpy(to, from); + return tok + 1 - from; +} + +static int +readline(int fd, char *buf, int max) +{ + int rv, i = 0; + char ch; + + while ((rv = read(fd, &ch, 1)) == 1 && ch != '\n' && i < max) + buf[i++] = ch; + if (i < max) + buf[i] = '\0'; + return rv; +} + +int +index_parse(int fd, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *cats, char *deps) +{ + char line[1024]; + char *cp; + int i; + + i = readline(fd, line, 1024); + if (i <= 0) + return EOF; + cp = line; + cp += copy_to_sep(name, cp, '|'); + cp += copy_to_sep(pathto, cp, '|'); + cp += copy_to_sep(prefix, cp, '|'); + cp += copy_to_sep(comment, cp, '|'); + cp += copy_to_sep(descr, cp, '|'); + cp += copy_to_sep(maint, cp, '|'); + cp += copy_to_sep(cats, cp, '|'); + (void)copy_to_sep(deps, cp, '|'); + /* We're not actually interested in any of the other fields */ + return 0; +} + +int +index_get(char *fname, PkgNodePtr papa) +{ + int i, fd; + + fd = open(fname, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Unable to open index file `%s' for reading.\n", fname); + i = -1; + } + else + i = index_read(fd, papa); + close(fd); + return i; +} + +int +index_read(int fd, PkgNodePtr papa) +{ + char name[127], pathto[255], prefix[255], comment[255], descr[127], maint[127], cats[511], deps[511]; + + while (index_parse(fd, name, pathto, prefix, comment, descr, maint, cats, deps) != EOF) { + char *cp, *cp2, tmp[511]; + IndexEntryPtr idx; + + idx = new_index(name, pathto, prefix, comment, descr, maint, deps); + /* For now, we only add things to menus if they're in categories. Keywords are ignored */ + for (cp = strcpy(tmp, cats); (cp2 = strchr(cp, ' ')) != NULL; cp = cp2 + 1) { + *cp2 = '\0'; + index_register(papa, cp, idx); + } + index_register(papa, cp, idx); + + /* Add to special "All" category */ + index_register(papa, "All", idx); + } + return 0; +} + +void +index_init(PkgNodePtr top, PkgNodePtr plist) +{ + if (top) { + top->next = top->kids = NULL; + top->name = "Package Selection"; + top->type = PLACE; + top->desc = fetch_desc(top->name); + top->data = NULL; + } + if (plist) { + plist->next = plist->kids = NULL; + plist->name = "Package Targets"; + plist->type = PLACE; + plist->desc = fetch_desc(plist->name); + plist->data = NULL; + } +} + +void +index_print(PkgNodePtr top, int level) +{ + int i; + + while (top) { + for (i = 0; i < level; i++) putchar('\t'); + printf("name [%s]: %s\n", top->type == PLACE ? "place" : "package", top->name); + for (i = 0; i < level; i++) putchar('\t'); + printf("desc: %s\n", top->desc); + if (top->kids) + index_print(top->kids, level + 1); + top = top->next; + } +} + +/* Swap one node for another */ +static void +swap_nodes(PkgNodePtr a, PkgNodePtr b) +{ + PkgNode tmp; + + tmp = *a; + *a = *b; + a->next = tmp.next; + tmp.next = b->next; + *b = tmp; +} + +/* Use a disgustingly simplistic bubble sort to put our lists in order */ +void +index_sort(PkgNodePtr top) +{ + PkgNodePtr p, q; + + /* Sort everything at the top level */ + for (p = top->kids; p; p = p->next) { + for (q = top->kids; q; q = q->next) { + if (q->next && strcmp(q->name, q->next->name) > 0) + swap_nodes(q, q->next); + } + } + + /* Now sub-sort everything n levels down */ + + for (p = top->kids; p; p = p->next) { + if (p->kids) + index_sort(p); + } +} + +/* Delete an entry out of the list it's in (only the plist, at present) */ +void +index_delete(PkgNodePtr n) +{ + if (n->next) { + PkgNodePtr p = n->next; + + *n = *(n->next); + safe_free(p); + } + else /* Kludgy end sentinal */ + n->name = NULL; +} + +/* + * Search for a given node by name, returning the category in if + * tp is non-NULL. + */ +PkgNodePtr +index_search(PkgNodePtr top, char *str, PkgNodePtr *tp) +{ + PkgNodePtr p, sp; + + for (p = top->kids; p && p->name; p = p->next) { + /* Subtract out the All category from searches */ + if (!strcmp(p->name, "All")) + continue; + + /* If tp == NULL, we're looking for an exact package match */ + if (!tp && !strncmp(p->name, str, strlen(str))) + return p; + + /* If tp, we're looking for both a package and a pointer to the place it's in */ + if (tp && !strncmp(p->name, str, strlen(str))) { + *tp = top; + return p; + } + + /* The usual recursion-out-of-laziness ploy */ + if (p->kids) + if ((sp = index_search(p, str, tp)) != NULL) + return sp; + } + if (p && !p->name) + p = NULL; + return p; +} + +int +pkg_checked(dialogMenuItem *self) +{ + PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux; + int i; + + i = index_search(plist, kp->name, NULL) ? TRUE : FALSE; + if (kp->type == PACKAGE && plist) + return i || package_exists(kp->name); + else + return FALSE; +} + +int +pkg_fire(dialogMenuItem *self) +{ + int ret; + PkgNodePtr sp, kp = self->data, plist = (PkgNodePtr)self->aux; + + if (!plist) + ret = DITEM_FAILURE; + else if (kp->type == PACKAGE) { + sp = index_search(plist, kp->name, NULL); + /* Not already selected? */ + if (!sp) { + if (!package_exists(kp->name)) { + PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode)); + + *np = *kp; + np->next = plist->kids; + plist->kids = np; + msgInfo("Added %s to selection list", kp->name); + } + } + else if (sp) { + msgInfo("Removed %s from selection list", kp->name); + index_delete(sp); + } + ret = DITEM_SUCCESS; + } + else { /* Not a package, must be a directory */ + int p, s; + + p = s = 0; + index_menu(kp, plist, &p, &s); + ret = DITEM_SUCCESS | DITEM_CONTINUE; + } + return ret; +} + +void +pkg_selected(dialogMenuItem *self, int is_selected) +{ + PkgNodePtr kp = self->data; + + if (!is_selected || kp->type != PACKAGE) + return; + msgInfo(kp->desc); +} + +int +index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) +{ + int n, rval, maxname; + int curr, max; + PkgNodePtr kp; + dialogMenuItem *nitems; + Boolean hasPackages; + WINDOW *w; + + hasPackages = FALSE; + nitems = NULL; + + w = savescr(); + n = maxname = 0; + /* Figure out if this menu is full of "leaves" or "branches" */ + for (kp = top->kids; kp && kp->name; kp = kp->next) { + int len; + + ++n; + if (kp->type == PACKAGE && plist) { + hasPackages = TRUE; + if ((len = strlen(kp->name)) > maxname) + maxname = len; + } + } + if (!n && plist) { + msgConfirm("The %s menu is empty.", top->name); + restorescr(w); + return DITEM_LEAVE_MENU; + } + + while (1) { + n = 0; + curr = max = 0; + kp = top->kids; + while (kp && kp->name) { + char buf[256]; + + /* Brutally adjust description to fit in menu */ + strcpy(buf, kp->desc); + if (strlen(buf) > (_MAX_DESC - maxname)) + buf[_MAX_DESC - maxname] = '\0'; + nitems = item_add(nitems, kp->name, buf, pkg_checked, pkg_fire, pkg_selected, kp, (int)plist, &curr, &max); + ++n; + kp = kp->next; + } + /* NULL delimiter so item_free() knows when to stop later */ + nitems = item_add(nitems, NULL, NULL, NULL, NULL, NULL, NULL, 0, &curr, &max); + +recycle: + dialog_clear(); + if (hasPackages) + rval = dialog_checklist(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, -n, nitems, NULL); + else /* It's a categories menu */ + rval = dialog_menu(top->name, top->desc, -1, -1, n > MAX_MENU ? MAX_MENU : n, -n, + nitems, NULL, pos, scroll); + if (rval == -1 && plist) { + static char *cp; + PkgNodePtr menu; + + /* Search */ + if ((cp = msgGetInput(cp, "Search by package name. Please enter search string:")) != NULL) { + PkgNodePtr p = index_search(top, cp, &menu); + + if (p) { + int pos, scroll; + + /* These need to be set to point at the found item, actually. Hmmm! */ + pos = scroll = 0; + index_menu(menu, plist, &pos, &scroll); + } + else + msgConfirm("Search string: %s yielded no hits.", cp); + } + goto recycle; + } + items_free(nitems, &curr, &max); + restorescr(w); + return rval ? DITEM_FAILURE : DITEM_SUCCESS; + } +} + +int +index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) +{ + PkgNodePtr tmp; + int status = DITEM_SUCCESS; + + for (tmp = plist->kids; tmp && tmp->name; tmp = tmp->next) + status = index_extract_one(dev, top, tmp, FALSE); + return status; +} + +static int +index_extract_one(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) +{ + int status = DITEM_SUCCESS; + PkgNodePtr tmp2; + IndexEntryPtr id = who->data; + + if (id && id->deps && strlen(id->deps)) { + char t[1024], *cp, *cp2; + + strcpy(t, id->deps); + cp = t; + while (cp && DITEM_STATUS(status) == DITEM_SUCCESS) { + if ((cp2 = index(cp, ' ')) != NULL) + *cp2 = '\0'; + if ((tmp2 = index_search(top, cp, NULL)) != NULL) { + status = index_extract_one(dev, top, tmp2, TRUE); + if (DITEM_STATUS(status) != DITEM_SUCCESS) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Loading of dependant package %s failed", cp); + else + msgConfirm("Loading of dependant package %s failed", cp); + } + if (cp2) + cp = cp2 + 1; + else + cp = NULL; + } + } + } + /* Done with the deps? Load the real m'coy */ + if (DITEM_STATUS(status) == DITEM_SUCCESS) + status = package_extract(dev, who->name, depended); + return status; +} diff --git a/release/sysinstall/installUpgrade.c b/release/sysinstall/installUpgrade.c new file mode 100644 index 000000000000..19a7dce43cbc --- /dev/null +++ b/release/sysinstall/installUpgrade.c @@ -0,0 +1,387 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id: installUpgrade.c,v 1.29 1996/07/08 08:54:28 jkh Exp $ + * + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "sysinstall.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct _hitList { + enum { JUST_COPY, CALL_HANDLER } action ; + char *name; + Boolean optional; + void (*handler)(struct _hitList *self); +} HitList; + +/* cop-out function for files we can't handle */ +static void +doByHand(HitList *h) +{ + msgConfirm("/etc/%s is one of those files that this upgrade procedure just isn't\n" + "smart enough to deal with right now. You'll need to merge the old and\n" + "new versions by hand when the option to do so manually is later\n" + "presented (in the meantime, you might want to write the name of\n" + "this file down! - the holographic shell on VTY4 is a good place for\n" + "this).", h->name); +} + +static void +yellSysconfig(HitList *h) +{ + msgConfirm("/etc/sysconfig is one of those files that this upgrade procedure just isn't\n" + "smart enough to deal with right now. Unfortunately, your system\n" + "will also come up with a very different \"personality\" than it had\n" + "before if you do not merge at LEAST the hostname and ifconfig lines\n" + "from the old one! This is very important, so please do this merge\n" + "even if you do no others before the system is allowed to reboot."); +} + +/* These are the only meaningful files I know about */ +static HitList etc_files [] = { + { JUST_COPY, "Xaccel.ini", TRUE, NULL }, + { JUST_COPY, "adduser.conf", TRUE, NULL }, + { JUST_COPY, "aliases", TRUE, NULL }, + { JUST_COPY, "aliases.db", TRUE, NULL }, + { JUST_COPY, "amd.map", TRUE, NULL }, + { JUST_COPY, "crontab", TRUE, NULL }, + { JUST_COPY, "csh.cshrc", TRUE, NULL }, + { JUST_COPY, "csh.login", TRUE, NULL }, + { JUST_COPY, "csh.logout", TRUE, NULL }, + { JUST_COPY, "daily", TRUE, NULL }, + { JUST_COPY, "disktab", TRUE, NULL }, + { JUST_COPY, "dm.conf", TRUE, NULL }, + { JUST_COPY, "exports", TRUE, NULL }, + { JUST_COPY, "fbtab", TRUE, NULL }, + { CALL_HANDLER, "fstab", FALSE, doByHand }, + { JUST_COPY, "ftpusers", TRUE, NULL }, + { JUST_COPY, "gnats", TRUE, NULL }, + { JUST_COPY, "group", FALSE, NULL }, + { JUST_COPY, "host.conf", TRUE, NULL }, + { JUST_COPY, "hosts", TRUE, NULL }, + { JUST_COPY, "hosts.equiv", TRUE, NULL }, + { JUST_COPY, "hosts.lpd", TRUE, NULL }, + { CALL_HANDLER, "inetd.conf", FALSE, doByHand }, + { CALL_HANDLER, "kerberosIV", TRUE, doByHand }, + { JUST_COPY, "localtime", TRUE, NULL }, + { JUST_COPY, "login.access", TRUE, NULL }, + { JUST_COPY, "mail.rc", TRUE, NULL }, + { JUST_COPY, "make.conf", TRUE, NULL }, + { JUST_COPY, "manpath.config", TRUE, NULL }, + { JUST_COPY, "master.passwd", TRUE, NULL }, + { JUST_COPY, "mib.txt", TRUE, NULL }, + { JUST_COPY, "modems", TRUE, NULL }, + { JUST_COPY, "monthly", TRUE, NULL }, + { JUST_COPY, "motd", TRUE, NULL }, + { JUST_COPY, "namedb", TRUE, NULL }, + { CALL_HANDLER, "netstart", FALSE, doByHand }, + { JUST_COPY, "networks", TRUE, NULL }, + { JUST_COPY, "passwd", FALSE, NULL }, + { JUST_COPY, "phones", TRUE, NULL }, + { JUST_COPY, "ppp", TRUE, NULL }, + { JUST_COPY, "printcap", TRUE, NULL }, + { JUST_COPY, "profile", TRUE, NULL }, + { JUST_COPY, "protocols", TRUE, NULL }, + { JUST_COPY, "pwd.db", TRUE, NULL }, + { CALL_HANDLER, "rc", FALSE, doByHand }, + { CALL_HANDLER, "rc.i386", TRUE, doByHand }, + { JUST_COPY, "rc.local", TRUE, NULL }, + { CALL_HANDLER, "rc.serial", TRUE, doByHand }, + { JUST_COPY, "remote", TRUE, NULL }, + { JUST_COPY, "resolv.conf", TRUE, NULL }, + { JUST_COPY, "rmt", TRUE, NULL }, + { JUST_COPY, "security", TRUE, NULL }, + { JUST_COPY, "sendmail.cf", TRUE, NULL }, + { CALL_HANDLER, "services", TRUE, doByHand }, + { JUST_COPY, "shells", TRUE, NULL }, + { JUST_COPY, "skeykeys", TRUE, NULL }, + { JUST_COPY, "spwd.db", TRUE, NULL }, + { JUST_COPY, "supfile", TRUE, NULL }, + { CALL_HANDLER, "sysconfig", FALSE, yellSysconfig }, + { JUST_COPY, "syslog.conf", TRUE, NULL }, + { JUST_COPY, "termcap", TRUE, NULL }, + { JUST_COPY, "ttys", TRUE, NULL }, + { JUST_COPY, "uucp", TRUE, NULL }, + { JUST_COPY, "weekly", TRUE, NULL }, + { 0 }, +}; + +void +traverseHitlist(HitList *h) +{ + while (h->name) { + if (!file_readable(h->name)) { + if (!h->optional) + msgConfirm("Unable to find an old /etc/%s file! That is decidedly non-standard and\n" + "your upgraded system may function a little strangely as a result."); + } + else { + if (h->action == JUST_COPY) { + /* Nuke the just-loaded copy thoroughly */ + vsystem("rm -rf /etc/%s", h->name); + + /* Copy the old one into its place */ + msgNotify("Resurrecting %s..", h->name); + /* Do this with tar so that symlinks and such are preserved */ + if (vsystem("tar cf - %s | tar xpf - -C /etc", h->name)) + msgConfirm("Unable to resurrect your old /etc/%s! Hmmmm.", h->name); + } + else /* call handler */ + h->handler(h); + } + ++h; + } +} + +int +installUpgrade(dialogMenuItem *self) +{ + char *saved_etc; + Boolean extractingBin = TRUE; + struct termios foo; + + variable_set2(SYSTEM_STATE, "upgrade"); + systemDisplayHelp("upgrade"); + + dialog_clear(); + if (msgYesNo("Given all that scary stuff you just read, are you sure you want to\n" + "risk it all and proceed with this upgrade?")) + return DITEM_FAILURE | DITEM_RESTORE; + + if (!Dists) { + msgConfirm("You haven't specified any distributions yet. The upgrade procedure will\n" + "only upgrade those portions of the system for which a distribution has\n" + "been selected. In the next screen, we'll go to the Distributions menu\n" + "to select those portions of 2.1 you wish to install on top of your 2.0.5\n" + "system."); + if (!dmenuOpenSimple(&MenuDistributions, FALSE)) + return DITEM_FAILURE | DITEM_RECREATE; + dialog_clear(); + } + + /* No bin selected? Not much of an upgrade.. */ + if (!(Dists & DIST_BIN)) { + if (msgYesNo("You didn't select the bin distribution as one of the distributons to load.\n" + "This one is pretty vital to a successful 2.1 upgrade. Are you SURE you don't\n" + "want to select the bin distribution? Chose _No_ to bring up the Distributions\n" + "menu.")) { + if (!dmenuOpenSimple(&MenuDistributions, FALSE)) + return DITEM_FAILURE | DITEM_RECREATE; + dialog_clear(); + } + } + + /* Still?! OK! They must know what they're doing.. */ + if (!(Dists & DIST_BIN)) + extractingBin = FALSE; + + if (!mediaDevice) { + msgConfirm("Now you must specify an installation medium for the upgrade."); + if (!dmenuOpenSimple(&MenuMedia, FALSE) || !mediaDevice) + return DITEM_FAILURE | DITEM_RECREATE; + } + + if (RunningAsInit) { + Device **devs; + int i, cnt; + char *cp; + + cp = variable_get(VAR_DISK); + devs = deviceFind(cp, DEVICE_TYPE_DISK); + cnt = deviceCount(devs); + if (!cnt) { + msgConfirm("No disks found! Please verify that your disk controller is being\n" + "properly probed at boot time. See the Hardware Guide on the\n" + "Documentation menu for clues on diagnosing this type of problem."); + return DITEM_FAILURE; + } + else { + /* Enable all the drives befor we start */ + for (i = 0; i < cnt; i++) + devs[i]->enabled = TRUE; + } + + msgConfirm("OK. First, we're going to go to the disk label editor. In this editor\n" + "you will be expected to *Mount* any partitions you're interested in\n" + "upgrading. DO NOT set the Newfs flag to Y on anything in the label editor\n" + "unless you're absolutely sure you know what you're doing! In this\n" + "instance, you'll be using the label editor as little more than a fancy\n" + "screen-oriented way of labeling existing partitions.\n\n" + "Once you're done in the label editor, press Q to return here for the next\n" + "step."); + + if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE) { + msgConfirm("The disk label editor failed to work properly! Upgrade operation\n" + "aborted."); + return DITEM_FAILURE | DITEM_RECREATE; + } + + /* Don't write out MBR info */ + variable_set2(DISK_PARTITIONED, "written"); + if (DITEM_STATUS(diskLabelCommit(self)) == DITEM_FAILURE) { + msgConfirm("Not all file systems were properly mounted. Upgrade operation\n" + "aborted."); + variable_unset(DISK_PARTITIONED); + return DITEM_FAILURE | DITEM_RECREATE; + } + } + + if (!copySelf()) { + msgConfirm("Couldn't clone the boot floppy onto the root file system.\n" + "Aborting."); + return DITEM_FAILURE | DITEM_RECREATE; + } + + if (DITEM_STATUS(chroot("/mnt")) == DITEM_FAILURE) { + msgConfirm("Unable to chroot to /mnt - something is wrong with the\n" + "root partition or the way it's mounted if this doesn't work."); + variable_unset(DISK_PARTITIONED); + return DITEM_FAILURE | DITEM_RECREATE; + } + + chdir("/"); + systemCreateHoloshell(); + + saved_etc = NULL; + if (extractingBin) { + while (!saved_etc) { + saved_etc = msgGetInput("/usr/tmp/etc", "Under which directory do you wish to save your current /etc?"); + if (!saved_etc || !*saved_etc || Mkdir(saved_etc)) { + saved_etc = NULL; + if (msgYesNo("Directory was not specified, was invalid or user selected Cancel.\n\n" + "Doing an upgrade without first backing up your /etc directory is a very\n" + "bad idea! Do you want to go back and specify the save directory again?")) + break; + } + } + + if (saved_etc) { + msgNotify("Preserving /etc directory.."); + if (vsystem("tar -cf - -C /etc . | tar -xpf - -C %s", saved_etc)) + if (msgYesNo("Unable to backup your /etc into %s.\n" + "Do you want to continue anyway?")) + return DITEM_FAILURE | DITEM_RECREATE; + } + if (file_readable("/kernel")) { + msgNotify("Moving old kernel to /kernel.prev"); + if (system("chflags noschg /kernel && mv /kernel /kernel.prev")) { + if (!msgYesNo("Hmmm! I couldn't move the old kernel over! Do you want to\n" + "treat this as a big problem and abort the upgrade? Due to the\n" + "way that this upgrade process works, you will have to reboot\n" + "and start over from the beginning. Select Yes to reboot now")) + systemShutdown(1); + } + } + } + + msgNotify("Beginning extraction of distributions.."); + if (DITEM_STATUS(distExtractAll(self)) == DITEM_FAILURE) { + if (extractingBin && (Dists & DIST_BIN)) { + msgConfirm("Hmmmm. We couldn't even extract the bin distribution. This upgrade\n" + "should be considered a failure and started from the beginning, sorry!\n" + "The system will reboot now."); + dialog_clear(); + systemShutdown(1); + } + msgConfirm("The extraction process seems to have had some problems, but we got most\n" + "of the essentials. We'll treat this as a warning since it may have been\n" + "only non-essential distributions which failed to load."); + } + + if (extractingBin) { + msgNotify("OK, now it's time to go pound on your root a little bit to create all the\n" + "/dev entries and such that a 2.1 system expects to see. I'll also perform a\n" + "few \"fixup\" operations to repair the effects of splatting a bin distribution\n" + "on top of an existing system.."); + if (DITEM_STATUS(installFixup(self)) == DITEM_FAILURE) { + msgConfirm("Hmmmmm. The fixups don't seem to have been very happy.\n" + "You may wish to examine the system a little more closely when\n" + "it comes time to merge your /etc customizations back."); + } + } + + msgConfirm("First stage of upgrade completed successfully!\n\n" + "Next comes stage 2, where we attempt to resurrect your /etc\n" + "directory!"); + + if (saved_etc && chdir(saved_etc)) { + msgConfirm("Unable to go to your saved /etc directory in %s?! Argh!\n" + "Something went seriously wrong! It's quite possible that\n" + "your former /etc is toast. I hope you didn't have any\n" + "important customizations you wanted to keep in there.. :("); + } + else { + /* Now try to resurrect the /etc files */ + traverseHitlist(etc_files); + } + + msgConfirm("OK! At this stage, we've resurrected all the /etc files we could\n" + "(and you may have been warned about some that you'll have to merge\n" + "yourself by hand) and we're going to drop you into a shell to do\n" + "the rest yourself (sorry about this!). Once the system looks good\n" + "to you, exit the shell to reboot the system."); + + chdir("/"); + dialog_clear(); + dialog_update(); + end_dialog(); + DialogActive = FALSE; + endwin(); + + signal(SIGTTOU, SIG_IGN); + if (tcgetattr(0, &foo) != -1) { + foo.c_cc[VERASE] = '\010'; + if (tcsetattr(0, TCSANOW, &foo) == -1) + msgDebug("Unable to set the erase character.\n"); + } + else + msgDebug("Unable to get the terminal attributes!\n"); + printf("Well, good luck! When you're done, please type \"reboot\" or exit\n" + "the shell to reboot the new system.\n"); + if (!Fake) + system("/bin/sh"); + else + exit(0); + if (RunningAsInit) + reboot(0); + /* NOTREACHED */ + return 0; +} diff --git a/release/sysinstall/lndir.c b/release/sysinstall/lndir.c new file mode 100644 index 000000000000..5e037cad7b97 --- /dev/null +++ b/release/sysinstall/lndir.c @@ -0,0 +1,218 @@ +/* $XConsortium: lndir.c,v 1.14 95/01/09 20:08:20 kaleb Exp $ */ +/* $XFree86: xc/config/util/lndir.c,v 3.3 1995/01/28 15:41:09 dawes Exp $ */ +/* Create shadow link tree (after X11R4 script of the same name) + Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */ + +/* Hacked somewhat by Jordan Hubbard, The FreeBSD Project, to make it */ +/* an invokable function from sysinstall rather than a stand-alone binary */ + +/* +Copyright (c) 1990, X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* From the original /bin/sh script: + + Used to create a copy of the a directory tree that has links for all + non-directories (except those named RCS, SCCS or CVS.adm). If you are + building the distribution on more than one machine, you should use + this technique. + + If your master sources are located in /usr/local/src/X and you would like + your link tree to be in /usr/local/src/new-X, do the following: + + % mkdir /usr/local/src/new-X + % cd /usr/local/src/new-X + % lndir ../X +*/ + +#include +#include + +#include +#include +#include +#include +#include + +#include "sysinstall.h" + +#ifndef MAXPATHLEN +#define MAXPATHLEN 2048 +#endif + +static char *rcurdir; +static char *curdir; + +static int +equivalent(char *lname, char *rname) +{ + char *s; + + if (!strcmp(lname, rname)) + return 1; + for (s = lname; *s && (s = strchr(s, '/')); s++) { + while (s[1] == '/') + strcpy(s+1, s+2); + } + return !strcmp(lname, rname); +} + + +/* Recursively create symbolic links from the current directory to the "from" + directory. Assumes that files described by fs and ts are directories. */ + +static int +dodir(char *fn, struct stat *fs, struct stat *ts, int rel) +{ + DIR *df; + struct dirent *dp; + char buf[MAXPATHLEN + 1], *p; + char symbuf[MAXPATHLEN + 1]; + struct stat sb, sc; + int n_dirs; + int symlen; + char *ocurdir; + + if ((fs->st_dev == ts->st_dev) && (fs->st_ino == ts->st_ino)) + return 1; + + if (rel) + strcpy (buf, "../"); + else + buf[0] = '\0'; + strcat (buf, fn); + + if (!(df = opendir (buf))) { + msgDebug("%s: Cannot opendir\n", buf); + return 1; + } + + p = buf + strlen (buf); + *p++ = '/'; + n_dirs = fs->st_nlink; + while ((dp = readdir (df)) != NULL) { + if (dp->d_name[strlen(dp->d_name) - 1] == '~') + continue; + strcpy (p, dp->d_name); + + if (n_dirs > 0) { + if (stat (buf, &sb) < 0) { + msgDebug("Can't stat: %s\n", buf); + continue; + } + + if (S_ISDIR(sb.st_mode)) { + /* directory */ + n_dirs--; + if (dp->d_name[0] == '.' && + (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) + continue; + if (!strcmp (dp->d_name, "RCS")) + continue; + if (!strcmp (dp->d_name, "SCCS")) + continue; + if (!strcmp (dp->d_name, "CVS")) + continue; + if (!strcmp (dp->d_name, "CVS.adm")) + continue; + ocurdir = rcurdir; + rcurdir = buf; + curdir = isDebug() ? buf : (char *)0; + if (isDebug()) + msgDebug("%s:\n", buf); + if ((stat(dp->d_name, &sc) < 0) && (errno == ENOENT)) { + if (mkdir(dp->d_name, 0777) < 0 || + stat (dp->d_name, &sc) < 0) { + msgDebug("Unable to make or stat: %s\n", dp->d_name); + curdir = rcurdir = ocurdir; + continue; + } + } + if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) { + msgDebug("%s: is a link instead of a directory\n", dp->d_name); + curdir = rcurdir = ocurdir; + continue; + } + if (chdir (dp->d_name) < 0) { + msgDebug("Unable to chdir to: %s\n", dp->d_name); + curdir = rcurdir = ocurdir; + continue; + } + (void)dodir(buf, &sb, &sc, (buf[0] != '/')); + if (chdir ("..") < 0) { + msgDebug("Unable to get back to ..\n"); + return DITEM_FAILURE; + } + curdir = rcurdir = ocurdir; + continue; + } + } + + /* non-directory */ + symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1); + if (symlen >= 0) { + symbuf[symlen] = '\0'; + if (!equivalent (symbuf, buf)) + msgDebug("%s: %s\n", dp->d_name, symbuf); + } else if (symlink (buf, dp->d_name) < 0) + msgDebug("Unable to create symlink: %s\n", dp->d_name); + } + + closedir (df); + return 0; +} + +int +lndir(char *from, char *to) +{ + struct stat fs, ts; + + if (!to) + to = "."; + + /* to directory */ + if (stat(to, &ts) < 0) { + msgDebug("Destination directory doesn't exist: %s\n", to); + return DITEM_FAILURE; + } + if (!(S_ISDIR(ts.st_mode))) { + msgDebug ("%s: Not a directory\n", to); + return DITEM_FAILURE; + } + if (chdir(to) < 0) { + msgDebug("Unable to chdir to %s\n", to); + return DITEM_FAILURE; + } + /* from directory */ + if (stat(from, &fs) < 0) { + msgDebug("From directory doesn't exist: %s\n", from); + return DITEM_FAILURE; + } + if (!(S_ISDIR(fs.st_mode))) { + msgDebug ("%s: Not a directory\n", from); + return DITEM_FAILURE; + } + return dodir(from, &fs, &ts, 0); +} diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c new file mode 100644 index 000000000000..dd8d87951fff --- /dev/null +++ b/release/sysinstall/options.c @@ -0,0 +1,285 @@ +/* + * The new sysinstall program. + * + * This is probably the last attempt in the `sysinstall' line, the next + * generation being slated for what's essentially a complete rewrite. + * + * $Id: options.c,v 1.40 1996/07/08 10:08:18 jkh Exp $ + * + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "sysinstall.h" +#include + +static char * +varCheck(Option opt) +{ + char *cp = NULL; + + if (opt.aux) + cp = variable_get((char *)opt.aux); + if (!cp) + return "NO"; + return cp; +} + +/* Show our little logo */ +static char * +resetLogo(char *str) +{ + return "[RESET!]"; +} + +static char * +mediaCheck(Option opt) +{ + if (mediaDevice) { + switch(mediaDevice->type) { + case DEVICE_TYPE_UFS: + case DEVICE_TYPE_DISK: + return "File system"; + + case DEVICE_TYPE_FLOPPY: + return "Floppy"; + + case DEVICE_TYPE_FTP: + return "FTP"; + + case DEVICE_TYPE_CDROM: + return "CDROM"; + + case DEVICE_TYPE_TAPE: + return "Tape"; + + case DEVICE_TYPE_DOS: + return "DOS"; + + case DEVICE_TYPE_NFS: + return "NFS"; + + case DEVICE_TYPE_NONE: + case DEVICE_TYPE_NETWORK: + case DEVICE_TYPE_ANY: + default: + return ""; + } + } + return ""; +} + +#define TAPE_PROMPT "Please enter the tape block size in 512 byte blocks:" +#define RELNAME_PROMPT "Please specify the release you wish to load:" +#define BPKG_PROMPT "Please specify the name of the HTML browser package:" +#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:" +#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:" +#define PKG_PROMPT "Please specify a temporary directory with lots of free space:" +#define INSTROOT_PROMPT "Please specify a root directory if installing somewhere other than /" + +static Option Options[] = { +{ "NFS Secure", "NFS server talks only on a secure port", + OPT_IS_VAR, NULL, VAR_NFS_SECURE, varCheck }, +{ "NFS Slow", "User is using a slow PC or ethernet card", + OPT_IS_VAR, NULL, VAR_SLOW_ETHER, varCheck }, +{ "Debugging", "Emit extra debugging output on VTY2 (ALT-F2)", + OPT_IS_VAR, NULL, VAR_DEBUG, varCheck }, +{ "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs", + OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck }, +{ "FTP username", "Username and password to use instead of anonymous", + OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck }, +{ "Editor", "Which text editor to use during installation", + OPT_IS_VAR, EDITOR_PROMPT, VAR_EDITOR, varCheck }, +{ "Tape Blocksize", "Tape media block size in 512 byte blocks", + OPT_IS_VAR, TAPE_PROMPT, VAR_TAPE_BLOCKSIZE, varCheck }, +{ "Extract Detail", "How verbosely to display file name information during extractions", + OPT_IS_FUNC, mediaSetCPIOVerbosity, VAR_CPIO_VERBOSITY, varCheck }, +{ "Release Name", "Which release to attempt to load from installation media", + OPT_IS_VAR, RELNAME_PROMPT, VAR_RELNAME, varCheck }, +{ "Install Root", "Which directory to unpack distributions or packages relative to", + OPT_IS_VAR, INSTROOT_PROMPT, VAR_INSTALL_ROOT, varCheck }, +{ "Browser Pkg", "This is the browser package that will be used for viewing HTML docs", + OPT_IS_VAR, BPKG_PROMPT, VAR_BROWSER_PACKAGE, varCheck }, +{ "Browser Exec", "This is the path to the main binary of the browser package", + OPT_IS_VAR, BBIN_PROMPT, VAR_BROWSER_BINARY, varCheck }, +{ "Media Type", "The current installation media type.", + OPT_IS_FUNC, mediaGetType, VAR_MEDIA_TYPE, mediaCheck }, +{ "Package Temp", "The directory where package temporary files should go", + OPT_IS_VAR, PKG_PROMPT, VAR_PKG_TMPDIR, varCheck }, +{ "Use Defaults", "Reset all values to startup defaults", + OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, +{ NULL }, +}; + +#define OPT_START_ROW 4 +#define OPT_END_ROW 19 +#define OPT_NAME_COL 0 +#define OPT_VALUE_COL 16 +#define GROUP_OFFSET 40 + +static char * +value_of(Option opt) +{ + static char ival[40]; + + switch (opt.type) { + case OPT_IS_STRING: + return (char *)opt.data; + + case OPT_IS_INT: + sprintf(ival, "%d", (int)opt.data); + return ival; + + case OPT_IS_FUNC: + case OPT_IS_VAR: + if (opt.check) + return opt.check(opt); + else + return "<*>"; + } + return ""; +} + +static void +fire(Option opt) +{ + if (opt.type == OPT_IS_FUNC) { + int (*cp)(char *) = opt.data; + + cp(NULL); + } + else if (opt.type == OPT_IS_VAR) { + if (opt.data) { + (void)variable_get_value(opt.aux, opt.data); + } + else if (variable_get(opt.aux)) + variable_unset(opt.aux); + else + variable_set2(opt.aux, "YES"); + } + if (opt.check) + opt.check(opt); + clear(); + refresh(); +} + +int +optionsEditor(dialogMenuItem *self) +{ + int i, optcol, optrow, key; + static int currOpt = 0; + + dialog_clear(); + clear(); + + while (1) { + /* Whap up the header */ + attrset(A_REVERSE); mvaddstr(0, 0, "Options Editor"); attrset(A_NORMAL); + for (i = 0; i < 2; i++) { + mvaddstr(OPT_START_ROW - 2, OPT_NAME_COL + (i * GROUP_OFFSET), "Name"); + mvaddstr(OPT_START_ROW - 1, OPT_NAME_COL + (i * GROUP_OFFSET), "----"); + + mvaddstr(OPT_START_ROW - 2, OPT_VALUE_COL + (i * GROUP_OFFSET), "Value"); + mvaddstr(OPT_START_ROW - 1, OPT_VALUE_COL + (i * GROUP_OFFSET), "-----"); + } + /* And the footer */ + mvprintw(OPT_END_ROW + 1, 0, "Use SPACE to select/toggle an option, arrow keys to move,"); + mvprintw(OPT_END_ROW + 2, 0, "? or F1 for more help. When you're done, type Q to Quit."); + + optrow = OPT_START_ROW; + optcol = OPT_NAME_COL; + for (i = 0; Options[i].name; i++) { + /* Names are painted somewhat gratuitously each time, but it's easier this way */ + mvprintw(optrow, OPT_NAME_COL + optcol, Options[i].name); + if (currOpt == i) + attrset(ATTR_SELECTED); + mvprintw(optrow++, OPT_VALUE_COL + optcol, value_of(Options[i])); + if (currOpt == i) + attrset(A_NORMAL); + if (optrow == OPT_END_ROW) { + optrow = OPT_START_ROW; + optcol += GROUP_OFFSET; + } + clrtoeol(); + } + attrset(ATTR_TITLE); + mvaddstr(OPT_END_ROW + 4, 0, Options[currOpt].desc); + attrset(A_NORMAL); + clrtoeol(); + move(0, 14); + refresh(); + + /* Start the edit loop */ + key = toupper(getch()); + switch (key) { + case KEY_F(1): + case '?': + systemDisplayHelp("options"); + break; + + case KEY_UP: + if (currOpt) + --currOpt; + else + for (currOpt = 0; Options[currOpt + 1].name; currOpt++); + continue; + + case KEY_DOWN: + if (Options[currOpt + 1].name) + ++currOpt; + else + currOpt = 0; + continue; + + case KEY_HOME: + currOpt = 0; + continue; + + case KEY_END: + while (Options[currOpt + 1].name) + ++currOpt; + continue; + + case ' ': + clear(); + fire(Options[currOpt]); + clear(); + continue; + + case 'Q': + clear(); + dialog_clear(); + return DITEM_SUCCESS | DITEM_RESTORE; + + default: + beep(); + } + } + /* NOTREACHED */ + return DITEM_SUCCESS | DITEM_RESTORE; +} + diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c new file mode 100644 index 000000000000..9357cc15ce2d --- /dev/null +++ b/release/sysinstall/package.c @@ -0,0 +1,201 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id: package.c,v 1.42 1996/07/09 14:28:20 jkh Exp $ + * + * Copyright (c) 1995 + * Jordan Hubbard. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this + * point in the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "sysinstall.h" + +/* Like package_extract, but assumes current media device */ +int +package_add(char *name) +{ + if (!mediaVerify()) + return DITEM_FAILURE; + return package_extract(mediaDevice, name, FALSE); +} + +Boolean +package_exists(char *name) +{ + char fname[FILENAME_MAX]; + int status /* = vsystem("pkg_info -e %s", name) */; + + /* XXX KLUDGE ALERT! This makes evil assumptions about how XXX + * packages register themselves and should *really be done with + * `pkg_info -e ' except that this it's too slow for an + * item check routine.. :-( + */ + snprintf(fname, FILENAME_MAX, "/var/db/pkg/%s", name); + status = access(fname, R_OK); + msgDebug("package check for %s returns %s.\n", name, + status ? "failure" : "success"); + return !status; +} + +/* SIGPIPE handler */ +static Boolean sigpipe_caught = FALSE; + +static void +catch_pipe(int sig) +{ + sigpipe_caught = TRUE; +} + +/* Extract a package based on a namespec and a media device */ +int +package_extract(Device *dev, char *name, Boolean depended) +{ + char path[511]; + int fd, ret; + + /* If necessary, initialize the ldconfig hints */ + if (!file_readable("/var/run/ld.so.hints")) + vsystem("ldconfig /usr/lib /usr/local/lib /usr/X11R6/lib"); + + /* Check to make sure it's not already there */ + if (package_exists(name)) + return DITEM_SUCCESS; + + if (!dev->init(dev)) { + msgConfirm("Unable to initialize media type for package extract."); + return DITEM_FAILURE; + } + + /* Be initially optimistic */ + ret = DITEM_SUCCESS | DITEM_RESTORE; + /* Make a couple of paranoid locations for temp files to live if user specified none */ + if (!variable_get("PKG_TMPDIR")) { + Mkdir("/usr/tmp"); + Mkdir("/var/tmp"); + /* Set it to a location with as much space as possible */ + variable_set2("PKG_TMPDIR", "/usr/tmp"); + } + + if (!index(name, '/')) + sprintf(path, "packages/All/%s%s", name, strstr(name, ".tgz") ? "" : ".tgz"); + else + sprintf(path, "%s%s", name, strstr(name, ".tgz") ? "" : ".tgz"); + fd = dev->get(dev, path, TRUE); + if (fd >= 0) { + int i, tot, pfd[2]; + pid_t pid; + + msgNotify("Adding %s%s\nfrom %s", path, depended ? " (as a dependency)" : "", dev->name); + signal(SIGPIPE, catch_pipe); + pipe(pfd); + pid = fork(); + if (!pid) { + dup2(pfd[0], 0); close(pfd[0]); + dup2(DebugFD, 1); + close(2); + close(pfd[1]); + chroot(variable_get(VAR_INSTALL_ROOT)); + i = execl("/usr/sbin/pkg_add", "/usr/sbin/pkg_add", "-", 0); + if (isDebug()) + msgDebug("pkg_add returns %d status\n", i); + } + else { + char buf[BUFSIZ]; + WINDOW *w = savescr(); + struct timeval start, stop; + + close(pfd[0]); + tot = 0; + (void)gettimeofday(&start, (struct timezone *)0); + + while (!sigpipe_caught && (i = read(fd, buf, BUFSIZ)) > 0) { + int seconds; + + tot += i; + /* Print statistics about how we're doing */ + (void) gettimeofday(&stop, (struct timezone *)0); + stop.tv_sec = stop.tv_sec - start.tv_sec; + stop.tv_usec = stop.tv_usec - start.tv_usec; + if (stop.tv_usec < 0) + stop.tv_sec--, stop.tv_usec += 1000000; + seconds = stop.tv_sec + (stop.tv_usec / 1000000.0); + if (!seconds) + seconds = 1; + msgInfo("%10d bytes read from package %s @ %4.1f KBytes/second", tot, name, (tot / seconds) / 1024.0); + /* Write it out */ + if (write(pfd[1], buf, i) != i) { + msgInfo("Write failure to pkg_add! Package may be corrupt."); + break; + } + } + close(pfd[1]); + dev->close(dev, fd); + if (sigpipe_caught) + msgDebug("Caught SIGPIPE while trying to install the %s package.\n", name); + else + msgInfo("Package %s read successfully - waiting for pkg_add", name); + refresh(); + i = waitpid(pid, &tot, 0); + if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) { + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Add of package %s aborted due to some error -\n" + "Please check the debug screen for more info.", name); + else + msgConfirm("Add of package %s aborted due to some error -\n" + "Please check the debug screen for more info.", name); + } + else + msgNotify("Package %s was added successfully", name); + sleep(1); + restorescr(w); + sigpipe_caught = FALSE; + } + } + else { + msgDebug("pkg_extract: get operation returned %d\n", fd); + dialog_clear(); + if (variable_get(VAR_NO_CONFIRM)) + msgNotify("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); + else { + msgConfirm("Unable to fetch package %s from selected media.\n" + "No package add will be done.", name); + } + ret = DITEM_FAILURE | DITEM_RESTORE; + } + return ret; +} diff --git a/release/sysinstall/version.h b/release/sysinstall/version.h new file mode 100644 index 000000000000..b42c26e8937d --- /dev/null +++ b/release/sysinstall/version.h @@ -0,0 +1 @@ +#define RELEASE_NAME "__RELEASE" diff --git a/share/man/man4/man4.i386/aic.4 b/share/man/man4/man4.i386/aic.4 new file mode 100644 index 000000000000..84bf10853c8a --- /dev/null +++ b/share/man/man4/man4.i386/aic.4 @@ -0,0 +1,47 @@ +.\" +.\" Copyright (c) 1994 James A. Jegers +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd November 29, 1994 +.Dt AIC 4 i386 +.Os +.Sh NAME +.Nm aic +.Nd Adaptec AIC-6260 and AIC-6360 SCSI driver +.Sh SYNOPSIS +.Cd "device aic0 at isa? port 0x340 bio irq 11" +.Sh DESCRIPTION +The +.Nm aic +driver provides support for the Adaptec AIC-6260 and AIC-6360 SCSI +controller chips. This includes the Adaptec 152x and the Creative +Labs SoundBlaster SCSI host adapter. +.Pp +Many systems that use these controller chips do not have a boot ROM +and therefore cannot be booted from. +.Sh SEE ALSO +.Xr intro 4 , +.Xr sd 4 , +.Xr st 4 , +.Xr cd 4 , +.Xr ch 4 diff --git a/share/man/man4/man4.i386/eg.4 b/share/man/man4/man4.i386/eg.4 new file mode 100644 index 000000000000..10f84552df47 --- /dev/null +++ b/share/man/man4/man4.i386/eg.4 @@ -0,0 +1,44 @@ +.\" +.\" Copyright (c) 1994 James A. Jegers +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 10, 1995 +.Dt EG 4 i386 +.Os +.Sh NAME +.Nm eg +.Nd Ethernet driver for 3Com 3c505 Ethernet boards +.Sh SYNOPSIS +.Cd "device eg0 at isa? port 0x310 net irq 5 vector egintr" +.Sh DESCRIPTION +The +.Nm +interface provides access to a 10 Mb/s Ethernet network via the +3Com 3c505 Ethernet board. +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr intro 4 , +.Xr ed 4 , +.Xr el 4 , +.Xr ep 4 , +.Xr ie 4 , +.Xr le 4 diff --git a/share/man/man4/man4.i386/el.4 b/share/man/man4/man4.i386/el.4 new file mode 100644 index 000000000000..2e447337b819 --- /dev/null +++ b/share/man/man4/man4.i386/el.4 @@ -0,0 +1,44 @@ +.\" +.\" Copyright (c) 1994 James A. Jegers +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 10, 1995 +.Dt EL 4 i386 +.Os +.Sh NAME +.Nm el +.Nd Ethernet driver for 3Com Etherlink 3C501 device driver +.Sh SYNOPSIS +.Cd "device el0 at isa? port 0x300 net irq 9 vector elintr" +.Sh DESCRIPTION +The +.Nm +interface provides access to a 10 Mb/s Ethernet network via the +3Com 3c501 Ethernet cards. +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr intro 4 , +.Xr ed 4 , +.Xr eg 4 , +.Xr ep 4 , +.Xr ie 4 , +.Xr le 4 diff --git a/share/man/man4/man4.i386/ep.4 b/share/man/man4/man4.i386/ep.4 new file mode 100644 index 000000000000..51b6a80666cd --- /dev/null +++ b/share/man/man4/man4.i386/ep.4 @@ -0,0 +1,123 @@ +.\" +.\" Copyright (c) 1994 Herb Peyerl +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Herb Peyerl +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $Id: ep.4,v 1.1 1996/07/11 00:22:46 mpp Exp $ +.\" +.Dd February 04, 1993 +.Dt EP 4 +.Os +.Sh NAME +.Nm ep +.Nd Ethernet driver for 3Com Etherlink III (3c5x9) +.Sh SYNOPSIS +.Cd "device ep0 at isa? port 0x300 net irq 10 vector epintr" +.Sh DESCRIPTION +The +.Nm ep +device driver supports the 3c509 (ISA) and 3c579 (EISA) cards. +Various models of these cards come with a different assortment of +connectors: +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It AUI/DIX +Standard 15 pin connector +.It 10Base2 +BNC, also known as thin-net +.It 10BaseT +UTP, also known as twisted pair +.El +.Pp +The default port to use is the BNC. To choose an alternate port, +use the following flag combinations with +.Xr ifconfig 8 +or in your /etc/hostname.ep? file. +.Pp +.Bl -tag -width xxxxxxxxxxxxxxxxxxxx +.It -link0 +Use the BNC port (default). +.It \ link0 -link1 +Use the AUI port. +.It \ link0 \ link1 +Use the UTP port. +.El +.Pp +If there are multiple cards in the computer, they are searched for +in the following order: +The 3c579 EISA cards are searched for first -- they will be found +in EISA slot# order. +Next, the 3c509 ISA cards are searched -- they are found in increasing +ethernet address order. +This is an example of how they will probe: +.Pp +ep0 at isa0 port 0x6000-0x600f irq 10: aui/bnc address 00:60:8c:70:e5:c5 +ep1 at isa0 port 0x300-0x30f irq 3: aui/bnc/utp address 00:20:af:10:62:ab +.Pp +You may specify the port and irq numbers that the cards are expected +to be found at, but it is not necessary. +The cards are sufficiently intelligent to tell us where they +actually live on the ISA bus. +.Pp +.Sh NOTES +The 3c509 card has no jumpers to set the address. +3Com supplies software to set the address of the card in software. +To find the card on the ISA bus, the kernel performs a complex +scan operation at IO address 0x100. +Beware! +Avoid placing other cards at that address! +.Pp +Some models of 3c5x9 have all three connectors on them. +In the case of these cards; you must configure the transceiver type +with the 3Com supplied DOS configuration disk before the link0/link1 +flags will operate correctly. +.Pp +.Sh DIAGNOSTICS +ep0: reset (status: %x) +.in +4 +the driver has encountered a FIFO underrun or overrun. The driver will reset +the card and the packet will be lost. This is not fatal. +.in -4 +ep0: eeprom failed to come ready +.in +4 +The eeprom failed to come ready. This probably means the card is wedged. +.in -4 +ep0: 3c509 in test mode. Erase pencil mark! +.in +4 +This means that someone has scribbled with pencil in the test area on the +card. Erase the pencil mark and reboot. (This is not a joke). +.in -4 +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr intro 4 , +.Xr ed 4 , +.Xr eg 4 , +.Xr el 4 , +.Xr ie 4 , +.Xr le 4 +.Sh STANDARDS +are great. There's so many to choose from. diff --git a/share/man/man4/man4.i386/ncr.4 b/share/man/man4/man4.i386/ncr.4 new file mode 100644 index 000000000000..dc3576da116a --- /dev/null +++ b/share/man/man4/man4.i386/ncr.4 @@ -0,0 +1,43 @@ +.\" +.\" Copyright (c) 1994 James A. Jegers +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd July 10, 1996 +.Dt NCR 4 i386 +.Os +.Sh NAME +.Nm ncr +.Nd NCR 53C810 SCSI driver +.Sh SYNOPSIS +.Cd "device ncr0" +.Sh DESCRIPTION +The +.Nm ncr +driver provides support for the NCR 53C810 and NCR 53C825 +SCSI controller chips. +.Sh SEE ALSO +.Xr intro 4 , +.Xr sd 4 , +.Xr st 4 , +.Xr cd 4 , +.Xr ch 4 diff --git a/share/man/man4/man4.i386/wt.4 b/share/man/man4/man4.i386/wt.4 new file mode 100644 index 000000000000..5ee71ce06af7 --- /dev/null +++ b/share/man/man4/man4.i386/wt.4 @@ -0,0 +1,44 @@ +.\" +.\" Copyright (c) 1994 James A. Jegers +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 10, 1995 +.Dt WT 4 i386 +.Os +.Sh NAME +.Nm wt +.Nd +Archive/Wangtek cartridge tape driver +.Sh SYNOPSIS +.Cd "device wt0 at isa? port 0x300 bio irq 5 drq 1 vector wtintr" +.Sh DESCRIPTION +The +.Nm wt +driver provides support for the following Archive and Wangtek boards: +.Pp +.Bl -tag -width -offset indent -compact +.It QIC-02 +.It QIC-36 +.El +.Pp +.Sh SEE ALSO +.Xr intro 4 diff --git a/sys/dev/aic7xxx/aicasm.c b/sys/dev/aic7xxx/aicasm.c deleted file mode 100644 index 24140373b13d..000000000000 --- a/sys/dev/aic7xxx/aicasm.c +++ /dev/null @@ -1,685 +0,0 @@ -/*+M************************************************************************* - * Adaptec AIC7770/AIC7870 sequencer code assembler. - * - * Copyright (c) 1994 John Aycock - * The University of Calgary Department of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of Calgary - * Department of Computer Science and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Comments are started by `#' and continue to the end of the line; lines - * may be of the form: - *