From f3b74ad244b36e5bf66741c4127885c92fffde37 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 19 Dec 2003 22:29:25 +0000 Subject: [PATCH] Dropped support for Slackware pre 7.0 and changed NetBSD startup --- ChangeLog | 6 ++ TODO | 4 + script/init.NetBSD | 111 ++++++++++++++++++++++++ script/installinit.sh | 196 ++++++++++++------------------------------ script/mbse.start | 33 ------- script/mbse.stop | 40 --------- script/rc | 15 ---- script/rc.shutdown | 14 --- 8 files changed, 175 insertions(+), 244 deletions(-) create mode 100644 script/init.NetBSD delete mode 100644 script/mbse.start delete mode 100644 script/mbse.stop delete mode 100644 script/rc delete mode 100644 script/rc.shutdown diff --git a/ChangeLog b/ChangeLog index 5a3b2fa9..536ce428 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ v0.39.4 08-Dec-2003 Added French language file created by Francois Thunus. This translation is not yet complete. Cleanup in main makefile, added help. + Revised configure and all Makefiles for better support of + linking with threads libraries. upgrade: If you didn't change anything of the language defaults then @@ -25,6 +27,10 @@ v0.39.4 08-Dec-2003 mbsetup: Added default record for french language. + script: + Dropped support for Slackware pre 7.0. + Changed startup scripts for NetBSD. + v0.39.3 26-Nov-2003 - 08-Dec-2003. diff --git a/TODO b/TODO index 61ea5e20..4a7df398 100644 --- a/TODO +++ b/TODO @@ -113,6 +113,10 @@ mbfido: N: After readalias we need to free the alias list when mbfido ends. + N: When a file with the same name is received in a tic area more than + once (virus defs for example) the file is written multiple times + in the toberep database and will be multiple times announced. + mbcico: N: Upgrade binkp protocol to 1.1. diff --git a/script/init.NetBSD b/script/init.NetBSD new file mode 100644 index 00000000..443319af --- /dev/null +++ b/script/init.NetBSD @@ -0,0 +1,111 @@ +#!/bin/sh +# +# $Id$ +# + +# PROVIDE: mbsebbs +# REQUIRE: root beforenetlkm mountcritlocal tty + +# it does not really require beforenetlkm. + +. /etc/rc.subr + +name="mbsebbs" +rcvar=$name +start_cmd="mbsebbs_start" +stop_cmd="mbsebbs_stop" +reload_cmd="mbsebbs_reload" +extra_commands="reload" + + +mbsebbs_start() +{ + echo -n "Starting mbsebbs:" + + # Find the MBSE_ROOT from the /etc/passwd file. + MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` + + if [ "${MBSE_ROOT}" = "" ] + then + echo " no 'mbse' user in the password file." + return + fi + + if [ ! -d ${MBSE_ROOT} ] + then + echo " home directory '${MBSE_ROOT}' not found." + return + fi + + export MBSE_ROOT + + if [ ! -f ${MBSE_ROOT}/var/run/mbtask ]; then + rm -f ${MBSE_ROOT}/sema/* + rm -f ${MBSE_ROOT}/var/*.LCK + rm -f ${MBSE_ROOT}/tmp/mb* + su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null + echo -n " mbtask" + sleep 2 + if [ -f ${MBSE_ROOT}/etc/config.data ]; then + su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet' + echo -n ", opened bbs" + fi + else + echo " is already running" + fi +} + +mbsebbs_stop() +{ + echo -n "Stopping mbsebbs:" + + # Find the MBSE_ROOT from the /etc/passwd file. + MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` + + if [ "${MBSE_ROOT}" = "" ]; then + echo " no 'mbse' user in the password file." + return + fi + + if [ ! -d ${MBSE_ROOT} ] + then + echo " home directory '${MBSE_ROOT}' not found." + return + fi + + export MBSE_ROOT + + if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then + echo -n " logoff users" + su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null + kill -15 `cat ${MBSE_ROOT}/var/run/mbtask` + sleep 1 + if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then + echo -n "." + sleep 1 + fi + if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then + echo -n "." + sleep 1 + fi + if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then + echo -n "." + sleep 1 + fi + if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then + kill -9 `cat ${MBSE_ROOT}/var/run/mbtask` + fi + echo " done" + else + echo " was not running" + fi +} + +mbsebbs_reload() +{ + mbsebbs_start + mbsebbs_stop +} + +load_rc_config $name +run_rc_command "$1" diff --git a/script/installinit.sh b/script/installinit.sh index e3938101..3a806fe3 100644 --- a/script/installinit.sh +++ b/script/installinit.sh @@ -20,31 +20,6 @@ log() { -# Check one subdirectory -# -checkdir() { - if [ ! -d $1 ]; then - mkdir $1 - log "+" "[$?] created directory $1" - fi -} - - - -# Check /etc/rc.d subdirs -# -checkrcdir() { - checkdir "/etc/rc.d/init.d" - checkdir "/etc/rc.d/rc0.d" - checkdir "/etc/rc.d/rc1.d" - checkdir "/etc/rc.d/rc2.d" - checkdir "/etc/rc.d/rc3.d" - checkdir "/etc/rc.d/rc4.d" - checkdir "/etc/rc.d/rc5.d" - checkdir "/etc/rc.d/rc6.d" -} - - #------------------------------------------------------------------------ # @@ -103,26 +78,20 @@ if [ "$OSTYPE" = "Linux" ]; then DISTVERS=`cat /etc/redhat-release | awk '{ print $13 }' | tr -d \)` fi else - if [ -f /etc/rc.d/rc.0 ] && [ -f /etc/rc.d/rc.local ]; then - # If Slackware wasn't detected yet it is version 4.0 or older. - DISTNAME="Slackware" - DISTVERS="Old" - else - if [ -f /etc/gentoo-release ]; then - DISTNAME="Gentoo" - DISTVERS=`cat /etc/gentoo-release | awk '{ print $5 }'` - else - DISTNAME="Unknown" - log "!" "unknown distribution, collecting data" - log "-" "`uname -a`" - log "-" "`ls -la /etc`" - echo "Failed to install bootscripts, unknown Linux distribution." - echo "Please mail the file `pwd`/script/installinit.log to mbroek@users.sourceforge.net" - echo "or send it as file attach to Michiel Broek at 2:280/2802@Fidonet." - echo "Add information about the distribution you use in the message." - exit 1; - fi - fi + if [ -f /etc/gentoo-release ]; then + DISTNAME="Gentoo" + DISTVERS=`cat /etc/gentoo-release | awk '{ print $5 }'` + else + DISTNAME="Unknown" + log "!" "unknown distribution, collecting data" + log "-" "`uname -a`" + log "-" "`ls -la /etc`" + echo "Failed to install bootscripts, unknown Linux distribution." + echo "Please mail the file `pwd`/script/installinit.log to mbroek@users.sourceforge.net" + echo "or send it as file attach to Michiel Broek at 2:280/2802@Fidonet." + echo "Add information about the distribution you use in the message." + exit 1; + fi fi fi fi @@ -179,74 +148,43 @@ fi # Adding scripts for Slackware # if [ "$DISTNAME" = "Slackware" ]; then - if [ "$DISTVERS" = "Old" ] || [ "$DISTVERS" = "7.0.0" ]; then - # - # Slackware before version 7.1 - # - DISTINIT="$MBSE_ROOT/etc/rc" - echo "Adding old style Slackware MBSE BBS start/stop scripts" - log "+" "Adding old style Slackware MBSE BBS start/stop scripts" - if [ "`grep MBSE /etc/rc.d/rc.local`" = "" ]; then - log "+" "Adding $MBSE_ROOT/etc/rc to /etc/rc.d/rc.local" - mv /etc/rc.d/rc.local /etc/rc.d/rc.local.mbse - cat /etc/rc.d/rc.local.mbse >/etc/rc.d/rc.local - echo "# Start MBSE BBS" >>/etc/rc.d/rc.local - echo "$MBSE_ROOT/etc/rc" >>/etc/rc.d/rc.local - chmod 755 /etc/rc.d/rc.local - echo " Added $MBSE_ROOT/etc/rc to /etc/rc.d/rc.local" - echo " /etc/rc.d/rc.local.mbse is a backup file." - echo "" - echo " You must manualy insert the lines '$MBSE_ROOT/etc/rc.shutdown'" - echo " into /etc/rc.d/rc.0 and /etc/rc.d/rc.K If you don't do it" - echo " everything will work also, but MBSE BBS isn't proper closed" - echo " if you halt or reboot your system." - fi - cp mbse.start $MBSE_ROOT/bin - cp mbse.stop $MBSE_ROOT/bin - cp rc $MBSE_ROOT/etc - cp rc.shutdown $MBSE_ROOT/etc - chown mbse.bbs $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop - chmod 755 $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop - chown root.root $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown - chmod 744 $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown + mkdir -p /etc/rc.d/init.d + DISTINIT="/etc/rc.d/init.d/mbsed" + echo "Adding SystemV Slackware $DISTVERS MBSE BBS start/stop scripts" + log "+" "Adding SystemV Slackware $DISTVERS MBSE BBS start/stop scripts" + cp init.Slackware $DISTINIT + chmod 755 $DISTINIT + if [ -f $MBSE_ROOT/bin/mbse.start ]; then + echo "Removing old startup scripts" + rm $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown + fi + if [ -d /var/log/setup ]; then + cp setup.mbse /var/log/setup + chmod 755 /var/log/setup/setup.mbse + echo "Added setup script, as root use 'pkgtool' Setup to enable MBSE at boot" + log "+" "Added Slackware setup script for use with pkgtool" else - DISTINIT="/etc/rc.d/init.d/mbsed" - echo "Adding SystemV Slackware $DISTVERS MBSE BBS start/stop scripts" - log "+" "Adding SystemV Slackware $DISTVERS MBSE BBS start/stop scripts" - checkrcdir - cp init.Slackware $DISTINIT - chmod 755 $DISTINIT - if [ -f $MBSE_ROOT/bin/mbse.start ]; then - echo "Removing old startup scripts" - rm $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown - fi - if [ -d /var/log/setup ]; then - cp setup.mbse /var/log/setup - chmod 755 /var/log/setup/setup.mbse - echo "Added setup script, as root use 'pkgtool' Setup to enable MBSE at boot" - log "+" "Added Slackware setup script for use with pkgtool" - else - echo "Making links for start/stop in runlevel 3" - if [ -f /etc/rc.d/rc3.d/K05mbsed ]; then - rm /etc/rc.d/rc3.d/K05mbsed - fi - ln -s ../init.d/mbsed /etc/rc.d/rc3.d/K05mbsed - if [ -f /etc/rc.d/rc3.d/S95mbsed ]; then - rm /etc/rc.d/rc3.d/S95mbsed - fi - ln -s ../init.d/mbsed /etc/rc.d/rc3.d/S95mbsed - echo "Making links for start/stop in runlevel 4" - if [ -f /etc/rc.d/rc4.d/K05mbsed ]; then - rm /etc/rc.d/rc4.d/K05mbsed - fi - ln -s ../init.d/mbsed /etc/rc.d/rc4.d/K05mbsed - if [ -f /etc/rc.d/rc4.d/S95mbsed ]; then - rm /etc/rc.d/rc4.d/S95mbsed - fi - ln -s ../init.d/mbsed /etc/rc.d/rc4.d/S95mbsed - echo "Slackware SystemV init configured" - log "+" "Slackware SystemV init configured" + echo "Making links for start/stop in runlevel 3" + mkdir -p /etc/rc.d/rc3.d /etc/rc.d/rc4.d + if [ -f /etc/rc.d/rc3.d/K05mbsed ]; then + rm /etc/rc.d/rc3.d/K05mbsed fi + ln -s ../init.d/mbsed /etc/rc.d/rc3.d/K05mbsed + if [ -f /etc/rc.d/rc3.d/S95mbsed ]; then + rm /etc/rc.d/rc3.d/S95mbsed + fi + ln -s ../init.d/mbsed /etc/rc.d/rc3.d/S95mbsed + echo "Making links for start/stop in runlevel 4" + if [ -f /etc/rc.d/rc4.d/K05mbsed ]; then + rm /etc/rc.d/rc4.d/K05mbsed + fi + ln -s ../init.d/mbsed /etc/rc.d/rc4.d/K05mbsed + if [ -f /etc/rc.d/rc4.d/S95mbsed ]; then + rm /etc/rc.d/rc4.d/S95mbsed + fi + ln -s ../init.d/mbsed /etc/rc.d/rc4.d/S95mbsed + echo "Slackware SystemV init configured" + log "+" "Slackware SystemV init configured" fi fi @@ -352,37 +290,11 @@ if [ "$DISTNAME" = "NetBSD" ]; then # # NetBSD init # - DISTINIT="$MBSE_ROOT/etc/rc" - echo "Adding $DISTNAME style MBSE BBS start/stop scripts" - log "+" "Adding $DISTNAME style MBSE BBS start/stop scripts" - if [ -f /etc/rc.local ]; then - if [ "`grep MBSE /etc/rc.local`" = "" ]; then - log "+" "Adding $MBSE_ROOT/etc/rc to existing /etc/rc.local" - mv /etc/rc.local /etc/rc.local.mbse - cat /etc/rc.local.mbse >/etc/rc.local - echo "# Start MBSE BBS" >>/etc/rc.local - echo "$MBSE_ROOT/etc/rc" >>/etc/rc.local - chmod 644 /etc/rc.local - echo " Added $MBSE_ROOT/etc/rc to /etc/rc.local" - echo " /etc/rc.local.mbse is a backup file." - echo "" - fi - else - log "+" "Adding $MBSE_ROOT/etc/rc to new /etc/rc.local" - echo "# Start MBSE BBS" >/etc/rc.local - echo "$MBSE_ROOT/etc/rc" >>/etc/rc.local - chmod 644 /etc/rc.local - echo " Added $MBSE_ROOT/etc/rc to /etc/rc.local" - echo "" - fi - cp mbse.start $MBSE_ROOT/bin - cp mbse.stop $MBSE_ROOT/bin - cp rc $MBSE_ROOT/etc - cp rc.shutdown $MBSE_ROOT/etc - chown mbse.bbs $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop - chmod 755 $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop - chown `id -un`.`id -gn` $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown - chmod 744 $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown + DISTINIT="/etc/rc.d/mbsebbs" + echo "Adding $DISTNAME style MBSE BBS start/stop script" + log "+" "Adding $DISTNAME style MBSE BBS start/stop script" + cp init.NetBSD $DISTINIT + chmod 0755 $DISTINIT fi diff --git a/script/mbse.start b/script/mbse.start deleted file mode 100644 index 6e3399cf..00000000 --- a/script/mbse.start +++ /dev/null @@ -1,33 +0,0 @@ -# -# BBS Startup script, should be run as BBS owner. -# Note: This is only used on Slackware systems until 7.0.0 and NetBSD. -# -# $Id$ -# - -if [ "$MBSE_ROOT" = "" ]; then - export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` -fi - - -# If installed, start the BBS. -# -if [ -f $MBSE_ROOT/bin/mbtask ]; then - echo -n "Starting MBSE BBS: " - rm -f $MBSE_ROOT/sema/* - rm -f $MBSE_ROOT/var/*.LCK - rm -f $MBSE_ROOT/tmp/mb* - cd $MBSE_ROOT - $MBSE_ROOT/bin/mbtask >/dev/null - echo -n "mbtask " - sleep 2 - if [ -f $MBSE_ROOT/etc/config.data ]; then - $MBSE_ROOT/bin/mbstat open -quiet - echo -n "opened " - fi - echo "done" -else - echo "mbtask not available!" - exit 1 -fi - diff --git a/script/mbse.stop b/script/mbse.stop deleted file mode 100644 index 56797589..00000000 --- a/script/mbse.stop +++ /dev/null @@ -1,40 +0,0 @@ -# -# BBS Shutdown script, should be run as BBS owner. -# Note: this is only used on old Slackware and NetBSD systems. -# -# On FreeBSD it needs the psmisc package. -# -# $Id$ -# - -export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:$MBSE_ROOT/bin:" - - -if [ "$MBSE_ROOT" = "" ]; then - export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` -fi - - -if [ -f $MBSE_ROOT/bin/mbtask ]; then - echo -n "Shutdown MBSE BBS: " - if [ -f $MBSE_ROOT/etc/config.data ]; then - echo -n "closing the bbs " - cd $MBSE_ROOT - $MBSE_ROOT/bin/mbstat close wait -quiet - echo -n "done, " - fi - # Now kill the daemons - echo -n "kill " - base=`basename mbtask` - pid=`pidof $base` - echo -n "mbtask " - if ps h $pid >/dev/null 2>&1; then - kill $pid - RC=$? - [ $RC -eq 0 ] && echo -n "ok " || echo -n "failed " - fi - echo "" -else - echo "mbtask not available!" -fi -# diff --git a/script/rc b/script/rc deleted file mode 100644 index d849d06e..00000000 --- a/script/rc +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# $MBSE_ROOT/etc/rc: BBS Startup script for old Slackware and NetBSD -# -# $Id$ - -# Remove stale tempfiles from cron. -rm -f /tmp/cron.mbse.* - -if [ "$MBSE_ROOT" = "" ]; then - export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` -fi - -su - mbse -c $MBSE_ROOT/bin/mbse.start - diff --git a/script/rc.shutdown b/script/rc.shutdown deleted file mode 100644 index a5f36c5e..00000000 --- a/script/rc.shutdown +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# -# /opt/mbse/etc/rc.shutdown: BBS Shutdown script for Slackware and NetBSD. -# -# $Id$ - -if [ "$MBSE_ROOT" = "" ]; then - export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'` -fi - - -su mbse -c $MBSE_ROOT/bin/mbse.stop -sleep 2 -#