Renamed installinit to installinit.sh

This commit is contained in:
Michiel Broek 2001-08-25 20:37:27 +00:00
parent ab0d0e5b23
commit beb49f6e53

60
script/installinit → script/installinit.sh Executable file → Normal file
View File

@ -1,14 +1,14 @@
#!/bin/sh
# #
# Installation script to install bootscripts. # Installation script to install bootscripts.
# #
# (C) Michiel Broek, v0.21 27-May-2001 # (C) Michiel Broek, v0.23 25-Aug-2001
# #
PATH=/bin:/sbin:/usr/bin:/usr/sbin:$MBSE_ROOT/bin PATH=/bin:/sbin:/usr/bin:/usr/sbin:$MBSE_ROOT/bin
DISTNAME= DISTNAME=
DISTVERS= DISTVERS=
DISTINIT= DISTINIT=
SU="su" SU="su"
OSTYPE=`uname -s`
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -73,11 +73,12 @@ fi
# First do various tests to see which Linux distribution this is. # First do various tests to see which Linux distribution this is.
# #
if [ -f /etc/slackware-version ]; then if [ "$OSTYPE" = "Linux" ]; then
if [ -f /etc/slackware-version ]; then
# Slackware 7.0 and later # Slackware 7.0 and later
DISTNAME="Slackware" DISTNAME="Slackware"
DISTVERS=`cat /etc/slackware-version` DISTVERS=`cat /etc/slackware-version`
else else
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
# Debian, at least since version 2.2 # Debian, at least since version 2.2
DISTNAME="Debian" DISTNAME="Debian"
@ -115,10 +116,17 @@ else
fi fi
fi fi
fi fi
fi
fi
if [ "$OSTYPE" = "FreeBSD" ]; then
DISTNAME="FreeBSD"
DISTVERS=`uname -r`
DISTVERS=${DISTVERS:0:3}
PW="pw "
fi fi
log "+" "Distribution $DISTNAME $DISTVERS" log "+" "Distribution $OSTYPE $DISTNAME $DISTVERS"
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
@ -162,6 +170,7 @@ case "\$1" in
echo -n "MBSE BBS starting:" echo -n "MBSE BBS starting:"
rm -f \$MBSE_ROOT/sema/* rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK rm -f \$MBSE_ROOT/var/*.LCK
rm -f \$MBSE_ROOT/tmp/mb*
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null $SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n " mbtask" echo -n " mbtask"
if [ -f \$MBSE_ROOT/etc/config.data ]; then if [ -f \$MBSE_ROOT/etc/config.data ]; then
@ -257,6 +266,8 @@ if [ "$DISTNAME" = "Slackware" ]; then
cat << EOF >$DISTINIT cat << EOF >$DISTINIT
#!/bin/sh #!/bin/sh
# #
# description: Starts and stops MBSE BBS.
#
# Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001 # Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001
# #
# $DISTINIT for Slackware # $DISTINIT for Slackware
@ -285,6 +296,7 @@ case "\$1" in
echo -n "MBSE BBS starting:" echo -n "MBSE BBS starting:"
rm -f \$MBSE_ROOT/sema/* rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK rm -f \$MBSE_ROOT/var/*.LCK
rm -f \$MBSE_ROOT/tmp/mb*
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null $SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n " mbtask" echo -n " mbtask"
if [ -f \$MBSE_ROOT/etc/config.data ]; then if [ -f \$MBSE_ROOT/etc/config.data ]; then
@ -429,6 +441,7 @@ case "\$1" in
echo -n "Starting MBSE BBS: " echo -n "Starting MBSE BBS: "
rm -f \$MBSE_ROOT/sema/* rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK rm -f \$MBSE_ROOT/var/*.LCK
rm -f \$MBSE_ROOT/tmp/mb*
$SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null $SU mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n "mbtask " echo -n "mbtask "
if [ -f \$MBSE_ROOT/etc/config.data ]; then if [ -f \$MBSE_ROOT/etc/config.data ]; then
@ -517,6 +530,7 @@ case "\$1" in
echo -n "Starting \$DESC: " echo -n "Starting \$DESC: "
rm -f \$MBSE_ROOT/sema/* rm -f \$MBSE_ROOT/sema/*
rm -f \$MBSE_ROOT/var/*.LCK rm -f \$MBSE_ROOT/var/*.LCK
rm -f \$MBSE_ROOT/tmp/mb*
su mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null su mbse -c '\$MBSE_ROOT/bin/mbtask' >/dev/null
echo -n "mbtask " echo -n "mbtask "
if [ -f \$MBSE_ROOT/etc/config.data ]; then if [ -f \$MBSE_ROOT/etc/config.data ]; then
@ -551,6 +565,42 @@ EOF
log "+" "Debian SystemV init script installed" log "+" "Debian SystemV init script installed"
fi fi
#--------------------------------------------------------------------------
#
# Adding scripts for FreeBSD
#
#
if [ "$DISTNAME" = "FreeBSD" ]; then
#
# FreeBSD init
#
DISTINIT="$MBSE_ROOT/etc/rc"
echo "Adding FreeBSD style MBSE BBS start/stop scripts"
log "+" "Adding FreeBSD style MBSE BBS start/stop scripts"
if [ "`grep MBSE /etc/rc.local`" = "" ]; then
log "+" "Adding $MBSE_ROOT/etc/rc to /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
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
fi
echo echo
echo "Please note, your MBSE BBS startup file is \"$DISTINIT\"" echo "Please note, your MBSE BBS startup file is \"$DISTINIT\""
echo echo