This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
deb-mbse/SETUP.sh

666 lines
19 KiB
Bash
Raw Normal View History

2001-08-25 19:53:11 +00:00
#!/bin/bash
2001-08-17 05:46:24 +00:00
#
# $Id$
#
2001-08-17 05:46:24 +00:00
# Basic setup script for MBSE BBS
#
# (C) Michiel Broek
2001-08-17 05:46:24 +00:00
#
# Customisation section, change the next variables to your need.
# However, all docs refer to the setup below.
#
# Basic bbs root directory.
clear
MHOME=/opt/mbse
PATH=/bin:/sbin:/usr/bin:/usr/sbin:
DISTNAME=
DISTVERS=
2007-09-01 15:28:42 +00:00
OSTYPE=$( uname -s )
2001-08-17 05:46:24 +00:00
#------------------------------------------------------------------------
#
# Logging procedure, needs two parameters.
#
log() {
2007-09-01 15:28:42 +00:00
/bin/echo $( date +%d-%b-%y\ %X ) $1 $2 >> SETUP.log
2001-08-17 05:46:24 +00:00
}
#------------------------------------------------------------------------
#
cat << EOF
2003-01-11 21:46:27 +00:00
MBSE BBS for Unix, first time setup. Checking your system..."
2001-08-17 05:46:24 +00:00
If anything goes wrong with this script, look at the output of
the file SETUP.log that is created by this script in this
directory. If you can't get this script to run on your system,
mail this logfile to Michiel Broek at 2:280/2802 or email it
to mbroek@mbse.eu
2001-08-17 05:46:24 +00:00
EOF
echo -n "Press ENTER to start the basic checks "
read junk
2007-09-01 15:28:42 +00:00
log "+" "MBSE BBS $0 started by $(whoami)"
log "+" "Current directory is $(pwd)"
2001-08-17 05:46:24 +00:00
2001-08-25 19:53:11 +00:00
# Check the OS type, only Linux for now.
#
2004-12-27 21:35:56 +00:00
if [ "$OSTYPE" != "Linux" ] && [ "$OSTYPE" != "FreeBSD" ] && [ "$OSTYPE" != "NetBSD" ] && [ "$OSTYPE" != "OpenBSD" ] && [ "$OSTYPE" != "Darwin" ]; then
2001-08-25 19:53:11 +00:00
cat << EOF
Your are trying to install MBSE BBS on a $OSTYPE system, however
2004-12-27 21:35:56 +00:00
at this time only Linux, FreeBSD, NetBSD, OpenBSD and Darwin (OS X)
are supported.
2001-08-25 19:53:11 +00:00
EOF
log "!" "Aborted, OS is $OSTYPE"
exit 2
fi
2001-08-17 05:46:24 +00:00
#
# First do various tests to see which Linux distribution this is.
#
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "Linux" ]; then
PW=
if [ -f /etc/slackware-version ]; then
# Slackware 7.0 and later
DISTNAME="Slackware"
2007-09-01 15:28:42 +00:00
# There are two styles, newer releases are like "Slackware 12.0.0"
if grep -q Slackware /etc/slackware-version ; then
DISTVERS=$( cat /etc/slackware-version | awk '{ print $2 }' )
else
DISTVERS=$( cat /etc/slackware-version )
fi
elif [ -f /etc/zenwalk-version ]; then
DISTNAME="Zenwalk"
2008-01-08 19:55:03 +00:00
DISTVERS=$( cat /etc/zenwalk-version | awk '{ print $2 }' )
2007-09-01 15:28:42 +00:00
elif [ -f /etc/debian_version ]; then
# Debian, at least since version 2.2
DISTNAME="Debian"
DISTVERS=$( cat /etc/debian_version )
# Ubuntu is based on Debian
if grep -q "Ubuntu" /etc/issue ; then
DISTNAME="Ubuntu"
DISTVERS=$( cat /etc/issue | awk '{ print $2 }' )
fi
elif [ -f /etc/SuSE-release ]; then
DISTNAME="SuSE"
DISTVERS=$( cat /etc/SuSE-release | grep VERSION | awk '{ print $3 }' )
# Mandrake test before RedHat, Mandrake has a redhat-release
# file also which is a symbolic link to mandrake-release.
elif [ -f /etc/mandrake-release ]; then
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 grep -q e-smith /etc/redhat-release ; then
DISTVERS=$( cat /etc/redhat-release | awk '{ print $13 }' | tr -d \) )
else
DISTVERS=$( cat /etc/redhat-release | awk '{ print $5 }' )
fi
elif [ -f /etc/gentoo-release ]; then
DISTNAME="Gentoo"
DISTVERS=$( cat /etc/gentoo-release | awk '{ print $5 }' )
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
DISTNAME="Unknown"
2001-08-17 05:46:24 +00:00
fi
2007-09-01 15:28:42 +00:00
elif [ "$OSTYPE" = "FreeBSD" ]; then
2001-08-25 19:53:11 +00:00
DISTNAME="FreeBSD"
2007-09-01 15:28:42 +00:00
DISTVERS=$(uname -r)
2001-08-25 19:53:11 +00:00
PW="pw "
2007-09-01 15:28:42 +00:00
elif [ "$OSTYPE" = "NetBSD" ]; then
2002-01-10 21:36:24 +00:00
DISTNAME="NetBSD"
2007-09-01 15:28:42 +00:00
DISTVERS=$(uname -r)
elif [ "$OSTYPE" = "OpenBSD" ]; then
2004-12-27 21:35:56 +00:00
DISTNAME="OpenBSD"
2007-09-01 15:28:42 +00:00
DISTVERS=$(uname -r)
elif [ "$OSTYPE" = "Darwin" ]; then
2004-02-22 12:51:42 +00:00
DISTNAME="Darwin"
2007-09-01 15:28:42 +00:00
DISTVERS=$(uname -r)
else
DISTNAME="Unknown"
2004-02-22 12:51:42 +00:00
fi
2001-08-25 19:53:11 +00:00
log "+" "Detected \"${OSTYPE}\" (${HOSTTYPE}) \"${DISTNAME}\" version \"${DISTVERS}\""
2001-08-17 05:46:24 +00:00
# Basic checks.
2007-09-01 15:28:42 +00:00
if [ "$DISTNAME" = "Unknown" ]; then
cat << EOF
Your are trying to install MBSE BBS on $OSTYPE system, however
the distribution is unknown.
EOF
log "!" "Aborted, OS is $OSTYPE, distribution is unknown"
exit 2
fi
if [ $( whoami ) != "root" ]; then
2001-08-17 05:46:24 +00:00
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 variable exists: $MBSE_ROOT ***"
echo "*** SETUP aborted ***"
log "!" "Aborted, MBSE_ROOT variable exists: ${MBSE_ROOT}"
exit 2
fi
2007-09-01 15:28:42 +00:00
if grep -q ^mbse: /etc/passwd ; then
2001-08-17 05:46:24 +00:00
echo "*** User 'mbse' already exists on this system ***"
echo "*** SETUP aborted ***"
log "!" "Aborted, user 'mbse' already exists on this system"
exit 2
fi
2007-09-01 15:28:42 +00:00
if grep -q ^bbs: /etc/group ; then
2001-08-17 05:46:24 +00:00
echo "*** Group 'bbs' already exists on this system ***"
echo "*** SETUP aborted ***"
log "!" "Aborted, group 'bbs' already exists on this system"
exit 2
fi
if [ -f /etc/passwd.lock ]; then
echo "*** The password file is locked, make sure that nobody"
echo " is using any password utilities. ***"
echo "*** SETUP aborted ***"
log "!" "Aborted, password file is locked"
exit 2
fi
2007-09-01 15:28:42 +00:00
#
# Check if this is Ubuntu. Ubuntu by default has no xinetd installed.
#
if [ "$DISTNAME" = "Ubuntu" ]; then
if [ ! -f /etc/xinetd.d/echo ]; then
echo "*** You seem to be using Ubuntu but have not yet installed xinetd."
echo " 'sudo apt-get install xinetd' will install that for you. ***"
echo "*** SETUP aborted ***"
log "!" "Aborted, Ubuntu without xinetd package"
exit 2
fi
fi
2001-08-17 05:46:24 +00:00
clear
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "Linux" ]; then
if [ -d /opt ]; then
log "+" "Directory /opt already present"
else
mkdir /opt
2007-09-01 15:28:42 +00:00
log "+" "Directory /opt created"
2001-08-17 05:46:24 +00:00
echo "Directory /opt created."
2001-08-25 19:53:11 +00:00
fi
fi
2004-12-27 21:35:56 +00:00
if [ "$OSTYPE" = "FreeBSD" ] || [ "$OSTYPE" = "NetBSD" ] || [ "$OSTYPE" = "OpenBSD" ] || [ "$OSTYPE" = "Darwin" ]; then
2001-08-25 19:53:11 +00:00
#
2004-12-27 21:35:56 +00:00
# FreeBSD/NetBSD/OpenBSD/Darwin uses /usr/local for extra packages
2004-02-22 12:51:42 +00:00
# and doesn't use /opt.
2001-08-25 19:53:11 +00:00
# Also using /opt means that we are in the root partition which
# by default is very small. We put everything in /usr/local/opt
# and create symlinks to it.
#
if [ -d /opt ]; then
log "+" "Directory /opt already present"
else
if [ -d /usr/local/opt ]; then
log "+" "Directory /usr/local/opt already present"
else
mkdir -p /usr/local/opt
2007-09-01 15:28:42 +00:00
log "+" "Directory /usr/local/opt created"
2001-08-25 19:53:11 +00:00
echo "Directory /usr/local/opt created."
fi
ln -s /usr/local/opt /opt
2007-09-01 15:28:42 +00:00
log "+" "Link /opt to /usr/local/opt created"
2001-08-25 19:53:11 +00:00
echo "Link /opt to /usr/local/opt created."
fi
2001-08-17 05:46:24 +00:00
fi
cat << EOF
Basic checks done.
2001-08-25 19:53:11 +00:00
The detected $OSTYPE distribution is $DISTNAME $DISTVERS
2001-08-17 05:46:24 +00:00
Everything looks allright to start the installation now.
Next the script will install a new group 'bbs' and two new
users, 'mbse' which is the bbs system account, and 'bbs' which
is the login account for bbs users. This account will have no
password! The shell for this account is the main bbs program.
One final important note: This script will make changes to some
of your system files. Because I don't have access to all kinds of
distributions and configurations there is no garantee that this
script is perfect. Please make sure you have a recent system backup.
Also make sure you have resque boot disks and know how to repair
your system. It might also be wise to login as root on another
virtual console incase something goes wrong with system login.
2004-02-22 12:51:42 +00:00
Darwin (OS X) Users must install the .dmg image of user utils
available on Version Tracker and within this archive prior
to continuing the installation.
2001-08-17 05:46:24 +00:00
If you are not sure, or forgot something, hit Control-C now or
EOF
echo -n " press Enter to start the installation "
read junk
clear
#------------------------------------------------------------------------
#
# The real work starts here
#
log "+" "Starting installation"
echo "Installing MBSE BBS for the first time..."
echo ""
echo -n "Adding group 'bbs'"
2001-08-25 19:53:11 +00:00
$PW groupadd bbs
2001-08-17 05:46:24 +00:00
log "+" "[$?] Added group bbs"
2007-09-01 15:28:42 +00:00
echo -n ", user 'mbse' $OSTYPE "
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "Linux" ]; then
2007-09-01 15:28:42 +00:00
# Different distros have different needs...
GRPS="uucp"
if grep -q ^wheel /etc/group ; then
GRPS=${GRPS}",wheel"
2004-09-27 11:41:03 +00:00
fi
2007-09-01 15:28:42 +00:00
if [ "$DISTNAME" = "Ubuntu" ]; then
GRPS=${GRPS}",adm,admin"
fi
if grep -q ^dialout /etc/group ; then
GRPS=${GRPS}",dialout"
fi
if grep -q ^dip /etc/group ; then
GRPS=${GRPS}",dip"
fi
log "+" "useradd -c \"MBSE BBS Admin\" -d $MHOME -g bbs -G $GRPS -m -s /bin/bash mbse"
useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G $GRPS -m -s /bin/bash mbse
elif [ "$OSTYPE" = "FreeBSD" ]; then
2001-12-22 22:42:59 +00:00
pw useradd mbse -c "MBSE BBS Admin" -d $MHOME -g bbs -G wheel,dialer -m -s /usr/local/bin/bash
2007-09-01 15:28:42 +00:00
elif [ "$OSTYPE" = "NetBSD" ]; then
2002-01-10 21:36:24 +00:00
useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G wheel,dialer -m -s /usr/pkg/bin/bash mbse
2007-09-01 15:28:42 +00:00
elif [ "$OSTYPE" = "OpenBSD" ]; then
2004-12-27 21:35:56 +00:00
useradd -c "MBSE BBS Admin" -d $MHOME -g bbs -G wheel,dialer -m -s /usr/local/bin/bash mbse
2007-09-01 15:28:42 +00:00
elif [ "$OSTYPE" = "Darwin" ]; then
2004-02-22 12:51:42 +00:00
useradd mbse -c "MBSE BBS Admin" -d $MHOME -g bbs -s /bin/bash
fi
2001-08-17 05:46:24 +00:00
log "+" "[$?] Added user mbse"
2004-09-25 13:17:23 +00:00
chmod 755 $MHOME
log "+" "[$?] chmod 755 $MHOME"
2001-08-17 05:46:24 +00:00
echo -n " writing '$MHOME/.profile'"
cat << EOF >$MHOME/.profile
# profile for mbse
#
export PATH=\$HOME/bin:\$PATH
export MBSE_ROOT=\$HOME
export GOLDED=\$HOME/etc
# For xterm on the Gnome desktop:
cd \$HOME
#
export COLUMNS LINES
2001-08-17 05:46:24 +00:00
EOF
chown mbse $MHOME/.profile
chgrp bbs $MHOME/.profile
2001-08-17 05:46:24 +00:00
echo ""
log "+" "Created $MHOME/.profile"
# On some systems there is a .bashrc file in the users homedir.
# It must be removed.
if [ -f $MHOME/.bashrc ] || [ -f $MHOME/.bash_profile ]; then
echo "Removing '$MHOME/.bash*'"
rm -f $MHOME/.bash*
log "+" "Removed $MHOME/.bash* files"
fi
echo ""
echo "Now set the login password for user 'mbse'"
passwd mbse
log "+" "[$?] Password is set for user mbse"
2001-08-25 19:53:11 +00:00
2001-08-17 05:46:24 +00:00
echo -n "Adding user 'bbs'"
2001-08-25 19:53:11 +00:00
if [ ! -d $MHOME/home ]; then
mkdir $MHOME/home
log "+" "[$?] Created directory $MHOME/home"
fi
2003-01-11 21:46:27 +00:00
chown mbse $MHOME/home
log "+" "[$?] chown mbse $MHOME/home"
chgrp bbs $MHOME/home
log "+" "[$?] chgrp bbs $MHOME/home"
2002-01-10 21:36:24 +00:00
chmod 770 $MHOME/home
2002-02-08 15:38:32 +00:00
log "+" "[$?] chmod 770 $MHOME/home"
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "Linux" ]; then
useradd -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbnewusr bbs
2001-08-25 19:53:11 +00:00
log "+" "[$?] Added user bbs"
fi
if [ "$OSTYPE" = "FreeBSD" ]; then
pw useradd bbs -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbnewusr
2001-08-25 19:53:11 +00:00
log "+" "[$?] Added user bbs"
fi
2002-01-10 21:36:24 +00:00
if [ "$OSTYPE" = "NetBSD" ]; then
useradd -c "MBSE BBS Login" -d $MHOME/home/bbs -m -g bbs -s $MHOME/bin/mbnewusr bbs
log "+" "[$?] Added user bbs"
fi
2004-12-27 21:35:56 +00:00
if [ "$OSTYPE" = "OpenBSD" ]; then
useradd -c "MBSE BBS Login" -d $MHOME/home/bbs -m -g bbs -s $MHOME/bin/mbnewusr bbs
log "+" "[$?] Added user bbs"
fi
2004-02-22 12:51:42 +00:00
if [ "$OSTYPE" = "Darwin" ]; then
useradd bbs -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbnewuser
log "+" "[$?] Added user bbs"
fi
2001-08-17 05:46:24 +00:00
# Some systems (RedHat and Mandrake) insist on creating a users homedir.
2002-01-10 21:36:24 +00:00
# NetBSD gives errormessages when not creating a homedir, so we let it create.
2001-08-17 05:46:24 +00:00
# These are full of garbage we don't need. Kill it first.
if [ -d $MHOME/home/bbs ]; then
rm -Rf $MHOME/home/bbs
log "+" "[$?] Removed $MHOME/home/bbs"
fi
2001-08-25 19:53:11 +00:00
mkdir -m 0770 $MHOME/home/bbs
2001-08-17 05:46:24 +00:00
log "+" "[$?] mkdir $MHOME/home/bbs"
2003-01-11 21:46:27 +00:00
chown mbse $MHOME/home/bbs
log "+" "[$?] chown mbse $MHOME/home/bbs"
chgrp bbs $MHOME/home/bbs
log "+" "[$?] chgrp bbs $MHOME/home/bbs"
2001-08-17 05:46:24 +00:00
echo ", removing password:"
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "Linux" ]; then
echo -n "$$" >/etc/passwd.lock
if [ -f /etc/shadow ]; then
log "+" "Standard shadow password system"
2001-08-17 05:46:24 +00:00
# Not all systems are the same...
2007-09-01 15:28:42 +00:00
if grep -q ^bbs:\!\!: /etc/shadow ; then
sed /bbs:\!\!:/s/bbs:\!\!:/bbs::/ /etc/shadow >/etc/shadow.bbs
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
sed /bbs:\!:/s/bbs:\!:/bbs::/ /etc/shadow >/etc/shadow.bbs
2001-08-17 05:46:24 +00:00
fi
log "+" "[$?] removed password from user bbs"
mv /etc/shadow /etc/shadow.mbse
log "+" "[$?] made backup of /etc/shadow"
mv /etc/shadow.bbs /etc/shadow
log "+" "[$?] moved new /etc/shadow in place"
2007-09-01 15:28:42 +00:00
if [ "$DISTNAME" = "Debian" ] || [ "$DISTNAME" = "Ubuntu" ] || [ "$DISTNAME" = "SuSE" ]; then
# Debian, Ubuntu and SuSE use other ownership of /etc/shadow
chmod 640 /etc/shadow
chgrp shadow /etc/shadow
log "+" "[$?] Debian/Ubuntu/SuSE style owner of /etc/shadow (0640 root.shadow)"
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
chmod 600 /etc/shadow
log "+" "[$?] Default style owner of /etc/shadow (0600 root.root)"
2001-08-17 05:46:24 +00:00
fi
echo " File /etc/shadow.mbse is your backup of /etc/shadow"
2001-08-25 19:53:11 +00:00
else
2001-08-17 05:46:24 +00:00
log "+" "Not a shadow password system"
2007-09-01 15:28:42 +00:00
if grep -q ^bbs:\!\!: /etc/passwd ; then
sed /bbs:\!\!:/s/bbs:\!\!:/bbs::/ /etc/passwd >/etc/passwd.bbs
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
sed /bbs:\!:/s/bbs:\!:/bbs::/ /etc/passwd >/etc/passwd.bbs
2001-08-17 05:46:24 +00:00
fi
log "+" "[$?] Removed password of user bbs"
mv /etc/passwd /etc/passwd.mbse
log "+" "[$?] Made backup of /etc/passwd"
mv /etc/passwd.bbs /etc/passwd
log "+" "[$?] Moved new /etc/passwd in place"
chmod 644 /etc/passwd
log "+" "[$?] Changed owner of /etc/passwd"
echo " File /etc/passwd.mbse is your backup of /etc/passwd"
2001-08-25 19:53:11 +00:00
fi
rm /etc/passwd.lock
fi
2004-12-27 21:35:56 +00:00
if [ "$OSTYPE" = "NetBSD" ] || [ "$OSTYPE" = "OpenBSD" ] || [ "$OSTYPE" = "Darwin" ]; then
2002-01-10 21:36:24 +00:00
cat << EOF
READ THIS CAREFULLY NOW READ THIS CAREFULLY NOW
I don't know how to automatic remove the password for the "bbs"
2004-02-22 12:51:42 +00:00
user account in NetBSD/Darwin. You have to do this for me!
2002-01-10 21:36:24 +00:00
Next I start the editor you need to use, remove all the stars"
after the word Password, then save the file with "wq!"
EOF
echo -n "Press Enter when ready "
read junk
chpass bbs
fi
2001-08-25 19:53:11 +00:00
if [ "$OSTYPE" = "FreeBSD" ]; then
#
# FreeBSD has a util to remove a password
#
chpass -p "" bbs
log "+" "[$?] Removed password of user bbs"
2001-08-17 05:46:24 +00:00
fi
echo ""
2001-08-25 19:53:11 +00:00
2007-09-01 15:28:42 +00:00
if grep -q ^binkp /etc/services ; then
BINKD=FALSE
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
BINKD=TRUE
2001-08-17 05:46:24 +00:00
fi
2007-09-01 15:28:42 +00:00
if grep -q 60179\/tcp /etc/services ; then
FIDO_TCP=FALSE
2001-08-17 05:46:24 +00:00
else
2007-09-01 15:28:42 +00:00
FIDO_TCP=TRUE
fi
if grep -q 60179\/udp /etc/services ; then
FIDO_UDP=FALSE
else
FIDO_UDP=TRUE
fi
if grep -q ^tfido /etc/services ; then
TFIDO=FALSE
else
TFIDO=TRUE
fi
log "+" "Services: binkp=$BINKD fido_tcp=$FIDO_TCP fido_udp=$FIDO_UDP tfido=$TFIDO"
if [ "$FIDO_TCP" = "TRUE" ] || [ "$FIDO_UDP" = "TRUE" ] || [ "$TFIDO" = "TRUE" ] || [ "$BINKD" = "TRUE" ]; then
echo -n "Modifying /etc/services"
log "+" "Modifying /etc/services"
mv /etc/services /etc/services.mbse
cat /etc/services.mbse >/etc/services
echo "#" >>/etc/services
echo "# Unofficial for MBSE BBS" >>/etc/services
echo "#" >>/etc/services
if [ "$BINKD" = "TRUE" ]; then
echo -n ", binkp at port 24554"
echo "binkp 24554/tcp # mbcico IBN mode">>/etc/services
fi
if [ "$TFIDO" = "TRUE" ]; then
echo -n ", tfido at port 60177"
echo "tfido 60177/tcp # mbcico ITN mode (alternate port)">>/etc/services
fi
if [ "$FIDO_TCP" = "TRUE" ]; then
echo -n ", fido tcp at port 60179"
echo "fido 60179/tcp # mbcico IFC mode">>/etc/services
fi
if [ "$FIDO_UDP" = "TRUE" ]; then
echo -n ", fido udp at port 60179"
echo "fido 60179/udp # Chatserver">>/etc/services
fi
chmod 644 /etc/services
echo ", done."
2001-08-17 05:46:24 +00:00
fi
2002-01-13 14:07:43 +00:00
if [ -f /etc/inetd.conf ]; then
log "+" "/etc/inetd.conf found, inetd system"
2007-09-01 15:28:42 +00:00
if ! grep -q mbcico /etc/inetd.conf ; then
2001-08-17 05:46:24 +00:00
echo -n "Modifying /etc/inetd.conf"
log "+" "Modifying /etc/inetd.conf"
mv /etc/inetd.conf /etc/inetd.conf.mbse
cat /etc/inetd.conf.mbse >/etc/inetd.conf
cat << EOF >>/etc/inetd.conf
#:MBSE-BBS: bbs service
binkp stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t ibn
fido stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t ifc
2004-02-01 15:27:05 +00:00
tfido stream tcp nowait mbse $MHOME/bin/mbcico mbcico -t itn
2005-08-30 20:28:13 +00:00
# Example Linux telnet to the BBS
2004-09-27 11:41:03 +00:00
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -L $MHOME/bin/mblogin
2005-08-30 20:28:13 +00:00
# Example FreeBSD telnet to the BBS
#telnet stream tcp nowait root /usr/libexec/telnetd telnetd -p $MHOME/bin/mblogin
# Example OpenBSD telnet to the BBS
#telnet stream tcp nowait root /usr/libexec/tcpd telnetd -L $MHOME/bin/mblogin
2007-08-25 19:31:59 +00:00
# Example NetBSD telnet to the BBS
#telnet stream tcp nowait root /usr/libexec/telnetd telnetd -g mbsebbs
2001-08-17 05:46:24 +00:00
EOF
chmod 644 /etc/inetd.conf
if [ -f /var/run/inetd.pid ]; then
echo -n ", restarting inetd"
2007-09-01 15:28:42 +00:00
kill -HUP $( cat /var/run/inetd.pid )
2001-08-17 05:46:24 +00:00
log "+" "[$?] restarted inetd"
else
log "!" "Warning: no inetd.pid file found"
fi
echo ", done."
2002-01-13 14:07:43 +00:00
fi
2001-08-17 05:46:24 +00:00
fi
2007-08-25 19:22:56 +00:00
if [ "$OSTYPE" = "NetBSD" ]; then
if [ -f /etc/gettytab ]; then
2007-09-01 15:28:42 +00:00
if ! grep mbsebbs /etc/gettytab ; then
2007-08-25 19:22:56 +00:00
log "+" "[$?] adding mbsebbs login to /etc/gettytab"
2007-08-25 20:38:29 +00:00
cat << EOF >>/etc/gettytab
2007-08-25 19:22:56 +00:00
#
# Login entry for mbsebbs.
#
2007-08-25 19:31:59 +00:00
mbsebbs:cd:ck:np:lo=$MHOME/bin/mblogin:sp#38400:
2007-08-25 19:22:56 +00:00
EOF
fi
fi
fi
2004-09-27 11:41:03 +00:00
if [ -f /etc/xinetd.conf ]; then
log "+" "/etc/xinetd.conf found, xinetd system"
2002-01-13 14:07:43 +00:00
if [ -d /etc/xinetd.d ]; then
log "+" "has xinetd.d subdir, writing files"
XINET="/etc/xinetd.d/mbsebbs"
else
log "+" "appending to xinetd.conf"
XINET="/etc/xinetd.conf"
fi
cat << EOF >> $XINET
#:MBSE BBS services are defined here.
2002-01-20 20:43:40 +00:00
#
# Author: Michiel Broek <mbse@mbse.eu>, 27-Sep-2004
2002-01-13 14:07:43 +00:00
service binkp
{
socket_type = stream
protocol = tcp
wait = no
user = mbse
instances = 10
server = $MHOME/bin/mbcico
2002-01-20 20:26:30 +00:00
server_args = -t ibn
2002-01-13 14:07:43 +00:00
}
service fido
{
socket_type = stream
protocol = tcp
wait = no
user = mbse
instances = 10
server = $MHOME/bin/mbcico
2002-01-20 20:26:30 +00:00
server_args = -t ifc
2002-01-13 14:07:43 +00:00
}
2003-11-22 21:42:44 +00:00
service tfido
{
socket_type = stream
protocol = tcp
wait = no
user = mbse
instances = 10
2004-02-01 15:27:05 +00:00
server = $MHOME/bin/mbcico
server_args = -t itn
2003-11-22 21:42:44 +00:00
}
2004-09-27 11:41:03 +00:00
# Telnet to the bbs using mblogin, disabled by default.
#
service telnet
{
disable = yes
protocol = tcp
instances = 10
flags = REUSE
log_on_failure += USERID
socket_type = stream
user = root
server = /usr/sbin/telnetd
server_args = -L $MHOME/bin/mblogin
wait = no
}
2002-01-13 14:07:43 +00:00
EOF
fi
2001-08-17 05:46:24 +00:00
# We made it, copy the logfile to mbse's homedir so that when the
# /tmp directory is cleaned, we still have it.
cat SETUP.log >> $MHOME/SETUP.log
2001-08-17 05:46:24 +00:00
echo ""
echo -n "Press Enter to continue"
read junk
clear
cat << EOF
The script made it to the end, that looks good. Before you logout do some
sanity checks;
1. Can you still login as a normal user.
2. Login on another virtual console, network or whatever as user 'mbse'.
Then type 'echo \$MBSE_ROOT'. Does this show the path to
'$MHOME' or nothing.
3. Login on another virtual console as user 'bbs'. It should not ask for
a password, but should direct try to start the bbs. This is not
installed yet but you should see error messages and then be logged out.
If these three tests weren't successfull, restore /etc/passwd and
or /etc/shadow, the backup copies have the extension '.mbse'.
Then issue (as root of course) the following commands:
EOF
2004-12-27 21:35:56 +00:00
if [ "$OSTYPE" = "Linux" ] || [ "$OSTYPE" = "NetBSD" ] || [ "$OSTYPE" = "OpenBSD" ]; then
2007-09-01 15:28:42 +00:00
if [ "$DISTNAME" = "Ubuntu" ]; then
echo " sudo userdel bbs"
echo " sudo userdel -r mbse"
echo " sudo groupdel bbs"
else
echo " userdel bbs"
echo " userdel -r mbse"
echo " groupdel bbs"
fi
2001-08-25 19:53:11 +00:00
fi
if [ "$OSTYPE" = "FreeBSD" ]; then
echo " pw userdel bbs -r"
echo " pw userdel mbse -r"
echo " pw groupdel bbs"
fi
2001-08-17 05:46:24 +00:00