File name: welboard2/install/setup (3,145 bytes) Text file viewer v1.2
    1 : #!/bin/wel
    2 : 
    3 : /* file: setup
    4 : 
    5 :    WelBoard V2.0.4 설치 프로그램 (author: 서광현)
    6 : 
    7 :    Copyright (c) 2001/03/25 by Wesoft
    8 :    All Rights Reserved.
    9 : */
   10 : 
   11 : timeout(0);
   12 : if(val(WelVersion)==0) version= "V0"; // WelVersion 값의 버그를 위하여
   13 :  else
   14 :   {
   15 :      pos= strfind(WelVersion, " ");
   16 :      if(pos<1) version="V"~WelVersion; else version="V"~left(WelVersion,pos-1);
   17 :   }
   18 : if(version<"V0.9")
   19 :  {
   20 :     print("Wel version error! (require Wel V0.9)\n");
   21 :     return;
   22 :  }
   23 : 
   24 : path= argv[0];
   25 : if(right(path,5)=="setup") path= left(path, len(path) - 5);
   26 : if(path=="" || path=="./") chdir("..");
   27 :   else if(right(path,8)=="install/") path= left(path, len(path) - 8);
   28 : if(path!="" && path!="./") chdir(path);
   29 : 
   30 : default_db= "welboard2";
   31 : default_decoder= "@cgipasswd";
   32 : default_cookie_expire= 30;
   33 : 
   34 : print("\n\n>>>> WelBoard V2.0.4 installer\n");
   35 : print("\n1. Enter MySQL database user id: ");
   36 : myuser= lrtrim(input());
   37 : print("\n2. Enter MySQL database passwd: ");
   38 : mypass= lrtrim(input());
   39 : print("\n3. Enter database name (", default_db, "): ");
   40 : mydb= lrtrim(input());
   41 : print("\n4. Enter decode variable (", default_decoder, "): ");
   42 : decoder= lrtrim(input());
   43 : print("\n5. Enter cookie expire time (", default_cookie_expire, "min): ");
   44 : cookie_expire= val(input());
   45 : 
   46 : if(mydb=="") mydb= default_db;
   47 : if(decoder=="") decoder= default_decoder;
   48 : if(cookie_expire=="") cookie_expire= default_cookie_expire;
   49 : 
   50 : enpass= encode(mypass, encodekey(), "", decoder);
   51 : 
   52 : print("\n\n-------------------------------------\n");
   53 : print("  MySQL database      user: ", myuser, "\n");
   54 : print("  MySQL database    passwd: ", mypass, "\n");
   55 : print("  Database            name: ", mydb, "\n");
   56 : print("  password decode variable: ", decoder, "\n");
   57 : print("  Cookie    expire    time: ", cookie_expire, " min\n");
   58 : print("-------------------------------------\n\n");
   59 : 
   60 : sel= choice(" Do you want to install?(Y/n) ", "Yy\nNn");
   61 : if(sel==3) print("Y");
   62 : print("\n\n");
   63 : cancel= "Installation is cancelled.\n\n";
   64 : if(sel>3)
   65 :  {
   66 :     print(cancel);
   67 :     return;
   68 :  }
   69 : 
   70 : chmod("conf", 0c777);
   71 : chmod("upload", 0c777);
   72 : 
   73 : mysql= mysql_connect(myhost, myuser, mypass); // MySQL 서버 연결
   74 : if(mysql==MYSQL_ERR)
   75 :  {
   76 :     print("MySQL connect error!\n", cancel);
   77 :     return;
   78 :  }
   79 : 
   80 : print("1. Creating database: mysqladmin create ", mydb, "\n");
   81 : if(mypass=="") passoption= ""; else passoption= " -p" ~ mypass;
   82 : mysqladmin= "mysqladmin create " ~ mydb ~ " -u" ~ myuser ~ passoption;
   83 : system(mysqladmin);
   84 : db_check= mysql_select_db(mysql,mydb);
   85 : mysql_close(mysql);
   86 : if(db_check==MYSQL_ERR)
   87 :  {
   88 :     print("database creation error!\n", cancel);
   89 :     return;
   90 :  }
   91 : print("2. setup 'board.inc'\n");
   92 : fp= formredir("include/board.inc", "w");
   93 : if(fp==FILE_OPEN_ERR)
   94 :  {
   95 :     print("board.inc write error!\n", cancel);
   96 :     return;
   97 :  }
   98 : btname= "{$btname}";
   99 : action= "{$action}";
  100 : style= "{$style}";
  101 : comment= "{$comment}";
  102 : randomize();
  103 : cookie_garbage= fix(rand(40))+1;
  104 : formdump("install/board.def");
  105 : fclose(fp);
  106 : 
  107 : print("3. Creating test board,...\n\n");
  108 : vunlock argc, argv;
  109 : vfree mysql;
  110 : argc= 2;
  111 : argv= array("", "test");
  112 : include("BDcreate");
  113 : 
  114 : print(" Successfuly installed, Thanks for using.\n\n");
  115 : print(" http://wesoft.co.kr                          Tel: (054) 433-4554\n");
  116 : return;
File name: welboard2/install/setup (3,145 bytes) Wesoft Corp. ⓒ 2001 All rights reserved.