2001-08-17 05:46:24 +00:00
|
|
|
#
|
2001-12-22 22:42:59 +00:00
|
|
|
# $Id$
|
2001-08-17 05:46:24 +00:00
|
|
|
#
|
2001-12-22 22:42:59 +00:00
|
|
|
# Installation script to install bootscripts.
|
2001-08-17 05:46:24 +00:00
|
|
|
#
|
2003-12-26 11:28:15 +00:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:${MBSE_ROOT}/bin
|
2001-08-17 05:46:24 +00:00
|
|
|
DISTNAME=
|
|
|
|
DISTVERS=
|
|
|
|
DISTINIT=
|
2001-08-25 20:37:27 +00:00
|
|
|
OSTYPE=`uname -s`
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Logging procedure, needs two parameters.
|
|
|
|
#
|
|
|
|
log() {
|
|
|
|
/bin/echo `date +%d-%b-%y\ %X ` $1 $2 >> installinit.log
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2003-12-26 11:28:15 +00:00
|
|
|
if [ "${MBSE_ROOT}" = "" ]; then
|
2001-08-17 05:46:24 +00:00
|
|
|
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.
|
|
|
|
#
|
2001-08-25 20:37:27 +00:00
|
|
|
if [ "$OSTYPE" = "Linux" ]; then
|
|
|
|
if [ -f /etc/slackware-version ]; then
|
|
|
|
# Slackware 7.0 and later
|
|
|
|
DISTNAME="Slackware"
|
|
|
|
DISTVERS=`cat /etc/slackware-version`
|
2008-11-18 21:03:08 +00:00
|
|
|
elif [ -f /etc/slamd64-version ]; then
|
|
|
|
# Slamd64
|
|
|
|
DISTNAME="Slamd64"
|
|
|
|
DISTVERS=`cat /etc/slamd64-version`
|
2008-01-07 19:46:39 +00:00
|
|
|
elif [ -f /etc/zenwalk-version ]; then
|
|
|
|
DISTNAME="Zenwalk"
|
|
|
|
DISTVERS=`cat /etc/zenwalk-version`
|
|
|
|
elif [ -f /etc/debian_version ]; then
|
|
|
|
# Debian, at least since version 2.2
|
|
|
|
DISTNAME="Debian"
|
|
|
|
DISTVERS=`cat /etc/debian_version`
|
|
|
|
elif [ -f /etc/SuSE-release ]; then
|
|
|
|
DISTNAME="SuSE"
|
|
|
|
DISTVERS=`cat /etc/SuSE-release | grep VERSION | awk '{ print $3 }'`
|
|
|
|
elif [ -f /etc/mandrake-release ]; then
|
|
|
|
# Mandrake test before RedHat, Mandrake has a redhat-release
|
|
|
|
# file also which is a symbolic link to mandrake-release.
|
|
|
|
DISTNAME="Mandrake"
|
|
|
|
# Format: Linux Mandrake release 8.0 (Cooker) for i586
|
|
|
|
DISTVERS="`cat /etc/mandrake-release | awk '{ print $4 }'`"
|
|
|
|
elif [ -f /etc/redhat-release ]; then
|
|
|
|
DISTNAME="RedHat"
|
|
|
|
if [ -z "`grep e-smith /etc/redhat-release`" ]; then
|
|
|
|
if [ -z "`grep Fedora /etc/redhat-release`" ]; then
|
|
|
|
DISTVERS=`cat /etc/redhat-release | awk '{ print $5 }'`
|
2001-08-17 05:46:24 +00:00
|
|
|
else
|
2008-01-07 19:46:39 +00:00
|
|
|
DISTVERS=`cat /etc/redhat-release | awk '{ print $4 }'`
|
|
|
|
DISTNAME="Fedora Core"
|
2001-08-17 05:46:24 +00:00
|
|
|
fi
|
2008-01-07 19:46:39 +00:00
|
|
|
else
|
|
|
|
DISTVERS=`cat /etc/redhat-release | awk '{ print $13 }' | tr -d \)`
|
|
|
|
fi
|
|
|
|
elif [ -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;
|
2001-08-17 05:46:24 +00:00
|
|
|
fi
|
|
|
|
fi
|
2001-08-25 20:37:27 +00:00
|
|
|
if [ "$OSTYPE" = "FreeBSD" ]; then
|
|
|
|
DISTNAME="FreeBSD"
|
|
|
|
DISTVERS=`uname -r`
|
|
|
|
PW="pw "
|
|
|
|
fi
|
2002-01-11 22:56:52 +00:00
|
|
|
if [ "$OSTYPE" = "NetBSD" ]; then
|
|
|
|
DISTNAME="NetBSD"
|
|
|
|
DISTVERS=`uname -r`
|
|
|
|
fi
|
2004-12-28 15:52:48 +00:00
|
|
|
if [ "$OSTYPE" = "OpenBSD" ]; then
|
|
|
|
DISTNAME="OpenBSD"
|
|
|
|
DISTVERS=`uname -r`
|
|
|
|
fi
|
2002-01-11 22:56:52 +00:00
|
|
|
|
2001-08-17 05:46:24 +00:00
|
|
|
|
2001-08-25 20:37:27 +00:00
|
|
|
log "+" "Distribution $OSTYPE $DISTNAME $DISTVERS"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
2002-05-06 18:53:17 +00:00
|
|
|
# Adding scripts for SuSE, from 7.1 and later in /etc/init.d
|
2001-08-17 05:46:24 +00:00
|
|
|
#
|
|
|
|
if [ "$DISTNAME" = "SuSE" ]; then
|
2002-05-06 18:53:17 +00:00
|
|
|
if [ "$DISTVERS" '>' "7.1" ]; then
|
|
|
|
DISTDIR="/etc"
|
|
|
|
else
|
|
|
|
DISTDIR="/sbin"
|
|
|
|
fi
|
|
|
|
DISTINIT="$DISTDIR/init.d/mbsed"
|
|
|
|
echo "Installing SystemV init scripts for SuSE $DISTVERS"
|
|
|
|
log "+" "Installing SystemV init scripts for SuSE $DISTVERS"
|
2001-08-17 05:46:24 +00:00
|
|
|
echo "Adding $DISTINIT"
|
2002-02-04 15:18:06 +00:00
|
|
|
cp init.SuSE $DISTINIT
|
|
|
|
chmod 755 $DISTINIT
|
2001-08-17 05:46:24 +00:00
|
|
|
echo "Making links for start/stop in runlevel 2"
|
2002-05-06 18:53:17 +00:00
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc2.d/K05mbsed
|
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc2.d/S99mbsed
|
2001-08-17 05:46:24 +00:00
|
|
|
echo "Making links for start/stop in runlevel 3"
|
2002-05-06 18:53:17 +00:00
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc3.d/K05mbsed
|
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc3.d/S99mbsed
|
|
|
|
echo "Making links for start/stop in runlevel 5"
|
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc5.d/K05mbsed
|
|
|
|
ln -s ../mbsed $DISTDIR/init.d/rc5.d/S99mbsed
|
|
|
|
echo "SuSE $DISTVERS SystemV init configured"
|
|
|
|
log "+" "SuSE $DISTVERS SystemV init configured"
|
2001-08-17 05:46:24 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-07 19:46:39 +00:00
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Adding scripts for Zenwalk
|
|
|
|
#
|
|
|
|
if [ "$DISTNAME" = "Zenwalk" ]; then
|
|
|
|
DISTINIT="/etc/rc.d/rc.zmbsed"
|
|
|
|
echo "Adding Zenwalk init script"
|
|
|
|
log "+" "Addiing Zenwalk init script"
|
|
|
|
cp init.Slackware $DISTINIT
|
|
|
|
chmod 755 $DISTINIT
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-08-17 05:46:24 +00:00
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Adding scripts for Slackware
|
|
|
|
#
|
2008-11-18 21:03:08 +00:00
|
|
|
if [ "$DISTNAME" = "Slackware" ] || [ "$DISTNAME" = "Slamd64" ]; then
|
2003-12-19 22:29:25 +00:00
|
|
|
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
|
2003-12-26 11:28:15 +00:00
|
|
|
if [ -f ${MBSE_ROOT}/bin/mbse.start ]; then
|
2003-12-19 22:29:25 +00:00
|
|
|
echo "Removing old startup scripts"
|
2003-12-26 11:28:15 +00:00
|
|
|
rm ${MBSE_ROOT}/bin/mbse.start ${MBSE_ROOT}/bin/mbse.stop ${MBSE_ROOT}/etc/rc ${MBSE_ROOT}/etc/rc.shutdown
|
2003-12-19 22:29:25 +00:00
|
|
|
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"
|
2001-08-17 05:46:24 +00:00
|
|
|
else
|
2003-12-19 22:29:25 +00:00
|
|
|
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
|
2003-12-06 20:52:58 +00:00
|
|
|
fi
|
2003-12-19 22:29:25 +00:00
|
|
|
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"
|
2001-08-17 05:46:24 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
2005-09-30 18:50:09 +00:00
|
|
|
# Adding scripts for RedHat, Fedora Core, e-smith and Mandrake
|
2001-08-17 05:46:24 +00:00
|
|
|
#
|
2005-09-30 18:50:09 +00:00
|
|
|
if [ "$DISTNAME" = "RedHat" ] || [ "$DISTNAME" = "Mandrake" ] || [ "$DISTNAME" = "Fedora Core" ]; then
|
2001-08-17 05:46:24 +00:00
|
|
|
|
2005-09-30 18:50:09 +00:00
|
|
|
log "+" "Adding RedHat/Fedora/E-Smith/Mandrake SystemV init scripts"
|
2001-08-17 05:46:24 +00:00
|
|
|
DISTINIT="/etc/rc.d/init.d/mbsed"
|
|
|
|
#
|
2002-01-18 21:31:12 +00:00
|
|
|
# Extra tests are added for the RedHat e-smith server distribution,
|
|
|
|
# this is a special distribution based on RedHat.
|
2001-08-17 05:46:24 +00:00
|
|
|
#
|
2002-01-20 20:26:30 +00:00
|
|
|
if [ -f /etc/mandrake-release ]; then
|
2002-01-21 20:16:57 +00:00
|
|
|
RHN="Mandrake"
|
2001-08-17 05:46:24 +00:00
|
|
|
else
|
2002-01-20 20:26:30 +00:00
|
|
|
if [ -f /etc/redhat-release ]; then
|
|
|
|
if [ -z "`grep e-smith /etc/redhat-release`" ]; then
|
|
|
|
RHN="RedHat"
|
|
|
|
else
|
|
|
|
RHN="e-smith based on RedHat"
|
|
|
|
fi
|
2001-08-17 05:46:24 +00:00
|
|
|
else
|
|
|
|
echo "You are in big trouble."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "Adding startup file $DISTINIT"
|
2002-02-04 15:18:06 +00:00
|
|
|
cp init.RedHat $DISTINIT
|
|
|
|
chmod 755 $DISTINIT
|
|
|
|
echo "Making links for stop in runlevels 0 and 6"
|
|
|
|
if [ -f /etc/rc.d/rc0.d/K05mbsed ]; then
|
|
|
|
rm /etc/rc.d/rc0.d/K05mbsed
|
|
|
|
fi
|
|
|
|
ln -s ../init.d/mbsed /etc/rc.d/rc0.d/K05mbsed
|
|
|
|
if [ -f /etc/rc.d/rc6.d/K05mbsed ]; then
|
|
|
|
rm /etc/rc.d/rc6.d/K05mbsed
|
|
|
|
fi
|
|
|
|
ln -s ../init.d/mbsed /etc/rc.d/rc6.d/K05mbsed
|
|
|
|
echo "Making links for start in runlevels 3 and 5"
|
|
|
|
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
|
|
|
|
if [ -f /etc/rc.d/rc5.d/S95mbsed ]; then
|
|
|
|
rm /etc/rc.d/rc5.d/S95mbsed
|
|
|
|
fi
|
|
|
|
ln -s ../init.d/mbsed /etc/rc.d/rc5.d/S95mbsed
|
|
|
|
if [ "$RHN" = "e-smith based on RedHat" ]; then
|
|
|
|
echo "Making link for start in runlevel 7"
|
|
|
|
if [ -f /etc/rc.d/rc7.d/S95mbsed ]; then
|
|
|
|
rm /etc/rc.d/rc7.d/S95mbsed
|
2002-01-21 20:16:57 +00:00
|
|
|
fi
|
2002-02-04 15:18:06 +00:00
|
|
|
ln -s ../init.d/mbsed /etc/rc.d/rc7.d/S95mbsed
|
|
|
|
fi
|
2001-08-17 05:46:24 +00:00
|
|
|
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"
|
2002-02-04 15:18:06 +00:00
|
|
|
cp init.Debian $DISTINIT
|
2001-08-17 05:46:24 +00:00
|
|
|
chmod 755 $DISTINIT
|
|
|
|
update-rc.d mbsebbs defaults
|
|
|
|
echo "Debian install ready."
|
|
|
|
log "+" "Debian SystemV init script installed"
|
|
|
|
fi
|
|
|
|
|
2001-08-25 20:37:27 +00:00
|
|
|
|
2003-11-10 19:06:32 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Adding scripts for Gentoo
|
|
|
|
#
|
|
|
|
#
|
|
|
|
if [ "$DISTNAME" = "Gentoo" ]; then
|
|
|
|
echo "You are running Gentoo Linux $DISTVERS"
|
|
|
|
log "+" "Adding Gentoo init script"
|
|
|
|
DISTINIT="/etc/init.d/mbsebbs"
|
|
|
|
cp init.Gentoo $DISTINIT
|
|
|
|
chmod 755 $DISTINIT
|
2003-11-15 12:31:05 +00:00
|
|
|
rc-update add mbsebbs default
|
2003-11-10 19:06:32 +00:00
|
|
|
echo "Gentoo install ready."
|
|
|
|
log "+" "Gentoo init script installed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2001-08-25 20:37:27 +00:00
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
2003-01-11 21:46:27 +00:00
|
|
|
# Adding scripts for NetBSD
|
2001-08-25 20:37:27 +00:00
|
|
|
#
|
|
|
|
#
|
2003-01-11 21:46:27 +00:00
|
|
|
if [ "$DISTNAME" = "NetBSD" ]; then
|
2001-08-25 20:37:27 +00:00
|
|
|
#
|
2003-01-11 21:46:27 +00:00
|
|
|
# NetBSD init
|
2001-08-25 20:37:27 +00:00
|
|
|
#
|
2003-12-19 22:29:25 +00:00
|
|
|
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
|
2001-08-25 20:37:27 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2003-01-11 21:46:27 +00:00
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Adding scripts for FreeBSD
|
|
|
|
#
|
|
|
|
#
|
|
|
|
if [ "$DISTNAME" = "FreeBSD" ]; then
|
|
|
|
#
|
|
|
|
# FreeBSD init
|
|
|
|
#
|
2003-01-11 22:25:47 +00:00
|
|
|
DISTINIT="/usr/local/etc/rc.d/mbse.sh"
|
2003-01-11 21:46:27 +00:00
|
|
|
echo "Adding $DISTNAME style MBSE BBS start/stop script"
|
|
|
|
log "+" "Adding $DISTNAME style MBSE BBS start/stop script"
|
|
|
|
cp init.FreeBSD $DISTINIT
|
|
|
|
chmod 0755 $DISTINIT
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2004-12-28 15:52:48 +00:00
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Adding startup commands for OpenBSD
|
|
|
|
#
|
|
|
|
#
|
|
|
|
if [ "$DISTNAME" = "OpenBSD" ]; then
|
|
|
|
if [ "`grep MBSE-BBS /etc/rc.local`" = "" ]; then
|
|
|
|
#
|
|
|
|
# OpenBSD init
|
|
|
|
#
|
|
|
|
DISTINIT="/etc/rc.local"
|
|
|
|
echo "Adding MBSE BBS startup commands to $DISTINIT"
|
|
|
|
log "+" "Adding MBSE BBS startup commands to $DISTINIT"
|
|
|
|
cat init.OpenBSD >> $DISTINIT
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2001-08-25 20:37:27 +00:00
|
|
|
|
2001-08-17 05:46:24 +00:00
|
|
|
echo
|
|
|
|
echo "Please note, your MBSE BBS startup file is \"$DISTINIT\""
|
|
|
|
echo
|