Annotation of sbbs/sbbs2/install/install.c, revision 1.1.1.1

1.1       root        1: /* install.c */
                      2: 
                      3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
                      4: 
                      5: /* Synchronet BBS Installation program */
                      6: 
                      7: unsigned int _stklen=0x8000;
                      8: 
                      9: #include <io.h>
                     10: #include <dir.h>
                     11: #include <fcntl.h>
                     12: #include <sys/stat.h>
                     13: #include <process.h>
                     14: #include <errno.h>
                     15: #include "uifc.h"
                     16: 
                     17: /* OS Specific */
                     18: #if defined(__FLAT__)  // 32-bit
                     19:        #define FAR16
                     20:        #define HUGE16
                     21:        #define lread(f,b,l) read(f,b,l)
                     22:        #define lfread(b,l,f) fread(b,l,f)
                     23:        #define lwrite(f,b,l) write(f,b,l)
                     24:        #define lfwrite(b,l,f) fwrite(b,l,f)
                     25: #else                                  // 16-bit
                     26:        #define FAR16 far
                     27:        #define HUGE16 huge
                     28: #endif
                     29: 
                     30: void bail(int code);
                     31: 
                     32: char **opt;
                     33: 
                     34: #define EXEC           (1<<1)
                     35: #define CFGS           (1<<2)
                     36: #define TEXT           (1<<3)
                     37: #define DOCS           (1<<4)
                     38: 
                     39: #define DISK1          (EXEC|CFGS|TEXT|DOCS)
                     40: 
                     41: #define UTIL           (1<<10)
                     42: #define XTRN           (1<<11)
                     43: #define XSDK           (1<<12)
                     44: 
                     45: #define DISK2          (UTIL|XTRN|XSDK)
                     46: 
                     47: #define UPGRADE        (1<<13)
                     48: 
                     49: #define LOOP_NOPEN 100
                     50: 
                     51: int mode=(DISK1|DISK2);
                     52: 
                     53: enum {                         /* Upgrade FROM version */
                     54:         NONE
                     55:        ,SBBS20
                     56:        ,SBBS21
                     57:        ,SBBS22
                     58:        ,SBBS23
                     59:        };
                     60: 
                     61: char tmp[256];
                     62: char install_to[129],install_from[256];
                     63: 
                     64: /****************************************************************************/
                     65: /* Puts a backslash on path strings                                                                            */
                     66: /****************************************************************************/
                     67: void backslash(char *str)
                     68: {
                     69:     int i;
                     70: 
                     71: i=strlen(str);
                     72: if(i && str[i-1]!='\\') {
                     73:     str[i]='\\'; str[i+1]=0; }
                     74: }
                     75: 
                     76: 
                     77: /****************************************************************************/
                     78: /* If the directory 'path' doesn't exist, create it.                           */
                     79: /* returns 1 if successful, 0 otherwise                                                                        */
                     80: /****************************************************************************/
                     81: int md(char *path)
                     82: {
                     83:        char str[128];
                     84:        struct ffblk ff;
                     85: 
                     86: if(strlen(path)<2) {
                     87:        umsg("Invalid path");
                     88:        return(0); }
                     89: strcpy(str,path);
                     90: if(strcmp(str+1,":\\") && str[strlen(str)-1]=='\\')
                     91:        str[strlen(str)-1]=0;   /* Chop of \ if not root directory */
                     92: if(findfirst(str,&ff,FA_DIREC)) {
                     93:        if(mkdir(str)) {
                     94:                sprintf(str,"Unable to Create Directory '%s'",path);
                     95:                umsg(str);
                     96:                return(0); } }
                     97: return(1);
                     98: }
                     99: 
                    100: long fdate_dir(char *filespec)
                    101: {
                    102:     struct ffblk f;
                    103:     struct date fd;
                    104:     struct time ft;
                    105: 
                    106: if(findfirst(filespec,&f,FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC)==0) {
                    107:        fd.da_day=f.ff_fdate&0x1f;
                    108:        fd.da_mon=(f.ff_fdate>>5)&0xf;
                    109:        fd.da_year=1980+((f.ff_fdate>>9)&0x7f);
                    110:        ft.ti_hour=0;
                    111:        ft.ti_min=0;
                    112:        ft.ti_sec=0;
                    113:     return(dostounix(&fd,&ft)); }
                    114: else return(0);
                    115: }
                    116: 
                    117: /****************************************************************************/
                    118: /* Returns the length of the file in 'filespec'                             */
                    119: /****************************************************************************/
                    120: long flength(char *filespec)
                    121: {
                    122:        struct ffblk f;
                    123: 
                    124: if(findfirst(filespec,&f,0)==0)
                    125:        return(f.ff_fsize);
                    126: return(-1L);
                    127: }
                    128: 
                    129: /****************************************************************************/
                    130: /* Checks the disk drive for the existence of a file. Returns 1 if it       */
                    131: /* exists, 0 if it doesn't.                                                 */
                    132: /****************************************************************************/
                    133: char fexist(char *filespec)
                    134: {
                    135:     struct ffblk f;
                    136: 
                    137: if(findfirst(filespec,&f,FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC)==0)
                    138:     return(1);
                    139: return(0);
                    140: }
                    141: 
                    142: #ifndef __OS2__
                    143: /****************************************************************************/
                    144: /* This function reads files that are potentially larger than 32k.             */
                    145: /* Up to one megabyte of data can be read with each call.                   */
                    146: /****************************************************************************/
                    147: long lread(int file, char huge *buf,long bytes)
                    148: {
                    149:        long count;
                    150: 
                    151: for(count=bytes;count>32767;count-=32767,buf+=32767)
                    152:        if(read(file,(char *)buf,32767)!=32767)
                    153:                return(-1L);
                    154: if(read(file,(char *)buf,(int)count)!=count)
                    155:        return(-1L);
                    156: return(bytes);
                    157: }
                    158: 
                    159: /****************************************************************************/
                    160: /* This function writes files that are potentially larger than 32767 bytes  */
                    161: /* Up to one megabytes of data can be written with each call.                          */
                    162: /****************************************************************************/
                    163: long lwrite(int file, char huge *buf, long bytes)
                    164: {
                    165: 
                    166:        long count;
                    167: 
                    168: for(count=bytes;count>32767;count-=32767,buf+=32767)
                    169:        if(write(file,(char *)buf,32767)!=32767)
                    170:                return(-1L);
                    171: if(write(file,(char *)buf,(int)count)!=count)
                    172:        return(-1L);
                    173: return(bytes);
                    174: }
                    175: #endif
                    176: 
                    177: /****************************************************************************/
                    178: /* Network open function. Opens all files DENYALL and retries LOOP_NOPEN    */
                    179: /* number of times if the attempted file is already open or denying access     */
                    180: /* for some other reason.      All files are opened in BINARY mode.                    */
                    181: /****************************************************************************/
                    182: int nopen(char *str, int access)
                    183: {
                    184:        char logstr[256];
                    185:        int file,share,count=0;
                    186: 
                    187: if(access==O_RDONLY) share=O_DENYWRITE;
                    188:        else share=O_DENYALL;
                    189: while(((file=open(str,O_BINARY|share|access,S_IWRITE))==-1)
                    190:        && errno==EACCES && count++<LOOP_NOPEN);
                    191: if(file==-1 && errno==EACCES)
                    192:        cputs("\7\r\nNOPEN: ACCESS DENIED\r\n\7");
                    193: return(file);
                    194: }
                    195: 
                    196: int copy(char *src, char *dest)
                    197: {
                    198:        char c,HUGE16 *buf,str[256],str2[128],*scrnsave;
                    199:        int in,out;
                    200:        long length,chunk,l;
                    201:        struct ftime ftime;
                    202: 
                    203: if(!strcmp(src,dest))  /* copy from and to are same, so return */
                    204:        return(0);
                    205: 
                    206: if((scrnsave=MALLOC(scrn_len*80*2))==NULL)
                    207:        return(-1);
                    208: hidemouse();
                    209: gettext(1,1,80,scrn_len,scrnsave);
                    210: 
                    211: #define width 72
                    212: #define top 10
                    213: #define left 0
                    214: 
                    215: sprintf(str2,"Copying %s to %s...",src,dest);
                    216: sprintf(str," %-64.64s",str2); /* Make sure it's no more than 60 */
                    217: 
                    218: gotoxy(SCRN_LEFT+left,SCRN_TOP+top);
                    219: textattr(hclr|(bclr<<4));
                    220: putch('�');
                    221: for(c=1;c<width-1;c++)
                    222:        putch('�');
                    223: putch('�');
                    224: gotoxy(SCRN_LEFT+left,SCRN_TOP+top+1);
                    225: putch('�');
                    226: textattr(lclr|(bclr<<4));
                    227: cprintf("%-*.*s",width-2,width-2,str);
                    228: gotoxy(SCRN_LEFT+left+(width-1),SCRN_TOP+top+1);
                    229: textattr(hclr|(bclr<<4));
                    230: putch('�');
                    231: gotoxy(SCRN_LEFT+left,SCRN_TOP+top+2);
                    232: putch('�');
                    233: for(c=1;c<width-1;c++)
                    234:        putch('�');
                    235: putch('�');
                    236: gotoxy(SCRN_LEFT+left+(width-5),SCRN_TOP+top+1);
                    237: textattr(lclr|(bclr<<4));
                    238: 
                    239: if((in=nopen(src,O_RDONLY))==-1) {
                    240:        cprintf("\r\nERR_OPEN %s",src);
                    241:        getch();
                    242:        puttext(1,1,80,scrn_len,scrnsave);
                    243:        FREE(scrnsave);
                    244:        showmouse();
                    245:     return(-1); }
                    246: if((out=nopen(dest,O_WRONLY|O_CREAT|O_TRUNC))==-1) {
                    247:        close(in);
                    248:        sprintf(str,"ERROR OPENING %s",dest);
                    249:        umsg(str);
                    250:        puttext(1,1,80,scrn_len,scrnsave);
                    251:        FREE(scrnsave);
                    252:        showmouse();
                    253:        return(-1); }
                    254: length=filelength(in);
                    255: if(!length) {
                    256:        close(in);
                    257:        close(out);
                    258:        sprintf(str,"ZERO LENGTH %s",src);
                    259:        umsg(str);
                    260:        puttext(1,1,80,scrn_len,scrnsave);
                    261:        showmouse();
                    262:        FREE(scrnsave);
                    263:        return(-1); }
                    264: #if __OS2__
                    265: chunk=1000000;
                    266: #else
                    267: chunk=0x8000; /* use 32k chunks */
                    268: #endif
                    269: if(chunk>length)                       /* leave space for stack expansion */
                    270:        chunk=length;
                    271: if((buf=MALLOC(chunk))==NULL) {
                    272:        close(in);
                    273:        close(out);
                    274:        sprintf(str,"ERROR ALLOC %s %lu",src,chunk);
                    275:        umsg(str);
                    276:        puttext(1,1,80,scrn_len,scrnsave);
                    277:     FREE(scrnsave);
                    278:        showmouse();
                    279:     return(-1); }
                    280: l=0L;
                    281: while(l<length) {
                    282:        cprintf("%2lu%%",l ? (long)(100.0/((float)length/l)) : 0L);
                    283:        if(l+chunk>length)
                    284:                chunk=length-l;
                    285:        lread(in,buf,chunk);
                    286:        lwrite(out,buf,chunk);
                    287:        l+=chunk;
                    288:        cputs("\b\b\b");
                    289:        }
                    290: // cputs("   \b\b\b");  /* erase it */
                    291: FREE((char *)buf);
                    292: getftime(in,&ftime);
                    293: setftime(out,&ftime);
                    294: close(in);
                    295: close(out);
                    296: puttext(1,1,80,scrn_len,scrnsave);
                    297: FREE(scrnsave);
                    298: showmouse();
                    299: return(0);
                    300: }
                    301: 
                    302: int unarc(int timestamp, char *src, char *dir, char *arg)
                    303: {
                    304:        int i,atr;
                    305:        char str[128],cmd[128],*scrnsave;
                    306: 
                    307: if((scrnsave=MALLOC((scrn_len+1)*80*2))==NULL)
                    308:        return(-1);
                    309: hidemouse();
                    310: gettext(1,1,80,scrn_len+1,scrnsave);
                    311: //lclini(scrn_len+1);
                    312: textattr(LIGHTGRAY);
                    313: clrscr();
                    314: sprintf(cmd,"%sLHA.EXE",install_from);
                    315: sprintf(str,"/c%d",timestamp);
                    316: i=spawnlp(P_WAIT,cmd,cmd,"x",str,"/s","/m1",src,dir,arg,NULL);
                    317: if(i==-1) {
                    318:        printf("\r\nCannot execute %s.  Hit any key to continue.",cmd);
                    319:        getch(); }
                    320: else if(i) {
                    321:        printf("\r\n%s returned error level %d.  Hit any key to continue.",cmd,i);
                    322:        getch(); }
                    323: clrscr();
                    324: puttext(1,1,80,scrn_len+1,scrnsave);
                    325: showmouse();
                    326: FREE(scrnsave);
                    327: //lclini(scrn_len);
                    328: //textattr(atr);
                    329: return(i);
                    330: }
                    331: 
                    332: 
                    333: void main(int argc, char **argv)
                    334: {
                    335:        int i,j,k,ver;
                    336:        long l;
                    337:        char str[128],*p;
                    338:        char text_dir[64],docs_dir[64],exec_dir[64],ctrl_dir[64];
                    339:        struct text_info txt;
                    340:        struct ffblk ff;
                    341: 
                    342: timezone=0;
                    343: daylight=0;
                    344: uifcini();
                    345: if(argc>1) {   /* user specified install path */
                    346:        sprintf(install_to,"%.20s",argv[1]);
                    347:        strupr(install_to);
                    348:        if(strlen(install_to)==1) {
                    349:                if(!isalpha(install_to[0])) {
                    350:                        cprintf("\7\r\nInvalid install path - '%s'\r\n",install_to);
                    351:                        bail(1); }
                    352:                strcat(install_to,":"); }
                    353:        backslash(install_to);
                    354:        if(strlen(install_to)<4)        /* user says C, C:, or C:\, make C:\SBBS */
                    355:                strcat(install_to,"SBBS\\"); }
                    356: else
                    357:        strcpy(install_to,"C:\\SBBS\\");
                    358: 
                    359: strcpy(install_from,argv[0]);
                    360: strupr(install_from);
                    361: p=strrchr(install_from,'\\');
                    362: if(p)
                    363:        *(p+1)=0;
                    364: else {                         /* incase of A:INSTALL */
                    365:        p=strchr(install_from,':');
                    366:        if(p)
                    367:                *(p+1)=0; }
                    368: 
                    369: if((opt=(char **)MALLOC(sizeof(char *)*MAX_OPTS))==NULL) {
                    370:        cputs("memory allocation error\r\n");
                    371:        bail(1); }
                    372: for(i=0;i<MAX_OPTS;i++)
                    373:        if((opt[i]=(char *)MALLOC(MAX_OPLN))==NULL) {
                    374:                cputs("memory allocation error\r\n");
                    375:                bail(1); }
                    376: 
                    377: /***
                    378: if(findfirst("MENU.ZIP",&ff,0)) {
                    379:        cprintf("\7\r\nCan't find MENU.ZIP\r\n");
                    380:        bail(1); }
                    381: if(findfirst("TEXT.ZIP",&ff,0)) {
                    382:        cprintf("\7\r\nCan't find TEXT.ZIP\r\n");
                    383:        bail(1); }
                    384: if(findfirst("DOCS.ZIP",&ff,0)) {
                    385:        cprintf("\7\r\nCan't find DOCS.ZIP\r\n");
                    386:        bail(1); }
                    387: if(findfirst("EXEC.ZIP",&ff,0)) {
                    388:        cprintf("\7\r\nCan't find EXEC.ZIP\r\n");
                    389:        bail(1); }
                    390: if(findfirst("PKUNZIP.EXE",&ff,0)) {
                    391:        cprintf("\7\r\nCan't find PKUNZIP.EXE\r\n");
                    392:        bail(1); }
                    393: ***/
                    394: uscrn("Synchronet Installation Utility  Version 2.3");
                    395: 
                    396: i=0;
                    397: while(1) {
                    398: 
                    399:        helpbuf=
                    400: " Synchronet Installation \r\n\r\n"
                    401: "If you are installing Synchronet for evaluation or demonstration\r\n"
                    402: "purposes, be sure to set &Install Registration Key& to &No&.\r\n\r\n"
                    403: "If do not have the &Synchronet Utilities Disk& (Distribution Disk 2), be\r\n"
                    404: "sure to set &Install Distribution Disk 2& to &None&.\r\n\r\n"
                    405: "When you are happy with the installation settings and the destination\r\n"
                    406: "path, select &Start Installation& to continue or hit  ESC  to abort.";
                    407: 
                    408:        j=0;
                    409:        str[0]=0;
                    410:        if((mode&DISK1)==DISK1)
                    411:                strcpy(str,"All");
                    412:        else {
                    413:                if(!(mode&DISK1))
                    414:                        strcpy(str,"None");
                    415:                else {
                    416:                        strcat(str,"Selected: ");
                    417:                        if(mode&EXEC)
                    418:                                strcat(str,"EXEC ");
                    419:                        if(mode&CFGS)
                    420:                                strcat(str,"CFGS ");
                    421:                        if(mode&TEXT)
                    422:                                strcat(str,"TEXT ");
                    423:                        if(mode&DOCS)
                    424:                                strcat(str,"DOCS "); } }
                    425:        sprintf(opt[j++],"%-30.30s%s","Install Distribution Disk 1",str);
                    426:        str[0]=0;
                    427:        if((mode&DISK2)==DISK2)
                    428:                strcpy(str,"All");
                    429:        else {
                    430:                if(!(mode&DISK2))
                    431:                        strcpy(str,"None");
                    432:                else {
                    433:                        strcat(str,"Selected: ");
                    434:                        if(mode&UTIL)
                    435:                                strcat(str,"UTIL ");
                    436:                        if(mode&XTRN)
                    437:                                strcat(str,"XTRN ");
                    438:                        if(mode&XSDK)
                    439:                                strcat(str,"XSDK "); } }
                    440:        sprintf(opt[j++],"%-30.30s%s","Install Distribution Disk 2",str);
                    441:        sprintf(opt[j++],"%-30.30s%s","Source Path",install_from);
                    442:        sprintf(opt[j++],"%-30.30s%s","Target Path",install_to);
                    443:        strcpy(opt[j++],"Start Installation");
                    444:        opt[j][0]=0;
                    445:        switch(ulist(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,60,&i,0
                    446:                ,"Synchronet Multinode BBS Installation",opt)) {
                    447:                case 0:
                    448:                        j=0;
                    449:                        while(1) {
                    450:                                k=0;
                    451:                                sprintf(opt[k++],"%-30.30s%3s","Main Executables"
                    452:                                        ,mode&EXEC ? "Yes":"No");
                    453:                                sprintf(opt[k++],"%-30.30s%3s","Default Configuration"
                    454:                                        ,mode&CFGS ? "Yes":"No");
                    455:                                sprintf(opt[k++],"%-30.30s%3s","Text and Menus"
                    456:                                        ,mode&TEXT ? "Yes":"No");
                    457:                                sprintf(opt[k++],"%-30.30s%3s","Documentation"
                    458:                                        ,mode&DOCS ? "Yes":"No");
                    459:                                strcpy(opt[k++],"All");
                    460:                                strcpy(opt[k++],"None");
                    461:                                opt[k][0]=0;
                    462: helpbuf=
                    463: " Distribution Disk 1 \r\n\r\n"
                    464: "If you are a installing Synchronet for the first time, it is suggested\r\n"
                    465: "that you install &All& of Disk 1.\r\n\r\n"
                    466: "If for some reason, you wish to partially install Synchronet or update\r\n"
                    467: "a previously installed version, you can toggle the installation of the\r\n"
                    468: "following file sets:\r\n\r\n"
                    469: "&EXEC&: Main executable files necessary for Synchronet to run\r\n\r\n"
                    470: "&CFGS&: Default configuration files\r\n\r\n"
                    471: "&TEXT&: Text and menu files\r\n\r\n"
                    472: "&DOCS&: Online ASCII documentation for the system operator";
                    473:                                j=ulist(0,0,0,0,&j,0,"Distribution Disk 1",opt);
                    474:                                if(j==-1)
                    475:                                        break;
                    476:                                switch(j) {
                    477:                                        case 0:
                    478:                                                mode^=EXEC;
                    479:                                                break;
                    480:                                        case 1:
                    481:                                                mode^=CFGS;
                    482:                                                break;
                    483:                                        case 2:
                    484:                                                mode^=TEXT;
                    485:                                                break;
                    486:                                        case 3:
                    487:                                                mode^=DOCS;
                    488:                                                break;
                    489:                                        case 4:
                    490:                                                mode|=DISK1;
                    491:                                                break;
                    492:                                        case 5:
                    493:                                                mode&=~DISK1;
                    494:                                                break; } }
                    495:                        break;
                    496:                case 1:
                    497:                        j=0;
                    498:                        while(1) {
                    499:                                k=0;
                    500:                                sprintf(opt[k++],"%-30.30s%3s","Utilities"
                    501:                                        ,mode&UTIL ? "Yes":"No");
                    502:                                sprintf(opt[k++],"%-30.30s%3s","Online External Programs"
                    503:                                        ,mode&XTRN ? "Yes":"No");
                    504:                                sprintf(opt[k++],"%-30.30s%3s","External Program SDK"
                    505:                                        ,mode&XSDK ? "Yes":"No");
                    506:                                strcpy(opt[k++],"All");
                    507:                                strcpy(opt[k++],"None");
                    508:                                opt[k][0]=0;
                    509: helpbuf=
                    510: " Distribution Disk 2 \r\n\r\n"
                    511: "This disk is optional for the execution of Synchronet. This disk is\r\n"
                    512: "also referred to as the &Synchronet Utilities Disk&.\r\n\r\n"
                    513: "If for some reason, you wish to partially install Synchronet or update\r\n"
                    514: "a previously installed version, you can toggle the installation of the\r\n"
                    515: "following file sets:\r\n\r\n"
                    516: "&UTIL&: Utilities to enhance the operation of Synchronet\r\n\r\n"
                    517: "&XTRN&: Online External Program Samples\r\n\r\n"
                    518: "&XSDK&: External Program Software Development Kit (for programmers)";
                    519:                                j=ulist(WIN_RHT,0,0,0,&j,0,"Distribution Disk 2",opt);
                    520:                                if(j==-1)
                    521:                                        break;
                    522:                                switch(j) {
                    523:                                        case 0:
                    524:                                                mode^=UTIL;
                    525:                                                break;
                    526:                                        case 1:
                    527:                                                mode^=XTRN;
                    528:                                                break;
                    529:                                        case 2:
                    530:                                                mode^=XSDK;
                    531:                                                break;
                    532:                                        case 3:
                    533:                                                mode|=DISK2;
                    534:                                                break;
                    535:                                        case 4:
                    536:                                                mode&=~DISK2;
                    537:                         break; } }
                    538:                        break;
                    539:                case 2:
                    540: helpbuf=
                    541: " Source Path \r\n\r\n"
                    542: "This is the complete path (drive and directory) to install Synchronet\r\n"
                    543: "from. The suggested path is &A:\\&, but any valid DOS drive and\r\n"
                    544: "directory may be used.";
                    545:                        uinput(WIN_L2R,0,0,"Source Path",install_from
                    546:                                ,30,K_EDIT|K_UPPER);
                    547:                        backslash(install_from);
                    548:             break;
                    549:                case 3:
                    550: helpbuf=
                    551: " Target Path \r\n\r\n"
                    552: "This is the complete path (drive and directory) to install Synchronet\r\n"
                    553: "to. The suggested path is &C:\\SBBS\\&, but any valid DOS drive and\r\n"
                    554: "directory may be used.";
                    555:                        uinput(WIN_L2R|WIN_BOT,0,0,"Target Path",install_to
                    556:                                ,20,K_EDIT|K_UPPER);
                    557:                        backslash(install_to);
                    558:                        break;
                    559:                case 4:
                    560:                        strcpy(opt[0],"Yes");
                    561:                        strcpy(opt[1],"No");
                    562:                        opt[2][0]=0;
                    563:                        j=1;
                    564:                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    565:                                ,"Are you upgrading from an older version (already installed)"
                    566:                                ,opt);
                    567:                        if(j==-1)
                    568:                                break;
                    569:                        if(j==0) {
                    570:                                helpbuf=
                    571: " Upgrade Back-up \r\n"
                    572: "\r\n"
                    573: "&INSTALL& will take care to only overwrite files that have been changed\r\n"
                    574: "in this new version, but it is always a good idea to do a complete\r\n"
                    575: "system back-up before upgrading, just to be safe.\r\n"
                    576: "\r\n"
                    577: "If you have customized (with an editor) any of the following files, you\r\n"
                    578: "will want to &back them up& (copy to another disk or directory) before\r\n"
                    579: "you begin the upgrade procedure:\r\n"
                    580: "\r\n"
                    581: "&TEXT.DAT& (CTRL\\TEXT.DAT)\r\n"
                    582: "&Command Shells and Loadable Modules& (EXEC\\*.SRC)\r\n"
                    583: "&Menus& (TEXT\\MENU\\*.ASC)\r\n"
                    584: "&Match Maker Questionnaires& (XTRN\\SMM\\*.QUE)\r\n"
                    585: "&External Program Menus& (XTRN\\SMM\\*.ASC, XTRN\\SCB\\*.ASC, etc)\r\n";
                    586:                                help();
                    587:                                strcpy(opt[0],"Yes");
                    588:                                strcpy(opt[1],"No");
                    589:                                opt[2][0]=0;
                    590:                                j=0;
                    591:                                j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    592:                                        ,"Continue with upgrade"
                    593:                                        ,opt);
                    594:                                if(j)
                    595:                                        break;
                    596:                                mode|=UPGRADE;
                    597:                                mode&=~CFGS; }
                    598:                        else
                    599:                                mode&=~UPGRADE;
                    600:                        strcpy(str,install_to);
                    601:                        if(str[1]==':')                /* drive letter specified */
                    602:                                setdisk(toupper(str[0])-'A');
                    603:                        if(!md(str))
                    604:                                break;
                    605:                        sprintf(exec_dir,"%sEXEC\\",install_to);
                    606:                        if(mode&UPGRADE)
                    607:                                if(uinput(WIN_L2R|WIN_SAV,0,0,"EXEC Directory",exec_dir
                    608:                                        ,30,K_EDIT|K_UPPER)<1)
                    609:                                        break;
                    610:                        backslash(exec_dir);
                    611:                        if(!md(exec_dir))
                    612:                                break;
                    613:                        if(mode&UPGRADE) {
                    614:                                sprintf(str,"%sSBBS.EXE",exec_dir);
                    615:                                l=fdate_dir(str);
                    616:                                ver=NONE;
                    617:                                switch(l) {
                    618:                                        case 0x3044fb80:        /* 08/31/95 v2.20a */
                    619:                                                ver=SBBS22;
                    620:                                                break;
                    621:                                        case 0x2f6a2280:        /* 03/18/95 v2.11a */
                    622:                                        case 0x2f43e700:        /* 02/17/95 v2.10a */
                    623:                                                ver=SBBS21;
                    624:                                                break;
                    625:                                        case 0x2e6fa580:        /* 09/09/94 v2.00g */
                    626:                                        case 0x2e627680:        /* 08/30/94 v2.00f */
                    627:                                        case 0x2e5a8d80:        /* 08/24/94 v2.00e */
                    628:                                        case 0x2e569900:        /* 08/21/94 v2.00d */
                    629:                                        case 0x2e554780:        /* 08/20/94 v2.00c */
                    630:                                        case 0x2e0b7380:        /* 06/25/94 v2.00b */
                    631:                                        case 0x2ded2100:        /* 06/02/94 v2.00a */
                    632:                                                ver=SBBS20;
                    633:                                                break; }
                    634:                                if(ver==NONE && flength(str)==642448UL)
                    635:                                        ver=SBBS22; /* v2.20b - possibly patched */
                    636:                                if(ver==NONE) {
                    637:                                        strcpy(opt[0],"Version 1");
                    638:                                        strcpy(opt[1],"Version 2.0");
                    639:                                        strcpy(opt[2],"Version 2.1");
                    640:                                        strcpy(opt[3],"Version 2.2");
                    641:                                        strcpy(opt[4],"Version 2.3 beta");
                    642:                                        opt[5][0]=0;
                    643:                                        j=0;
                    644:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    645:                                                ,"Which version are you upgrading from?"
                    646:                                                ,opt);
                    647:                                        if(j<0)
                    648:                                                break;
                    649:                                        ver=j;
                    650:                                        if(ver==NONE) { // Version 1
                    651:                                                umsg("INSTALL can only upgrade from Version 2.0 or later");
                    652:                                                umsg("See the file UPGRADE.DOC for UPGRADE instructions");
                    653:                                                break; } } }
                    654: 
                    655:                        if(mode&EXEC) {
                    656:                                strcpy(opt[0],"Skip This Disk");
                    657:                                strcpy(opt[1],"Okay, Try Again");
                    658:                 strcpy(opt[2],"Change Source Path...");
                    659:                                opt[3][0]=0;
                    660:                                j=1;
                    661:                                while(1) {
                    662:                                        sprintf(str,"%sEXEC.LZH",install_from);
                    663:                                        if(!findfirst(str,&ff,0))
                    664:                                                break;
                    665:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    666:                                                ,"Insert Distribution Disk 1",opt);
                    667:                                        if(j==-1)
                    668:                                                break;
                    669:                                        if(j==0) {
                    670:                                                mode&=~DISK1;
                    671:                                                break; }
                    672:                                        if(j==2) {
                    673:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    674:                                                        ,30,K_EDIT|K_UPPER);
                    675:                                                backslash(install_from); } }
                    676:                                if(j==-1)
                    677:                                        break;
                    678: 
                    679:                                /* If they already exist, flag as read/write */
                    680:                                if(mode&DISK1) {
                    681:                                        sprintf(str,"%sSBBS.EXE",exec_dir);
                    682:                                        chmod(str,S_IREAD|S_IWRITE);
                    683:                                        sprintf(str,"%sSCFG.EXE",exec_dir);
                    684:                                        chmod(str,S_IREAD|S_IWRITE);
                    685: 
                    686:                                        sprintf(str,"%sEXEC.LZH",install_from);
                    687:                                        sprintf(tmp,"%sEXEC.LZH",exec_dir);
                    688:                                        if(copy(str,tmp))
                    689:                                                break;
                    690:                                        if(mode&UPGRADE) {
                    691:                                                sprintf(str,"@%sEXEC.UPG",install_from);
                    692:                                                if(fexist(str+1))
                    693:                                                        if(unarc(1,tmp,exec_dir,str)) {
                    694:                                                                remove(tmp);
                    695:                                                                break; }
                    696:                                                if(unarc(0,tmp,exec_dir,NULL)) {
                    697:                             remove(tmp);
                    698:                                                        break; } }
                    699:                     else
                    700:                                                if(unarc(1,tmp,exec_dir,NULL)) {
                    701:                                                        remove(tmp);
                    702:                                                        break; }
                    703:                                        remove(tmp);
                    704: 
                    705:                                        /* now set to READ ONLY */
                    706:                                        sprintf(str,"%sSBBS.EXE",exec_dir);
                    707:                                        if(chmod(str,S_IREAD))
                    708:                                                umsg("Error setting SBBS.EXE to READ ONLY");
                    709:                                        sprintf(str,"%sSCFG.EXE",exec_dir);
                    710:                                        if(chmod(str,S_IREAD))
                    711:                                                umsg("Error setting SCFG.EXE to READ ONLY"); } }
                    712: 
                    713:                        if(mode&CFGS) {
                    714:                                sprintf(str,"%sCTRL",install_to);
                    715:                                if(!md(str))
                    716:                                        break;
                    717:                                strcpy(opt[0],"Skip This Disk");
                    718:                                strcpy(opt[1],"Okay, Try Again");
                    719:                 strcpy(opt[2],"Change Source Path...");
                    720:                 opt[3][0]=0;
                    721:                                j=1;
                    722:                                while(1) {
                    723:                                        sprintf(str,"%sCFGS.LZH",install_from);
                    724:                                        if(!findfirst(str,&ff,0))
                    725:                                                break;
                    726:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    727:                                                ,"Insert Distribution Disk 1",opt);
                    728:                                        if(j==-1)
                    729:                                                break;
                    730:                                        if(j==0) {
                    731:                                                mode&=~DISK1;
                    732:                                                break; }
                    733:                                        if(j==2) {
                    734:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    735:                                                        ,30,K_EDIT|K_UPPER);
                    736:                                                backslash(install_from); } }
                    737:                                if(j==-1)
                    738:                                        break;
                    739:                                if(mode&DISK1) {         /* not skip */
                    740:                                        sprintf(str,"%sCFGS.LZH",install_from);
                    741:                                        sprintf(tmp,"%sCFGS.LZH",install_to);
                    742:                                        if(copy(str,tmp))
                    743:                                                break;
                    744:                                        sprintf(str,"%sCTRL",install_to);
                    745:                                        if(unarc(1,tmp,install_to,NULL)) {
                    746:                                                remove(tmp);
                    747:                                                break; }
                    748:                                        remove(tmp); } }
                    749: 
                    750:                        if(mode&TEXT) {
                    751:                                sprintf(ctrl_dir,"%sCTRL\\",install_to);
                    752:                                if(!md(ctrl_dir))
                    753:                                        break;
                    754:                                sprintf(text_dir,"%sTEXT\\",install_to);
                    755:                                if(!md(text_dir))
                    756:                     break;
                    757:                                strcpy(opt[0],"Skip This Disk");
                    758:                                strcpy(opt[1],"Okay, Try Again");
                    759:                 strcpy(opt[2],"Change Source Path...");
                    760:                 opt[3][0]=0;
                    761:                                j=1;
                    762:                                while(1) {
                    763:                                        sprintf(str,"%sTEXT.LZH",install_from);
                    764:                                        if(!findfirst(str,&ff,0))
                    765:                                                break;
                    766:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    767:                                                ,"Insert Distribution Disk 1",opt);
                    768:                                        if(j==-1)
                    769:                                                break;
                    770:                                        if(j==0) {
                    771:                                                mode&=~DISK1;
                    772:                                                break; }
                    773:                                        if(j==2) {
                    774:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    775:                                                        ,30,K_EDIT|K_UPPER);
                    776:                                                backslash(install_from); } }
                    777:                                if(j==-1)
                    778:                                        break;
                    779:                                if(mode&DISK1) {
                    780:                                        sprintf(str,"%sTEXT.LZH",install_from);
                    781:                                        sprintf(tmp,"%sTEXT.LZH",install_to);
                    782:                                        if(copy(str,tmp))
                    783:                                                break;
                    784:                                        if(mode&UPGRADE) {
                    785:                                                sprintf(str,"@%sTEXT.UPG",install_from);
                    786:                                                if(fexist(str+1))
                    787:                                                        if(unarc(1,tmp,install_to,str)) {
                    788:                                                                remove(tmp);
                    789:                                                                break; }
                    790:                                                if(unarc(0,tmp,install_to,NULL)) {
                    791:                             remove(tmp);
                    792:                                                        break; } }
                    793:                                        else
                    794:                                                if(unarc(1,tmp,install_to,NULL)) {
                    795:                                                        remove(tmp);
                    796:                                                        break; }
                    797:                                        remove(tmp); } }
                    798: 
                    799:                        if(mode&DOCS) {
                    800:                                sprintf(docs_dir,"%sDOCS\\",install_to);
                    801:                                if(mode&UPGRADE)
                    802:                                        if(uinput(WIN_L2R|WIN_SAV,0,0,"DOCS Directory",docs_dir
                    803:                                                ,30,K_EDIT|K_UPPER)<1)
                    804:                         break;
                    805:                                backslash(docs_dir);
                    806:                                if(!md(docs_dir))
                    807:                                        break;
                    808:                                strcpy(opt[0],"Skip This Disk");
                    809:                                strcpy(opt[1],"Okay, Try Again");
                    810:                 strcpy(opt[2],"Change Source Path...");
                    811:                 opt[3][0]=0;
                    812:                                j=1;
                    813:                                while(1) {
                    814:                                        sprintf(str,"%sDOCS.LZH",install_from);
                    815:                                        if(!findfirst(str,&ff,0))
                    816:                                                break;
                    817:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    818:                                                ,"Insert Distribution Disk 1",opt);
                    819:                                        if(j==-1)
                    820:                                                break;
                    821:                                        if(j==0) {
                    822:                                                mode&=~DISK1;
                    823:                                                break; }
                    824:                                        if(j==2) {
                    825:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    826:                                                        ,30,K_EDIT|K_UPPER);
                    827:                                                backslash(install_from); } }
                    828:                                if(j==-1)
                    829:                                        break;
                    830:                                if(mode&DISK1) {
                    831:                                        sprintf(str,"%sDOCS.LZH",install_from);
                    832:                                        sprintf(tmp,"%sDOCS.LZH",install_to);
                    833:                                        if(copy(str,tmp))
                    834:                                                break;
                    835:                                        if(unarc(1,tmp,docs_dir,NULL)) {
                    836:                                                remove(tmp);
                    837:                                                break; }
                    838:                                        remove(tmp); } }
                    839: 
                    840:                        if(mode&UTIL) {
                    841:                                strcpy(opt[0],"Skip This Disk");
                    842:                                strcpy(opt[1],"Okay, Try Again");
                    843:                 strcpy(opt[2],"Change Source Path...");
                    844:                 opt[3][0]=0;
                    845:                                j=1;
                    846:                                while(1) {
                    847:                                        sprintf(str,"%sUTIL.LZH",install_from);
                    848:                                        if(!findfirst(str,&ff,0))
                    849:                                                break;
                    850:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    851:                                                ,"Insert Distribution Disk 2 (Utilities Disk)",opt);
                    852:                                        if(j==-1)
                    853:                                                break;
                    854:                                        if(j==0) {
                    855:                                                mode&=~DISK2;
                    856:                                                break; }
                    857:                                        if(j==2) {
                    858:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    859:                                                        ,30,K_EDIT|K_UPPER);
                    860:                                                backslash(install_from); } }
                    861:                                if(j==-1)
                    862:                                        break;
                    863: 
                    864:                                if(mode&DISK2) {
                    865:                                        sprintf(str,"%sUTIL.LZH",install_from);
                    866:                                        sprintf(tmp,"%sUTIL.LZH",exec_dir);
                    867:                                        if(copy(str,tmp))
                    868:                                                break;
                    869:                                        if(mode&UPGRADE) {
                    870:                                                sprintf(str,"@%sUTIL.UPG",install_from);
                    871:                                                if(fexist(str+1))
                    872:                                                        if(unarc(1,tmp,exec_dir,str)) {
                    873:                                                                remove(tmp);
                    874:                                                                break; }
                    875:                                                if(unarc(0,tmp,exec_dir,NULL)) {
                    876:                             remove(tmp);
                    877:                                                        break; } }
                    878:                     else
                    879:                                                if(unarc(1,tmp,exec_dir,NULL)) {
                    880:                                                        remove(tmp);
                    881:                                                        break; }
                    882:                                        remove(tmp); } }
                    883: 
                    884:                        if(mode&XTRN) {
                    885:                                sprintf(str,"%sXTRN",install_to);
                    886:                                if(!md(str))
                    887:                                        break;
                    888:                                strcpy(opt[0],"Skip This Disk");
                    889:                                strcpy(opt[1],"Okay, Try Again");
                    890:                 strcpy(opt[2],"Change Source Path...");
                    891:                 opt[3][0]=0;
                    892:                                j=1;
                    893:                                while(1) {
                    894:                                        sprintf(str,"%sXTRN.LZH",install_from);
                    895:                                        if(!findfirst(str,&ff,0))
                    896:                                                break;
                    897:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    898:                                                ,"Insert Distribution Disk 2 (Utilities Disk)",opt);
                    899:                                        if(j==-1)
                    900:                                                break;
                    901:                                        if(j==0) {
                    902:                                                mode&=~DISK2;
                    903:                                                break; }
                    904:                                        if(j==2) {
                    905:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    906:                                                        ,30,K_EDIT|K_UPPER);
                    907:                                                backslash(install_from); } }
                    908:                                if(j==-1)
                    909:                                        break;
                    910: 
                    911:                                if(mode&DISK2) {
                    912:                                        sprintf(str,"%sXTRN.LZH",install_from);
                    913:                                        sprintf(tmp,"%sXTRN.LZH",install_to);
                    914:                                        if(copy(str,tmp))
                    915:                                                break;
                    916:                                        if(mode&UPGRADE) {
                    917:                                                sprintf(str,"@%sXTRN.UPG",install_from);
                    918:                                                if(fexist(str+1))
                    919:                                                        if(unarc(1,tmp,install_to,str)) {
                    920:                                                                remove(tmp);
                    921:                                                                break; }
                    922:                                                if(unarc(0,tmp,install_to,NULL)) {
                    923:                             remove(tmp);
                    924:                                                        break; } }
                    925:                                        else
                    926:                                                if(unarc(1,tmp,install_to,NULL)) {
                    927:                                                        remove(tmp);
                    928:                             break; }
                    929:                                        remove(tmp); } }
                    930: 
                    931:                        if(mode&XSDK) {
                    932:                                sprintf(str,"%sXTRN",install_to);
                    933:                                if(!md(str))
                    934:                                        break;
                    935:                                sprintf(str,"%sXTRN\\SDK",install_to);
                    936:                                if(!md(str))
                    937:                     break;
                    938:                                strcpy(opt[0],"Skip This Disk");
                    939:                                strcpy(opt[1],"Okay, Try Again");
                    940:                 strcpy(opt[2],"Change Source Path...");
                    941:                 opt[3][0]=0;
                    942:                                j=1;
                    943:                                while(1) {
                    944:                                        sprintf(str,"%sXSDK.LZH",install_from);
                    945:                                        if(!findfirst(str,&ff,0))
                    946:                                                break;
                    947:                                        j=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
                    948:                                                ,"Insert Distribution Disk 2 (Utilities Disk)",opt);
                    949:                                        if(j==-1)
                    950:                                                break;
                    951:                                        if(j==0) {
                    952:                                                mode&=~DISK2;
                    953:                                                break; }
                    954:                                        if(j==2) {
                    955:                                                uinput(WIN_L2R|WIN_SAV,0,0,"Source Path",install_from
                    956:                                                        ,30,K_EDIT|K_UPPER);
                    957:                                                backslash(install_from); } }
                    958:                                if(j==-1)
                    959:                                        break;
                    960: 
                    961:                                if(mode&DISK2) {
                    962:                                        sprintf(str,"%sXSDK.LZH",install_from);
                    963:                                        sprintf(tmp,"%sXTRN\\XSDK.LZH",install_to);
                    964:                                        if(copy(str,tmp))
                    965:                                                break;
                    966:                                        sprintf(str,"%sXTRN\\SDK\\",install_to);
                    967:                                        if(unarc(1,tmp,str,NULL)) {
                    968:                                                remove(tmp);
                    969:                                                break; }
                    970:                                        remove(tmp); } }
                    971:                        sprintf(str,"%sNODE1",install_to);
                    972:                        chdir(str);
                    973:                        if(mode&UPGRADE) {
                    974:                                helpbuf=
                    975: " Additional Upgrade Instructions \r\n"
                    976: "\r\n"
                    977: "If you were previously running version 1.1 of &SyncEdit&, you'll need to\r\n"
                    978: "change your command lines and toggle options in SCFG for this new\r\n"
                    979: "version (2.0). See &DOCS\\SYNCEDIT.DOC& for details.\r\n"
                    980: "\r\n"
                    981: "Make sure you have &SCFG->System->Loadable Modules->Login& set to &LOGIN&\r\n"
                    982: "and &SCFG->System->Loadable Modules->Logon& set to &LOGON&.\r\n"
                    983: "\r\n"
                    984: "If you want your users to be able to use &WIP& compatible terminals with\r\n"
                    985: "your BBS, add &WIPSHELL& to &SCFG->Command Shells& with an Access\r\n"
                    986: "Requirement String of \"&WIP&\".";
                    987:                                help(); }
                    988:                        uifcbail();
                    989:                        if(mode&UPGRADE) {
                    990:                                cprintf("Synchronet Upgrade Complete.\r\n");
                    991:                                exit(0); }
                    992:                        if(mode&CFGS)
                    993:                                p="/F";
                    994:                        else
                    995:                                p=NULL;
                    996:                        spawnl(P_WAIT,"..\\EXEC\\SCFG.EXE"
                    997:                                ,"..\\EXEC\\SCFG","..\\CTRL",p,NULL);
                    998:                        textattr(LIGHTGRAY);
                    999:                        cprintf(
                   1000: "Synchronet BBS and its utilities use file and record locking to maintain\r\n"
                   1001: "data integrity in a multinode environment. File and record locking under DOS\r\n"
                   1002: "requires the use of SHARE.\r\n"
                   1003: "\r\n"
                   1004:                        );
                   1005:                        cprintf(
                   1006: "SHARE is a program that is distributed with MS-DOS and PC-DOS v3.0 and higher\r\n"
                   1007: "and must be executed prior to running SBBS. SHARE.EXE should be located in the\r\n"
                   1008: "DOS directory of your hard disk.\r\n"
                   1009: "\r\n"
                   1010:                        );
                   1011:                        cprintf(
                   1012: "If you are running Microsoft Windows, you must exit Windows and load SHARE\r\n"
                   1013: "before reloading Windows.\r\n"
                   1014: "\r\n"
                   1015:                        );
                   1016:                        cprintf(
                   1017: "It is not necessary to run SHARE if using a single node on a Novell NetWare\r\n"
                   1018: "workstation or in an OS/2 DOS window.\r\n"
                   1019: "\r\n"
                   1020:                        );
                   1021:                        cprintf(
                   1022: "SHARE.EXE can be automatically loaded in your AUTOEXEC.BAT or CONFIG.SYS.\r\n"
                   1023: "\r\n"
                   1024:                        );
                   1025:                        textattr(WHITE);
                   1026:                        cprintf(
                   1027: "After you have loaded SHARE, type SBBS from THIS directory.\r\n"
                   1028:                        );
                   1029:                        textattr(LIGHTGRAY);
                   1030:                        exit(0);
                   1031:                case -1:
                   1032:                        j=0;
                   1033:                        strcpy(opt[0],"Yes");
                   1034:                        strcpy(opt[1],"No");
                   1035:                        opt[2][0]=0;
                   1036:                        if(!(ulist(WIN_MID,0,0,20,&j,0,"Abort Installation",opt)))
                   1037:                                bail(0);
                   1038:                        break; } }
                   1039: }
                   1040: 
                   1041: void bail(int code)
                   1042: {
                   1043: 
                   1044: if(code)
                   1045:        getch();
                   1046: uifcbail();
                   1047: exit(code);
                   1048: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.