Initial revision

This commit is contained in:
Ken Bowley
2001-08-17 05:46:24 +00:00
commit 40420d900a
750 changed files with 177485 additions and 0 deletions

29
script/Makefile.am Normal file
View File

@@ -0,0 +1,29 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = .
install-exec-local:
@if [ "$(shell whoami)" != "root" ] ; then \
echo; echo " Must be root to install!"; echo; exit 3; \
fi
@if [ ! -x $(sysconfdir)/maint ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 maint $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 maint $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/midnight ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 midnight $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 midnight $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/weekly ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 weekly $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 weekly $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/monthly ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 monthly $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 monthly $(sysconfdir)" ; \
fi
@./installinit
EXTRA_DIST = README maint midnight weekly monthly installinit rc rc.shutdown mbse.start mbse.stop

306
script/Makefile.in Normal file
View File

@@ -0,0 +1,306 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
AWK = @AWK@
CC = @CC@
COMPRESS = @COMPRESS@
GROUP = @GROUP@
GZIP = @GZIP@
LEX = @LEX@
LOG_COMPRESS = @LOG_COMPRESS@
LOG_COMPRESSEXT = @LOG_COMPRESSEXT@
MAKEINFO = @MAKEINFO@
OWNER = @OWNER@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
YACC = @YACC@
SUBDIRS = .
EXTRA_DIST = README maint midnight weekly monthly installinit rc rc.shutdown mbse.start mbse.stop
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = README Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps script/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = script
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
info-am:
info: info-recursive
dvi-am:
dvi: dvi-recursive
check-am: all-am
check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
install-exec-am: install-exec-local
install-exec: install-exec-recursive
install-data-am:
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am:
uninstall: uninstall-recursive
all-am: Makefile
all-redirect: all-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-tags clean-generic mostlyclean-am
clean: clean-recursive
distclean-am: distclean-tags distclean-generic clean-am
distclean: distclean-recursive
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-recursive
.PHONY: install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck \
install-exec-local install-exec-am install-exec install-data-am \
install-data install-am install uninstall-am uninstall all-redirect \
all-am all installdirs-am installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
install-exec-local:
@if [ "$(shell whoami)" != "root" ] ; then \
echo; echo " Must be root to install!"; echo; exit 3; \
fi
@if [ ! -x $(sysconfdir)/maint ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 maint $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 maint $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/midnight ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 midnight $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 midnight $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/weekly ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 weekly $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 weekly $(sysconfdir)" ; \
fi
@if [ ! -x $(sysconfdir)/monthly ]; then \
$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 monthly $(sysconfdir) ; \
echo "$(INSTALL) -o @OWNER@ -g @GROUP@ -m 0711 monthly $(sysconfdir)" ; \
fi
@./installinit
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

7
script/README Normal file
View File

@@ -0,0 +1,7 @@
MBSE BBS Script files.
If you want to make any changes to the scripts, do it here and not in the
~/etc and ~/bin directories. After making the changes do a 'make install'
as root and the scripts are in place with the right permissions and owners.
Michiel

556
script/installinit Executable file
View File

@@ -0,0 +1,556 @@
#!/bin/sh
#
# Installation script to install bootscripts.
#
# (C) Michiel Broek, v0.21 27-May-2001
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:$MBSE_ROOT/bin
DISTNAME=
DISTVERS=
DISTINIT=
SU="su"
#------------------------------------------------------------------------
#
# Logging procedure, needs two parameters.
#
log() {
/bin/echo `date +%d-%b-%y\ %X ` $1 $2 >> installinit.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"
}
#------------------------------------------------------------------------
#
log "+" "installinit started"
# Basic checks.
if [ `whoami` != "root" ]; then
cat << EOF
*** Run $0 as root only! ***
Because some of the system files must be changed, you must be root
to use this script.
*** SETUP aborted ***
EOF
log "!" "Aborted, not root"
exit 2
fi
if [ "$MBSE_ROOT" = "" ]; then
echo "*** The MBSE_ROOT doesn't exist ***"
log "!" "Aborted, MBSE_ROOT variable doesn't exist"
exit 2
fi
# First do various tests to see which Linux distribution this is.
#
if [ -f /etc/slackware-version ]; then
# Slackware 7.0 and later
DISTNAME="Slackware"
DISTVERS=`cat /etc/slackware-version`
else
if [ -f /etc/debian_version ]; then
# Debian, at least since version 2.2
DISTNAME="Debian"
DISTVERS=`cat /etc/debian_version`
else
if [ -f /etc/SuSE-release ]; then
DISTNAME="SuSE"
DISTVERS=`cat /etc/SuSE-release | grep VERSION | awk '{ print $3 }'`
else
if [ -f /etc/redhat-release ]; then
DISTNAME="RedHat"
DISTVERS=`cat /etc/redhat-release | awk '{ print $5 }'`
else
if [ -f /etc/mandrake-release ]; then
DISTNAME="Mandrake"
# Format: Linux Mandrake release 8.0 (Cooker) for i586
DISTVERS=`cat /etc/mandrake-release | awk '{ print $4 }'`
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
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
fi
fi
log "+" "Distribution $DISTNAME $DISTVERS"
#--------------------------------------------------------------------------
#
# Adding scripts for SuSE
#
if [ "$DISTNAME" = "SuSE" ]; then
DISTINIT="/sbin/init.d/mbsed"
echo "Installing SystemV init scripts for SuSE"
log "+" "Installing SystemV init scripts for SuSE"
echo "Adding $DISTINIT"
cat << EOF >$DISTINIT
#!/bin/bash
# Copyright (c) 2001 Michiel Broek
#
# Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001
#
# $DISTINIT for SuSE
#
# 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 "MBSE BBS: No 'mbse' user in the password file."
exit 1
fi
if [ ! -d \$MBSE_ROOT ]
then
echo "MBSE BBS: Home directory '\$MBSE_ROOT' not found."
exit 1
fi
export MBSE_ROOT
case "\$1" in
start|reload)
echo -n "MBSE BBS starting:"
rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n " mbtask"
if [ -f \$MBSE_ROOT/etc/config.data ]; then
$SU mbse -c '\$MBSE_ROOT/bin/mbstat open -quiet'
echo " and opened the bbs."
else
echo ""
fi
;;
stop)
echo -n "MBSE BBS shutdown:"
if [ -f \$MBSE_ROOT/etc/config.data ]; then
echo -n " logoff users "
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
echo -n "done,"
fi
echo -n " stopping mbtask "
killproc \$MBSE_ROOT/bin/mbtask -15
echo "done."
;;
restart)
echo "Restarting MBSE BBS: just kidding!"
;;
status)
echo -n "MBSE BBS status: "
if [ "\`/sbin/pidof mbtask\`" = "" ]; then
echo "mbtask is NOT running"
else
echo "mbtask Ok"
fi
;;
*)
echo "Usage: \$0 {start|stop|status|reload|restart}"
exit 1
esac
exit 0
EOF
chmod 755 /etc/rc.d/init.d/mbsed
echo "Making links for start/stop in runlevel 2"
ln -s ../mbsed /sbin/init.d/rc2.d/K05mbsed
ln -s ../mbsed /sbin/init.d/rc2.d/S99mbsed
echo "Making links for start/stop in runlevel 3"
ln -s ../mbsed /sbin/init.d/rc3.d/K05mbsed
ln -s ../mbsed /sbin/init.d/rc3.d/S99mbsed
echo "SuSE SystemV init configured"
log "+" "SuSE SystemV init configured"
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
else
DISTINIT="/etc/rc.d/init.d/mbsed"
echo "Adding SystemV Slackware MBSE BBS start/stop scripts"
log "+" "Adding SystemV Slackware MBSE BBS start/stop scripts"
checkrcdir
cat << EOF >$DISTINIT
#!/bin/sh
#
# Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001
#
# $DISTINIT for Slackware
#
# 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 "MBSE BBS: No 'mbse' user in the password file."
exit 1
fi
if [ ! -d \$MBSE_ROOT ]
then
echo "MBSE BBS: Home directory '\$MBSE_ROOT' not found."
exit 1
fi
export MBSE_ROOT
# See how we were called.
case "\$1" in
start)
echo -n "MBSE BBS starting:"
rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n " mbtask"
if [ -f \$MBSE_ROOT/etc/config.data ]; then
$SU mbse -c '\$MBSE_ROOT/bin/mbstat open -quiet'
echo " and opened the bbs."
fi
;;
stop)
echo -n "MBSE BBS shutdown:"
if [ -f \$MBSE_ROOT/etc/config.data ]; then
echo -n " logoff users "
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
echo -n "done,"
fi
echo -n " stopping mbtask "
kill -15 \`pidof \$MBSE_ROOT/bin/mbtask\`
echo "done."
;;
status)
echo -n "MBSE BBS status: "
if [ "\`/sbin/pidof mbtask\`" = "" ]; then
echo "mbtask is NOT running"
else
echo "mbtask Ok"
fi
;;
restart)
echo "Restarting MBSE BBS: just kidding!"
;;
*)
echo "Usage: mbsed {start|stop|restart|status}"
exit 1
esac
exit 0
EOF
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
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"
fi
fi
#--------------------------------------------------------------------------
#
# Adding scripts for RedHat and Mandrake
# FIXME: some details unknown about Mandrake
#
if [ "$DISTNAME" = "RedHat" ] || [ "$DISTNAME" = "Mandrake" ]; then
log "+" "Adding RedHat/Mandrake SystemV init scripts"
DISTINIT="/etc/rc.d/init.d/mbsed"
SU="su"
#
# From RedHat version 6.1 and up the behaviour of "su" has changed.
# For Mandrake we follow the same behaviour.
#
if [ -f /etc/redhat-release ]; then
RHR=`cat /etc/redhat-release | awk '{ print $5 }' | tr -d .`
if [ $RHR -gt 60 ]; then
echo "You are running RedHat v6.1 or newer"
SU="su -"
else
echo "You are running RedHat v6.0 or older"
fi
else
if [ -f /etc/mandrake-release ]; then
RHR=`cat /etc/mandrake-release | awk '{ print $4 }' | tr -d .`
if [ $RHR -gt 60 ]; then
echo "You are running Mandrake v6.1 or newer"
SU="su -"
else
echo "You are running Mandrake v6.0 or older"
fi
else
echo "You are in big trouble."
fi
fi
echo "Adding startup file $DISTINIT"
cat << EOF >$DISTINIT
#!/bin/sh
#
# chkconfig: 345 99 05
# description: Starts and stops MBSE BBS.
#
# For RedHat and Mandrake SYSV init style.
# 23-May-2001 M. Broek
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ \${NETWORKING} = "no" ] && exit 1
# 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 "MBSE BBS: No 'mbse' user in the password file."
exit 1
fi
if [ ! -d \$MBSE_ROOT ]
then
echo "MBSE BBS: Home directory '\$MBSE_ROOT' not found."
exit 1
fi
export MBSE_ROOT
# See how we were called.
case "\$1" in
start)
echo -n "Starting MBSE BBS: "
rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n "mbtask "
if [ -f \$MBSE_ROOT/etc/config.data ]; then
$SU mbse -c '\$MBSE_ROOT/bin/mbstat open -quiet'
echo "opened"
fi
touch /var/lock/subsys/mbsed
;;
stop)
echo -n "Shutting down MBSE BBS: "
if [ -f \$MBSE_ROOT/etc/config.data ]; then
echo -n "logoff users "
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
echo -n "done, "
fi
echo -n "stop mbtask: "
killproc mbtask -15
rm -f /var/lock/subsys/mbsed
echo "done."
;;
status)
status mbsed
;;
restart)
echo "Restarting MBSE BBS: just kidding!"
;;
*)
echo "Usage: mbsed {start|stop|restart|status}"
exit 1
esac
exit 0
EOF
chmod 755 $DISTINIT
echo "With the runlevel editor, 'tksysv' if you are running X,"
echo "or 'ntsysv' if you are running virtual consoles, you must"
echo "now add 'mbsed' start to the default runlevel, and 'mbsed'"
echo "stop to runlevels 0 and 6"
fi
#--------------------------------------------------------------------------
#
# Adding scripts for Debian
#
#
if [ "$DISTNAME" = "Debian" ]; then
echo "You are running Debian Linux $DISTVERS"
log "+" "Adding Debian SystemV init script"
DISTINIT="/etc/init.d/mbsebbs"
cat << EOF >$DISTINIT
#!/bin/sh
#
# Note: this is not 100% Debian style, at least it works for now.
# 23-May-2001 Michiel Broek.
#
# description: Starts and stops the MBSE BBS.
# For Debian SYSV init style.
# 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 "MBSE BBS: No 'mbse' user in the password file."
exit 1
fi
if [ ! -d \$MBSE_ROOT ]; then
echo "MBSE BBS: Home directory '\$MBSE_ROOT' not found."
exit 1
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin:\$MBSE_ROOT/bin
DAEMON=\$MBSE_ROOT/bin/mbtask
NAME=mbsebbs
DESC="MBSE BBS"
export MBSE_ROOT
# See how we were called.
case "\$1" in
start)
echo -n "Starting \$DESC: "
rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK
su mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n "mbtask "
if [ -f \$MBSE_ROOT/etc/config.data ]; then
su mbse -c '\$MBSE_ROOT/bin/mbstat open -quiet'
echo -n "opened "
fi
echo "done."
;;
stop)
echo -n "Stopping \$DESC: "
if [ -f \$MBSE_ROOT/etc/config.data ]; then
echo -n "logoff users "
su mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
fi
start-stop-daemon --stop --signal 15 --user mbtask
echo "\$NAME done."
;;
force-reload|restart)
echo "Restarting \$DESC: is not possible, done."
;;
*)
N=/etc/init.d/\$NAME
echo "Usage: \$N {start|stop|restart|force-reload}" >&2
exit 1
esac
exit 0
EOF
chmod 755 $DISTINIT
update-rc.d mbsebbs defaults
echo "Debian install ready."
log "+" "Debian SystemV init script installed"
fi
echo
echo "Please note, your MBSE BBS startup file is \"$DISTINIT\""
echo

26
script/maint Normal file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
#
# MBSE BBS Maintenance - Should be run from cron.
#
# 18-Mar-2000 MB.
if [ -z "$MBSE_ROOT" ]; then
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
fi
# Don't do maintenance if running on UPS battery power.
#
if [ -f $MBSE_ROOT/sema/upsalarm ]; then
exit 0
fi
$MBSE_ROOT/bin/mbuser pack kill 180 50 -quiet
$MBSE_ROOT/bin/mbmsg kill pack link -quiet
$MBSE_ROOT/bin/mbfile kill check pack index -quiet
# $MBSE_ROOT/bin/mbfile kill check pack index web -quiet
$MBSE_ROOT/bin/mbtoberep >$MBSE_ROOT/doc/toberep.doc
$MBSE_ROOT/bin/mbaff announce filefind -quiet
cd $MBSE_ROOT/tmp
$MBSE_ROOT/bin/mball list index -zip -quiet

32
script/mbse.start Normal file
View File

@@ -0,0 +1,32 @@
#
# ~/bin/mbse.start
# BBS Startup script, should be run as BBS owner.
# Note: This is only used on Slackware systems until 7.0.0
#
# 27-May-2001 MB.
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 "
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

38
script/mbse.stop Normal file
View File

@@ -0,0 +1,38 @@
#
# ~/bin/mbse.start
# BBS Shutdown script, should be run as BBS owner.
# Note: this is only used on Slackware systems.
#
# 27-May-2001 MB.
export PATH="/sbin:/usr/sbin:/bin:/usr/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
#

28
script/midnight Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# MBSE BBS Midnight - Should be run from cron at 00:00
#
# 26-Aug-1999 MB.
if [ "$MBSE_ROOT" = "" ]; then
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
fi
# While the system is on UPS battery power, don't start maintenance
#
while [ -f $MBSE_ROOT/sema/upsalarm ]; do
sleep 60
done
# Rollover statistic counters.
#
$MBSE_ROOT/bin/mbfido roll -quiet
# Log "What's on Hold"
#
$MBSE_ROOT/bin/mbout stat -quiet
# Export messages "missed" by the fast mailscan
#
$MBSE_ROOT/bin/mbfido scan -full -quiet

15
script/monthly Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# MBSE BBS Monthly - Should be run at the first of the month at 00:10
#
# 26-Aug-1999 MB.
if [ "$MBSE_ROOT" = "" ]; then
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
fi
# While the system is on UPS battery power, don't start maintenance
#
while [ -f $MBSE_ROOT/sema/upsalarm ]; do
sleep 60
done

15
script/rc Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# $MBSE_ROOT/etc/rc: BBS Startup script for Slackware.
#
# 08-Jul-1999
# 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

14
script/rc.shutdown Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# /mnt/prod/mbse/etc/rc.shutdown: BBS Shutdown script for Slackware
#
# 08-Jul-1998
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
#

18
script/weekly Normal file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
#
# MBSE BBS Weekly - Should be run every week at sunday from cron at 00:05
#
# 26-Aug-1999 MB.
if [ "$MBSE_ROOT" = "" ]; then
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
fi
# While the system is on UPS battery power, don't start maintenance
#
while [ -f $MBSE_ROOT/sema/upsalarm ]; do
sleep 60
done
$MBSE_ROOT/bin/mbfido notify -quiet