/***************************************************************************** * * $Id$ * Purpose ...............: Setup Program * ***************************************************************************** * Copyright (C) 1997-2004 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 * 1971 BV IJmuiden * the Netherlands * * This file is part of MBSE BBS. * * This BBS is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * MB BBS is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MB BBS; see the file COPYING. If not, write to the Free * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *****************************************************************************/ #include "../config.h" #include "../lib/mbselib.h" #include "screen.h" #include "mutil.h" #include "ledit.h" #include "m_global.h" #include "m_bbs.h" #include "m_farea.h" #include "m_fgroup.h" #include "m_mail.h" #include "m_mgroup.h" #include "m_hatch.h" #include "m_tic.h" #include "m_ticarea.h" #include "m_magic.h" #include "m_fido.h" #include "m_lang.h" #include "m_archive.h" #include "m_virus.h" #include "m_tty.h" #include "m_limits.h" #include "m_users.h" #include "m_node.h" #include "m_fdb.h" #include "m_new.h" #include "m_ol.h" #include "m_bbslist.h" #include "m_protocol.h" #include "m_ff.h" #include "m_modem.h" #include "m_marea.h" #include "m_ngroup.h" #include "m_service.h" #include "m_domain.h" #include "m_task.h" #include "m_route.h" mode_t oldmask; /* Old umask value */ extern int do_quiet; /* Suppress log to screen */ extern int bbs_free; /* Free/Busy status */ int exp_golded = FALSE; /* Export GoldED config */ int init = FALSE; /* Run init only */ static void die(int onsig) { FILE *fp; char *temp; int i; signal(onsig, SIG_IGN); if ((!init) && (onsig != MBERR_NO_PROGLOCK)) screen_stop(); if (exp_golded && (config_read() != -1)) { temp = calloc(PATH_MAX, sizeof(char)); /* * Export ~/etc/msg.txt for MsgEd. */ sprintf(temp, "%s/etc/msg.txt", getenv("MBSE_ROOT")); if ((fp = fopen(temp, "w")) != NULL) { fprintf(fp, "; msg.txt -- Automatic created by mbsetup %s -- Do not edit!\n;\n", VERSION); fprintf(fp, "; Mail areas for MsgEd.\n;\n"); msged_areas(fp); fclose(fp); Syslog('+', "Created new %s", temp); } else { WriteError("$Could not create %s", temp); } /* * Export ~/etc/golded.inc for GoldED */ sprintf(temp, "%s/etc/golded.inc", getenv("MBSE_ROOT")); if ((fp = fopen(temp, "w")) != NULL) { fprintf(fp, "; GoldED.inc -- Automatic created by mbsetup %s -- Do not edit!\n\n", VERSION); fprintf(fp, "; Basic information.\n;\n"); if (strlen(CFG.sysop_name) && CFG.akavalid[0] && CFG.aka[0].zone) { fprintf(fp, "USERNAME %s\n\n", CFG.sysop_name); fprintf(fp, "ADDRESS %s\n", aka2str(CFG.aka[0])); for (i = 1; i < 40; i++) if (CFG.akavalid[i]) fprintf(fp, "AKA %s\n", aka2str(CFG.aka[i])); fprintf(fp, "\n"); gold_akamatch(fp); fprintf(fp, "; JAM MessageBase Setup\n;\n"); fprintf(fp, "JAMPATH %s/tmp/\n", getenv("MBSE_ROOT")); fprintf(fp, "JAMHARDDELETE NO\n\n"); fprintf(fp, "; Semaphore files\n;\n"); fprintf(fp, "SEMAPHORE NETSCAN %s/sema/mailout\n", getenv("MBSE_ROOT")); fprintf(fp, "SEMAPHORE ECHOSCAN %s/sema/mailout\n\n", getenv("MBSE_ROOT")); gold_areas(fp); } fclose(fp); Syslog('+', "Created new %s", temp); } else { WriteError("$Could not create %s", temp); } free(temp); } ulockprogram((char *)"mbsetup"); umask(oldmask); if (onsig && (onsig <= NSIG)) WriteError("MBSETUP finished on signal %s", SigName[onsig]); else Syslog(' ', "MBSETUP finished"); ExitClient(onsig); } void soft_info(void); void soft_info(void) { char *temp; temp = calloc(81, sizeof(char)); clr_index(); set_color(YELLOW, BLACK); sprintf(temp, "MBSE BBS (%s-%s)", OsName(), OsCPU()); center_addstr( 6, temp); set_color(WHITE, BLACK); center_addstr( 8, (char *)COPYRIGHT); set_color(YELLOW, BLACK); center_addstr(10, (char *)"Made in the Netherlands"); set_color(WHITE, BLACK); #ifdef __GLIBC__ sprintf(temp, "Compiled on glibc v%d.%d", __GLIBC__, __GLIBC_MINOR__); #else #ifdef __GNU_LIBRARY__ sprintf(temp, "Compiled on libc v%d", __GNU_LIBRARY__); #else sprintf(temp, "Compiled on unknown library"); #endif #endif center_addstr(12, temp); set_color(LIGHTCYAN, BLACK); center_addstr(14, (char *)"http://www.mbse.dds.nl or 2:280/2802"); set_color(LIGHTGREEN, BLACK); center_addstr(LINES -7, (char *)"This is free software; released under the terms of the GNU General"); center_addstr(LINES -6, (char *)"Public License as published by the Free Software Foundation."); set_color(CYAN, BLACK); free(temp); center_addstr(LINES -4, (char *)"Press any key"); readkey(LINES - 4, COLS / 2 + 8, LIGHTGRAY, BLACK); } void site_docs(void); void site_docs(void) { FILE *fp, *hp, *toc; char temp[PATH_MAX], temp1[PATH_MAX]; int page = 0, line = 0; if (config_read() == -1) return; sprintf(temp, "%s/doc/site.doc", getenv("MBSE_ROOT")); if ((fp = fopen(temp, "w")) == NULL) return; sprintf(temp1, "%s/tmp/toc.tmp", getenv("MBSE_ROOT")); if ((toc = fopen(temp1, "w+")) == NULL) { fclose(fp); return; } clr_index(); working(1, 0, 0); IsDoing("Making Sitedocs"); Syslog('+', "Start creating sitedocs"); set_color(WHITE, BLACK); mvprintw( 5, 6, "21. CREATING SITEDOCS"); set_color(CYAN, BLACK); mvprintw( 7,11, (char *)"Erasing directory %s/doc/html", getenv("MBSE_ROOT")); fflush(stdout); sprintf(temp, "-r -f %s/doc/html", getenv("MBSE_ROOT")); execute_pth((char *)"rm", temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"); if ((hp = open_webdoc((char *)"index.html", (char *)"BBS Site Documentation", NULL))) { fprintf(hp, "