mbsetup now creates more default records on new systems, filesystem layout changed

This commit is contained in:
Michiel Broek 2001-12-25 21:40:16 +00:00
parent a47a97e29d
commit 8fd37e8d8a
8 changed files with 176 additions and 12 deletions

View File

@ -4277,6 +4277,10 @@ v0.33.19 26-Oct-2001
The AREADEF lines in golded.inc now contain the aka to use The AREADEF lines in golded.inc now contain the aka to use
instead of a dot. instead of a dot.
Fixes for Sparc systems. Fixes for Sparc systems.
Now logs in the normal system logfile.
On new systems it will now also create one filearea, three
default mail areas, a newfilereport and the groups belonging
to these areas. Also 10 oneliners are installed.
mbsebbs: mbsebbs:
Added menu 317, change FS editor shortcut keys to (Emacs/ Added menu 317, change FS editor shortcut keys to (Emacs/

View File

@ -64,9 +64,24 @@ int CountFilearea(void)
areahdr.hdrsize = sizeof(areahdr); areahdr.hdrsize = sizeof(areahdr);
areahdr.recsize = sizeof(area); areahdr.recsize = sizeof(area);
fwrite(&areahdr, sizeof(areahdr), 1, fil); fwrite(&areahdr, sizeof(areahdr), 1, fil);
memset(&area, 0, sizeof(area));
sprintf(area.Name, "Local general files");
area.New = TRUE;
area.Dupes = TRUE;
area.FileFind = TRUE;
area.AddAlpha = TRUE;
area.FileReq = TRUE;
area.Available = TRUE;
area.FileFind = TRUE;
sprintf(area.BbsGroup, "LOCAL");
sprintf(area.NewGroup, "LOCAL");
sprintf(area.Path, "%s/local/common", CFG.ftp_base);
fwrite(&area, sizeof(area), 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0640); chmod(ffile, 0640);
return 0; sprintf(ffile, "%s/foobar", area.Path);
mkdirs(ffile);
return 1;
} else } else
return -1; return -1;
} }

View File

@ -33,6 +33,7 @@
#include "../lib/records.h" #include "../lib/records.h"
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "../lib/msg.h"
#include "screen.h" #include "screen.h"
#include "mutil.h" #include "mutil.h"
#include "ledit.h" #include "ledit.h"
@ -58,7 +59,8 @@ int CountMsgarea(void)
{ {
FILE *fil; FILE *fil;
char ffile[PATH_MAX]; char ffile[PATH_MAX];
int count; int count, i;
struct _sysconnect syscon;
sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
@ -69,10 +71,85 @@ int CountMsgarea(void)
msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect); msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect);
msgshdr.lastupd = time(NULL); msgshdr.lastupd = time(NULL);
fwrite(&msgshdr, sizeof(msgshdr), 1, fil); fwrite(&msgshdr, sizeof(msgshdr), 1, fil);
/*
* Default first message area
*/
memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Local users chat");
sprintf(msgs.Base, "%s/var/mail/local/users", getenv("MBSE_ROOT"));
sprintf(msgs.QWKname, "LOC_USERS");
sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE;
msgs.Type = LOCALMAIL;
msgs.MsgKinds = PUBLIC;
msgs.SYSec.level = 32000;
msgs.UsrDelete = TRUE;
msgs.Aliases = TRUE;
msgs.Quotes = TRUE;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = CHRS_DEFAULT_RFC;
msgs.Ftncode = CHRS_DEFAULT_FTN;
strcpy(msgs.Origin, CFG.origin);
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base);
if (Msg_Open(msgs.Base))
Msg_Close();
memset(&syscon, 0, sizeof(syscon));
for (i = 1; i <= CFG.toss_systems; i++)
fwrite(&syscon, sizeof(syscon), 1, fil);
/*
* Default message area for badmail
*/
memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Bad mail");
sprintf(msgs.Base, "/opt/mbse/var/mail/badmail");
sprintf(msgs.QWKname, "BADMAIL");
sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE;
msgs.Type = LOCALMAIL;
msgs.MsgKinds = PUBLIC;
msgs.RDSec.level = 32000;
msgs.WRSec.level = 32000;
msgs.SYSec.level = 32000;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = CHRS_DEFAULT_RFC;
msgs.Ftncode = CHRS_DEFAULT_FTN;
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base);
if (Msg_Open(msgs.Base))
Msg_Close();
for (i = 1; i <= CFG.toss_systems; i++)
fwrite(&syscon, sizeof(syscon), 1, fil);
/*
* Default dupemail message area
*/
memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Dupe mail");
sprintf(msgs.Base, "/opt/mbse/var/mail/dupemail");
sprintf(msgs.QWKname, "DUPEMAIL");
sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE;
msgs.Type = LOCALMAIL;
msgs.MsgKinds = PUBLIC;
msgs.RDSec.level = 32000;
msgs.WRSec.level = 32000;
msgs.SYSec.level = 32000;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = CHRS_DEFAULT_RFC;
msgs.Ftncode = CHRS_DEFAULT_FTN;
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base);
if (Msg_Open(msgs.Base))
for (i = 1; i <= CFG.toss_systems; i++)
fwrite(&syscon, sizeof(syscon), 1, fil);
fclose(fil); fclose(fil);
exp_golded = TRUE; exp_golded = TRUE;
chmod(ffile, 0660); chmod(ffile, 0660);
return 0; return 3;
} else } else
return -1; return -1;
} }

View File

@ -64,9 +64,19 @@ int CountMGroup(void)
mgrouphdr.hdrsize = sizeof(mgrouphdr); mgrouphdr.hdrsize = sizeof(mgrouphdr);
mgrouphdr.recsize = sizeof(mgroup); mgrouphdr.recsize = sizeof(mgroup);
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fil); fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
memset(&mgroup, 0, sizeof(mgroup));
sprintf(mgroup.Name, "NOGROUP");
sprintf(mgroup.Comment, "Dummy group for badmail, dupemail");
mgroup.Active = TRUE;
fwrite(&mgroup, sizeof(mgroup), 1, fil);
memset(&mgroup, 0, sizeof(mgroup));
sprintf(mgroup.Name, "LOCAL");
sprintf(mgroup.Comment, "Local mail areas");
mgroup.Active = TRUE;
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0640); chmod(ffile, 0640);
return 0; return 2;
} else } else
return -1; return -1;
} }

View File

@ -55,8 +55,8 @@ int NewUpdated = 0;
int CountNewfiles(void) int CountNewfiles(void)
{ {
FILE *fil; FILE *fil;
char ffile[PATH_MAX]; char ffile[PATH_MAX], group[13];
int count; int count, i;
sprintf(ffile, "%s/etc/newfiles.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/newfiles.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
@ -66,9 +66,26 @@ int CountNewfiles(void)
newfileshdr.recsize = sizeof(newfiles); newfileshdr.recsize = sizeof(newfiles);
newfileshdr.grpsize = CFG.new_groups * 13; newfileshdr.grpsize = CFG.new_groups * 13;
fwrite(&newfileshdr, sizeof(newfileshdr), 1, fil); fwrite(&newfileshdr, sizeof(newfileshdr), 1, fil);
memset(&newfiles, 0, sizeof(newfiles));
sprintf(newfiles.Comment, "General newfiles announce");
sprintf(newfiles.Area, "%s/var/mail/local/users", getenv("MBSE_ROOT"));
sprintf(newfiles.Origin, "%s", CFG.origin);
sprintf(newfiles.From, "Sysop");
sprintf(newfiles.Too, "All");
sprintf(newfiles.Subject, "New files found");
newfiles.Language = 'E';
newfiles.Active = TRUE;
newfiles.HiAscii = TRUE;
fwrite(&newfiles, sizeof(newfiles), 1, fil);
sprintf(group, "LOCAL");
fwrite(&group, 13, 1, fil);
memset(&group, 0, sizeof(group));
for (i = 1; i < CFG.new_groups; i++)
fwrite(&group, 13, 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0640); chmod(ffile, 0640);
return 0; return 1;
} else } else
return -1; return -1;
} }

View File

@ -62,9 +62,19 @@ int CountNGroup(void)
ngrouphdr.hdrsize = sizeof(ngrouphdr); ngrouphdr.hdrsize = sizeof(ngrouphdr);
ngrouphdr.recsize = sizeof(ngroup); ngrouphdr.recsize = sizeof(ngroup);
fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fil); fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fil);
memset(&ngroup, 0, sizeof(ngroup));
sprintf(ngroup.Name, "DONT");
sprintf(ngroup.Comment, "Do NOT announce");
ngroup.Active = TRUE;
fwrite(&ngroup, sizeof(ngroup), 1, fil);
memset(&ngroup, 0, sizeof(ngroup));
sprintf(ngroup.Name, "LOCAL");
sprintf(ngroup.Comment, "Local file areas");
ngroup.Active = TRUE;
fwrite(&ngroup, sizeof(ngroup), 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0640); chmod(ffile, 0640);
return 0; return 2;
} else } else
return -1; return -1;
} }

View File

@ -53,6 +53,13 @@ int CountOneline(void)
FILE *fil; FILE *fil;
char ffile[PATH_MAX]; char ffile[PATH_MAX];
int count; int count;
struct tm *l_date;
char buf[12];
time_t Time;
Time = time(NULL);
l_date = localtime(&Time);
sprintf(buf, "%02d-%02d-%04d", l_date->tm_mday, l_date->tm_mon+1, l_date->tm_year+1900);
sprintf(ffile, "%s/etc/oneline.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
@ -61,9 +68,33 @@ int CountOneline(void)
olhdr.hdrsize = sizeof(olhdr); olhdr.hdrsize = sizeof(olhdr);
olhdr.recsize = sizeof(ol); olhdr.recsize = sizeof(ol);
fwrite(&olhdr, sizeof(olhdr), 1, fil); fwrite(&olhdr, sizeof(olhdr), 1, fil);
memset(&ol, 0, sizeof(ol));
sprintf(ol.UserName, "Sysop");
sprintf(ol.DateOfEntry, "%s", buf);
ol.Available = TRUE;
sprintf(ol.Oneline, "\"640K ought to be enough for anybody.\" Bill Gates '81");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "\"Build a watch in 179 easy steps\" by C. Forsberg.");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "\"Keyboard? How quaint!\" - Scotty");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "\"Luke... Luke... Use the MOUSE, Luke\" - Obi Wan Gates");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "\"Suicide Hotline...please hold.\"");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "(A)bort, (R)etry, (P)retend this never happened...");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "A Smith & Wesson *ALWAYS* beats 4 Aces.");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "A dirty book is rarely dusty.");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "An Elephant; A Mouse built to government specifications.");
fwrite(&ol, sizeof(ol), 1, fil);
sprintf(ol.Oneline, "At a store: In God we trust; all others pay cash.");
fwrite(&ol, sizeof(ol), 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0660); chmod(ffile, 0660);
return 0; return 10;
} else } else
return -1; return -1;
} }

View File

@ -398,12 +398,12 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
InitClient(pw->pw_name, (char *)"mbsetup", (char *)"nowhere", (char *)"mbsetup.log", 0x1f, (char *)"error.log");
/* /*
* Read the global configuration data * Read the global configuration data, registrate connection
*/ */
config_check(getenv("MBSE_ROOT")); config_check(getenv("MBSE_ROOT"));
config_read();
InitClient(pw->pw_name, (char *)"mbsetup", CFG.location, CFG.logfile, 0x1f, CFG.error_log);
/* /*
* Setup several signals so when the program terminate's it * Setup several signals so when the program terminate's it