From eb1e9a6fe9921bf038f89a33a46d83b3007531ba Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 14 Sep 2004 20:37:57 +0000 Subject: [PATCH] Moved semafore directory to ~/var/sema --- ChangeLog | 16 ++++++++++++++-- Makefile | 4 +++- html/basic.html.in | 2 +- html/doors.html | 2 +- html/faq.html | 10 +++++----- html/misc/semafore.html | 4 ++-- mbsebbs/mbstat.c | 3 +-- mbsebbs/menu.c | 8 ++------ mbsetup/mbsetup.c | 4 ++-- mbtask/taskutil.c | 8 ++++---- script/init.Debian | 2 +- script/init.FreeBSD | 2 +- script/init.Gentoo | 2 +- script/init.NetBSD | 2 +- script/init.RedHat | 2 +- script/init.Slackware | 2 +- script/init.SuSE | 2 +- script/maint | 2 +- script/midnight | 2 +- script/monthly | 2 +- script/weekly | 2 +- 21 files changed, 46 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc61f276..5a09a888 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ v0.61.4 11-Aug-2004 change the setup of these nodes in screen 7.10. Run "mbfile check" and then "mbfile index". This fixes the thumbnails if supported by your system. + Update all maintenance scripts to change the semafore directory + to ~/var/sema. libmbse.a: The socket_connect function now sets the global nodenumber from @@ -85,6 +87,12 @@ v0.61.4 11-Aug-2004 count of tty line records so the used nodenumbers will be a lot lower then before. Changed Msg_Read from 78 to 79 characters. + In menu the semafore directory was scanned direct instead of + using the library functions. + + mbstat: + In the wait function the semafore directory was scanned direct + instead of using the library functions. mbnewusr: During program exit, it tried to remove the wrong socket to @@ -98,8 +106,9 @@ v0.61.4 11-Aug-2004 was on hold. The comm protocol reply to the AINI command now contains a fake node number. - The magic filenames directory is move from ~/magic to + The magic filenames directory is moved from ~/magic to ~/var/magic. + The semafore directory is moved from ~/sema to ~/var/sema. mbsetup: Changed nodes screens to have a separate uplink managers setup @@ -107,13 +116,16 @@ v0.61.4 11-Aug-2004 If the convert program is found and was not found before, the defaults are set in menu 1.15.6. The files database is moved from ~/fdb to ~/var/fdb. - The magic filenames directory is move from ~/magic to + The magic filenames directory is moved from ~/magic to ~/var/magic. + The semafore directory is moved from ~/sema to ~/var/sema. script: In the editor script (that calls joe) made a fix for screens wider then 80 characters. Also fixed the joe path if it should run in emacs mode. Added FromAddress in the header. + Changed all init and maint scripts to move the semafore + directory from ~/sema to ~/var/sema. v0.61.3 25-Jul-2004 - 11-Aug-2004 diff --git a/Makefile b/Makefile index 137130a2..2f6ae9c6 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,6 @@ install: @${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 0770 ${PREFIX}/log - @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0777 ${PREFIX}/sema @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/tmp @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/home @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/dutch @@ -117,6 +116,7 @@ install: @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/queue @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/rules @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0770 ${PREFIX}/var/run + @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0777 ${PREFIX}/var/sema @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/ticqueue @${INSTALL} -d -o ${OWNER} -g ${GROUP} -m 0750 ${PREFIX}/var/unknown @if [ -x ${BINDIR}/mbtelnetd ]; then \ @@ -128,6 +128,8 @@ install: echo; echo "If there is nothing important in ${PREFIX}/doc" ; \ echo "you may remove that obsolete directory." ; \ fi + @rm -rf ${PREFIX}/sema + dist tar: ${TARFILE} diff --git a/html/basic.html.in b/html/basic.html.in index 5eee3554..96e0ba27 100644 --- a/html/basic.html.in +++ b/html/basic.html.in @@ -62,7 +62,6 @@ layout looks like this:
/opt/mbse/italian/menus 0750 Italian menu files /opt/mbse/italian/txtfiles 0770 Italian ANSI files /opt/mbse/log 0770 MBSE BBS logfiles -/opt/mbse/sema 0777 Semafore files /opt/mbse/share/doc 0750 Generated sitedocs /opt/mbse/share/doc/html 0750 Generated html sitedocs /opt/mbse/share/doc/tags 0750 Generated area tags @@ -88,6 +87,7 @@ layout looks like this:
/opt/mbse/var/queue 0750 Queue for before outbound /opt/mbse/var/rules 0770 Echomail area rules files /opt/mbse/var/run 0770 Pid files of running programs +/opt/mbse/var/sema 0777 Semafore files /opt/mbse/var/ticqueue 0750 Queue for TIC files /opt/mbse/var/unknown 0750 Unprotected inbound directory diff --git a/html/doors.html b/html/doors.html index b787ae3a..69b514f7 100644 --- a/html/doors.html +++ b/html/doors.html @@ -174,7 +174,7 @@ something to send. For example like this:
 ln -s /opt/mbse/var/msgs /opt/mbse/var/dosemu/c/msgs
 ln -s /opt/mbse/var/boxes/node92_100_60 /opt/mbse/var/dosemu/c/outbox
-ln -s /opt/mbse/sema /opt/mbse/var/dosemu/c/sema
+ln -s /opt/mbse/var/sema /opt/mbse/var/dosemu/c/sema
 
In dos you now have:
diff --git a/html/faq.html b/html/faq.html
index 8d33061d..c04ddc9b 100644
--- a/html/faq.html
+++ b/html/faq.html
@@ -16,7 +16,7 @@
 
 

MBSE BBS FAQ and Howto.

-
Last updated 11-Aug-2004
+
Last updated 14-Sep-2004
 Authors: P.E. Kimble aka King Kimerud            kimerud@bayhaus.org
@@ -570,7 +570,7 @@ do
     i=60;
     while let 'i > 0' && let 'connect == 0'
     do
-        if [ -f $MBSE_ROOT/sema/is_inet ]; then
+        if [ -f $MBSE_ROOT/var/sema/is_inet ]; then
             connect=1
             echo "mbtask detected internet"     | $LOGGER
         fi
@@ -580,7 +580,7 @@ do
     #
     # Check if we have a connection
     #
-    if [ ! -f $MBSE_ROOT/sema/is_inet ]; then
+    if [ ! -f $MBSE_ROOT/var/sema/is_inet ]; then
         echo "Failed, 10 seconds pause ..."     | $LOGGER
         sleep 10
     fi
@@ -598,7 +598,7 @@ $MBSE_ROOT/bin/mbout poll f5003.n280.z2 f19.n280.z2 -quiet
 i=25;
 while let 'i > 0'
 do
-    if [ -f $MBSE_ROOT/sema/do_inet ]; then
+    if [ -f $MBSE_ROOT/var/sema/do_inet ]; then
         i=0;
     else
         let i=i-1;
@@ -614,7 +614,7 @@ done
 i=3600;
 while let 'i > 0'
 do
-    if [ ! -f $MBSE_ROOT/sema/do_inet ]; then
+    if [ ! -f $MBSE_ROOT/var/sema/do_inet ]; then
         i=0;
     else
         let i=i-1;
diff --git a/html/misc/semafore.html b/html/misc/semafore.html
index fda028c6..22d73e39 100644
--- a/html/misc/semafore.html
+++ b/html/misc/semafore.html
@@ -14,11 +14,11 @@
 
 
 
-
Last update 21-Feb-2002
+
Last update 14-Sep-2004

Semafore files with MBSE BBS.

-The directory $MBSE_ROOT/sema is the hardcoded semafore directory where all +The directory $MBSE_ROOT/var/sema is the hardcoded semafore directory where all semafore's must be created, tested and removed. When the system is booting, the init script will erase all semafore's just before the BBS is started. This description is valid from MBSE BBS v0.33.19 and newer. diff --git a/mbsebbs/mbstat.c b/mbsebbs/mbstat.c index e31b85db..39166ea5 100644 --- a/mbsebbs/mbstat.c +++ b/mbsebbs/mbstat.c @@ -246,8 +246,7 @@ int Wait(void) int Waiting = 3600; char buf[PATH_MAX]; - sprintf(buf, "%s/sema/upsdown", getenv("MBSE_ROOT")); - if (file_exist(buf, R_OK) == 0) + if (IsSema((char *)"upsdown")) Waiting = 30; Syslog('+', "Waiting for the BBS to become free, timeout %d seconds", Waiting); diff --git a/mbsebbs/menu.c b/mbsebbs/menu.c index 8b7466aa..ee262ccb 100644 --- a/mbsebbs/menu.c +++ b/mbsebbs/menu.c @@ -89,7 +89,7 @@ void menu() { FILE *pMenuFile; int iFoundKey = FALSE, Key, IsANSI; - char *Input, *Semfile, *sMenuPathFileName, buf[81]; + char *Input, *sMenuPathFileName, buf[81]; Input = calloc(PATH_MAX, sizeof(char)); sMenuPathFileName = calloc(PATH_MAX, sizeof(char)); @@ -175,17 +175,13 @@ void menu() /* * Check the upsdown semafore */ - Semfile = calloc(PATH_MAX, sizeof(char)); - sprintf(Semfile, "%s/sema/upsdown", getenv("MBSE_ROOT")); - if (file_exist(Semfile, R_OK) == 0) { + if (IsSema((char *)"upsdown")) { fclose(pMenuFile); Syslog('+', "Kicking user out, upsdown semafore detected"); printf("System power failure, closing the bbs\n\n"); - free(Semfile); sleep(3); Good_Bye(MBERR_OK); } - free(Semfile); /* * Check if SysOp wants to chat to user everytime user gets prompt. diff --git a/mbsetup/mbsetup.c b/mbsetup/mbsetup.c index 3b683634..f6a405df 100644 --- a/mbsetup/mbsetup.c +++ b/mbsetup/mbsetup.c @@ -125,8 +125,8 @@ static void die(int onsig) 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")); + fprintf(fp, "SEMAPHORE NETSCAN %s/var/sema/mailout\n", getenv("MBSE_ROOT")); + fprintf(fp, "SEMAPHORE ECHOSCAN %s/var/sema/mailout\n\n", getenv("MBSE_ROOT")); gold_areas(fp); } diff --git a/mbtask/taskutil.c b/mbtask/taskutil.c index bfb3d697..ea840e61 100644 --- a/mbtask/taskutil.c +++ b/mbtask/taskutil.c @@ -265,7 +265,7 @@ void CreateSema(char *sem) char temp[PATH_MAX]; int fd; - sprintf(temp, "%s/sema/%s", getenv("MBSE_ROOT"), sem); + sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); if (access(temp, F_OK) == 0) return; if ((fd = open(temp, O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) >= 0) @@ -281,7 +281,7 @@ void TouchSema(char *sem) char temp[PATH_MAX]; int fd; - sprintf(temp, "%s/sema/%s", getenv("MBSE_ROOT"), sem); + sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); if ((fd = open(temp, O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) >= 0) { close(fd); } else @@ -294,7 +294,7 @@ void RemoveSema(char *sem) { char temp[PATH_MAX]; - sprintf(temp, "%s/sema/%s", getenv("MBSE_ROOT"), sem); + sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); if (access(temp, F_OK)) return; if (unlink(temp) == -1) @@ -307,7 +307,7 @@ int IsSema(char *sem) { char temp[PATH_MAX]; - sprintf(temp, "%s/sema/%s", getenv("MBSE_ROOT"), sem); + sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem); return (access(temp, F_OK) == 0); } diff --git a/script/init.Debian b/script/init.Debian index 9ca0d05a..970d00f2 100644 --- a/script/init.Debian +++ b/script/init.Debian @@ -32,7 +32,7 @@ case "$1" in start) echo -n "Starting $DESC: " rm -f $MBSE_ROOT/var/run/* - rm -f $MBSE_ROOT/sema/* + rm -f $MBSE_ROOT/var/sema/* rm -f $MBSE_ROOT/var/*.LCK rm -f $MBSE_ROOT/tmp/mb* su mbse -c '$MBSE_ROOT/bin/mbtask' >/dev/null diff --git a/script/init.FreeBSD b/script/init.FreeBSD index 0b19266b..f08c7793 100644 --- a/script/init.FreeBSD +++ b/script/init.FreeBSD @@ -28,7 +28,7 @@ export MBSE_ROOT case "$1" in start) rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null diff --git a/script/init.Gentoo b/script/init.Gentoo index e27a7a05..c7450378 100644 --- a/script/init.Gentoo +++ b/script/init.Gentoo @@ -35,7 +35,7 @@ start() { ebegin "Starting mbse" rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null diff --git a/script/init.NetBSD b/script/init.NetBSD index 96b96720..ab5289d3 100644 --- a/script/init.NetBSD +++ b/script/init.NetBSD @@ -40,7 +40,7 @@ mbsebbs_start() export MBSE_ROOT rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null 2>&1 diff --git a/script/init.RedHat b/script/init.RedHat index 5e986a02..fba3e129 100644 --- a/script/init.RedHat +++ b/script/init.RedHat @@ -39,7 +39,7 @@ case "$1" in start) echo -n "Starting MBSE BBS: " rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su - mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null diff --git a/script/init.Slackware b/script/init.Slackware index 65b005a1..a95ed10c 100644 --- a/script/init.Slackware +++ b/script/init.Slackware @@ -29,7 +29,7 @@ case "$1" in start) echo -n "MBSE BBS starting:" rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null diff --git a/script/init.SuSE b/script/init.SuSE index 1709ea64..af05edc9 100644 --- a/script/init.SuSE +++ b/script/init.SuSE @@ -32,7 +32,7 @@ case "$1" in start) echo -n "MBSE BBS starting:" rm -f ${MBSE_ROOT}/var/run/* - rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/sema/* rm -f ${MBSE_ROOT}/var/*.LCK rm -f ${MBSE_ROOT}/tmp/mb* su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null diff --git a/script/maint b/script/maint index 18e15ae3..31225e75 100644 --- a/script/maint +++ b/script/maint @@ -14,7 +14,7 @@ fi # Don't do maintenance if running on UPS battery power. # -if [ -f $MBSE_ROOT/sema/upsalarm ]; then +if [ -f $MBSE_ROOT/var/sema/upsalarm ]; then exit 0 fi diff --git a/script/midnight b/script/midnight index 93cd9c6e..ac5257a8 100644 --- a/script/midnight +++ b/script/midnight @@ -14,7 +14,7 @@ fi # While the system is on UPS battery power, don't start maintenance # -while [ -f $MBSE_ROOT/sema/upsalarm ]; do +while [ -f $MBSE_ROOT/var/sema/upsalarm ]; do sleep 60 done diff --git a/script/monthly b/script/monthly index 2da30385..738f1710 100644 --- a/script/monthly +++ b/script/monthly @@ -14,6 +14,6 @@ fi # While the system is on UPS battery power, don't start maintenance # -while [ -f $MBSE_ROOT/sema/upsalarm ]; do +while [ -f $MBSE_ROOT/var/sema/upsalarm ]; do sleep 60 done diff --git a/script/weekly b/script/weekly index a1ea6f12..b2ec3e43 100644 --- a/script/weekly +++ b/script/weekly @@ -14,7 +14,7 @@ fi # While the system is on UPS battery power, don't start maintenance # -while [ -f $MBSE_ROOT/sema/upsalarm ]; do +while [ -f $MBSE_ROOT/var/sema/upsalarm ]; do sleep 60 done