Changed the location of the files database

This commit is contained in:
Michiel Broek 2004-09-09 21:12:37 +00:00
parent 61f89c0cfc
commit e8b540a263
4 changed files with 38 additions and 21 deletions

View File

@ -4,6 +4,13 @@ $Id$
v0.61.4 11-Aug-2004 v0.61.4 11-Aug-2004
upgrade: upgrade:
If you run a version older then 0.60.0, first upgrade to 0.60.0
If you run a version older then 0.60.0, first upgrade to 0.60.0
(That was twice).
Don't forget to backup /opt/mbse.
Before upgrade (make install) stop the bbs with "mbstat c w".
This is important because the files database moves to a new
location (~/var/fdb).
If you have BBBS uplinks and use automatic uplink requests then If you have BBBS uplinks and use automatic uplink requests then
change the setup of these nodes in screen 7.10. change the setup of these nodes in screen 7.10.
Run "mbfile check" and then "mbfile index". This fixes the Run "mbfile check" and then "mbfile index". This fixes the
@ -17,6 +24,9 @@ v0.61.4 11-Aug-2004
libnodelist.a: libnodelist.a:
Removed some debug logging. Removed some debug logging.
libdbase.a:
The files database is moved from ~/fdb to ~/var/fdb.
mbcico: mbcico:
Removed a little debug logging. Removed a little debug logging.
@ -85,6 +95,7 @@ v0.61.4 11-Aug-2004
screen, and added switches for BBBS uplinks. screen, and added switches for BBBS uplinks.
If the convert program is found and was not found before, the If the convert program is found and was not found before, the
defaults are set in menu 1.15.6. defaults are set in menu 1.15.6.
The files database is moved from ~/fdb to ~/var/fdb.
script: script:
In the editor script (that calls joe) made a fix for screens In the editor script (that calls joe) made a fix for screens

View File

@ -52,7 +52,6 @@ install:
fi fi
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/share/doc/html @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/share/doc/html
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/share/doc/tags @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/share/doc/tags
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/fdb
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/log @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/log
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/magic @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/magic
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0777 ${PREFIX}/sema @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0777 ${PREFIX}/sema
@ -97,6 +96,13 @@ install:
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/boxes @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/boxes
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/dosemu @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/dosemu
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/dosemu/c @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/dosemu/c
@if [ ! -d ${PREFIX}/var/fdb ] && [ -d ${PREFIX}/fdb ]; then \
echo "Migrate files database..." ; \
${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/fdb ; \
mv ${PREFIX}/fdb/file*.data ${PREFIX}/var/fdb ; \
echo "...done. You may remove ${PREFIX}/fdb" ; \
fi
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/fdb
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/hatch @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/hatch
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/inbound @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/inbound
@${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/mail @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/mail

View File

@ -50,7 +50,7 @@ struct _fdbarea *mbsedb_OpenFDB(long Area, int Timeout)
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
fdb_area = malloc(sizeof(struct _fdbarea)); /* Will be freed by CloseFDB */ fdb_area = malloc(sizeof(struct _fdbarea)); /* Will be freed by CloseFDB */
sprintf(temp, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), Area); sprintf(temp, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), Area);
/* /*
* Open the file database, if it's locked, just wait. * Open the file database, if it's locked, just wait.
@ -211,7 +211,7 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
*/ */
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
temp2 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET); fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
Insert = 0; Insert = 0;
do { do {
@ -300,12 +300,12 @@ int mbsedb_InsertFDB(struct _fdbarea *fdb_area, struct FILE_record frec, int Add
* we will give that a new name on disk. Then we move the temp in place. * we will give that a new name on disk. Then we move the temp in place.
* Finaly remove the old (still locked) original file. * Finaly remove the old (still locked) original file.
*/ */
sprintf(temp2, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp2, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
rc = rename(temp2, temp); rc = rename(temp2, temp);
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
rc = rename(temp, temp2); rc = rename(temp, temp2);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
rc = unlink(temp); rc = unlink(temp);
fdb_area->fp = fp; fdb_area->fp = fp;
@ -348,7 +348,7 @@ int mbsedb_PackFDB(struct _fdbarea *fdb_area)
*/ */
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
temp2 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
if ((fp = fopen(temp, "a+")) == NULL) { if ((fp = fopen(temp, "a+")) == NULL) {
WriteError("$Can't create %s", temp); WriteError("$Can't create %s", temp);
mbsedb_UnlockFDB(fdb_area); mbsedb_UnlockFDB(fdb_area);
@ -369,12 +369,12 @@ int mbsedb_PackFDB(struct _fdbarea *fdb_area)
* we will give that a new name on disk. Then we move the temp in place. * we will give that a new name on disk. Then we move the temp in place.
* Finaly remove the old (still locked) original file. * Finaly remove the old (still locked) original file.
*/ */
sprintf(temp2, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp2, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
rename(temp2, temp); rename(temp2, temp);
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
rename(temp, temp2); rename(temp, temp2);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
unlink(temp); unlink(temp);
fdb_area->fp = fp; fdb_area->fp = fp;
@ -497,7 +497,7 @@ int mbsedb_SortFDB(struct _fdbarea *fdb_area)
} }
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
if ((fp = fopen(temp, "a+")) == NULL) { if ((fp = fopen(temp, "a+")) == NULL) {
WriteError("$Can't create %s", temp); WriteError("$Can't create %s", temp);
mbsedb_UnlockFDB(fdb_area); mbsedb_UnlockFDB(fdb_area);
@ -522,12 +522,12 @@ int mbsedb_SortFDB(struct _fdbarea *fdb_area)
* Finaly remove the old (still locked) original file. * Finaly remove the old (still locked) original file.
*/ */
temp2 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char));
sprintf(temp2, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp2, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), fdb_area->area);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
rename(temp2, temp); rename(temp2, temp);
sprintf(temp, "%s/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.temp", getenv("MBSE_ROOT"), fdb_area->area);
rename(temp, temp2); rename(temp, temp2);
sprintf(temp, "%s/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area); sprintf(temp, "%s/var/fdb/file%ld.xxxx", getenv("MBSE_ROOT"), fdb_area->area);
unlink(temp); unlink(temp);
fdb_area->fp = fp; fdb_area->fp = fp;

View File

@ -118,7 +118,7 @@ void E_F(long areanr)
clr_index(); clr_index();
sprintf(temp, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), areanr); sprintf(temp, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), areanr);
if ((fil = fopen(temp, "r+")) == NULL) { if ((fil = fopen(temp, "r+")) == NULL) {
working(2, 0, 0); working(2, 0, 0);
return; return;
@ -374,12 +374,12 @@ void InitFDB(void)
while (fread(&area, areahdr.recsize, 1, fil)) { while (fread(&area, areahdr.recsize, 1, fil)) {
Area++; Area++;
if (area.Available) { if (area.Available) {
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), Area); sprintf(temp, "%s/var/fdb/fdb%ld.data", getenv("MBSE_ROOT"), Area);
if ((fp1 = fopen(temp, "r")) != NULL) { if ((fp1 = fopen(temp, "r")) != NULL) {
/* /*
* Old area available, upgrade. * Old area available, upgrade.
*/ */
sprintf(temp, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), Area); sprintf(temp, "%s/var/fdb/file%ld.data", getenv("MBSE_ROOT"), Area);
if ((fp2 = fopen(temp, "w+")) == NULL) { if ((fp2 = fopen(temp, "w+")) == NULL) {
WriteError("$Can't create %s", temp); WriteError("$Can't create %s", temp);
} else { } else {
@ -450,7 +450,7 @@ void InitFDB(void)
Syslog('+', "Upgraded file area database %d", Area); Syslog('+', "Upgraded file area database %d", Area);
} }
fclose(fp1); fclose(fp1);
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), Area); sprintf(temp, "%s/var/fdb/fdb%ld.data", getenv("MBSE_ROOT"), Area);
unlink(temp); unlink(temp);
} // Old area type upgrade. } // Old area type upgrade.