1994-11-16 07:51:45 +00:00
|
|
|
#!/stand/sh
|
|
|
|
#
|
|
|
|
# miscfuncs - miscellaneous functions for the other distribution scripts.
|
|
|
|
#
|
|
|
|
# Written: November 15th, 1994
|
|
|
|
# Copyright (C) 1994 by Jordan K. Hubbard
|
|
|
|
#
|
|
|
|
# Permission to copy or use this software for any purpose is granted
|
|
|
|
# provided that this message stay intact, and at this location (e.g. no
|
|
|
|
# putting your name on top after doing something trivial like reindenting
|
|
|
|
# it, just to make it look like you wrote it!).
|
|
|
|
#
|
1995-01-12 10:34:37 +00:00
|
|
|
# $Id: miscfuncs.sh,v 1.13 1994/12/23 05:11:18 jkh Exp $
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${_MISCFUNCS_SH_LOADED_}" = "yes" ]; then
|
1994-11-16 07:51:45 +00:00
|
|
|
return 0
|
|
|
|
else
|
|
|
|
_MISCFUNCS_SH_LOADED_=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/stand
|
|
|
|
export PATH
|
1994-11-18 11:01:33 +00:00
|
|
|
|
|
|
|
# Keep this current with the distribution!
|
1995-01-12 10:34:37 +00:00
|
|
|
DISTNAME="2.0-950112-SNAP"
|
1994-11-28 22:13:07 +00:00
|
|
|
|
|
|
|
# Express or Custom install?
|
|
|
|
INSTALL_TYPE=""
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-18 11:01:33 +00:00
|
|
|
# Flagrant guesses for now. These need to be hand-edited or, much better yet,
|
|
|
|
# automatically done as part of the release process. When that's the case,
|
|
|
|
# the hardwired constants will be replaced with tokens that get sed'd for
|
|
|
|
# the real sizes.
|
|
|
|
#
|
1994-11-20 14:49:48 +00:00
|
|
|
BINSIZE="40MB"
|
1994-11-18 11:01:33 +00:00
|
|
|
GAMESIZE="8MB"
|
|
|
|
MANSIZE="8MB"
|
|
|
|
PROFSIZE="4MB"
|
|
|
|
DICTSIZE="2MB"
|
|
|
|
SRCSIZE="120MB"
|
|
|
|
SECRSIZE="4MB"
|
|
|
|
COMPATSIZE="3MB"
|
1994-11-21 06:45:01 +00:00
|
|
|
X11SIZE="50MB"
|
1994-11-18 11:01:33 +00:00
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
# Paths
|
|
|
|
ETC="/etc"
|
|
|
|
MNT="/mnt"
|
|
|
|
HOME=/; export HOME
|
|
|
|
TMP=/tmp
|
|
|
|
|
|
|
|
# Commands and flags
|
1994-12-01 13:46:13 +00:00
|
|
|
FT_CMD="ft"
|
|
|
|
TAR_CMD="tar"
|
|
|
|
TAR_FLAGS="--unlink -xvf"
|
|
|
|
IFCONFIG_CMD="ifconfig"
|
|
|
|
ROUTE_CMD="route"
|
|
|
|
ROUTE_FLAGS="add default"
|
|
|
|
HOSTNAME_CMD="hostname"
|
|
|
|
SLATTACH_CMD="slattach"
|
|
|
|
SLATTACH_FLAGS="-l -a -s"
|
|
|
|
PPPD_CMD="pppd"
|
|
|
|
PPPD_FLAGS="crtscts defaultroute -ip -mn netmask $netmask"
|
1994-11-28 22:13:07 +00:00
|
|
|
|
1994-11-18 12:54:45 +00:00
|
|
|
interrupt()
|
|
|
|
{
|
1994-11-21 07:33:21 +00:00
|
|
|
dialog --clear --title "User Interrupt Requested" \
|
|
|
|
--msgbox "\n ** Aborting the installation ** \n" -1 -1
|
|
|
|
exit 0;
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Handle the return value from a dialog, doing some pre-processing
|
|
|
|
# so that each client doesn't have to.
|
1994-11-18 12:54:45 +00:00
|
|
|
handle_rval()
|
|
|
|
{
|
1994-11-16 07:51:45 +00:00
|
|
|
case $1 in
|
|
|
|
0)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
255)
|
|
|
|
PS1="subshell# " /stand/sh
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
# stick a progress message out on the other vty
|
|
|
|
progress()
|
|
|
|
{
|
|
|
|
echo "Progress <$*>" > /dev/ttyv1
|
|
|
|
}
|
|
|
|
|
1994-11-16 07:51:45 +00:00
|
|
|
# A simple user-confirmation dialog.
|
1994-11-18 12:54:45 +00:00
|
|
|
confirm()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
dialog --title "User Confirmation" --msgbox "$*" -1 -1
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# A simple message box dialog.
|
1994-11-18 12:54:45 +00:00
|
|
|
message()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
progress $*
|
|
|
|
dialog --title "Progress" --infobox "$*" -1 -1
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# A simple error dialog.
|
1994-11-18 12:54:45 +00:00
|
|
|
error()
|
|
|
|
{
|
1994-11-21 04:35:26 +00:00
|
|
|
echo "ERROR <$*>" > /dev/ttyv1
|
1994-11-28 22:13:07 +00:00
|
|
|
dialog --title "Error!" --msgbox "$*" -1 -1
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Something isn't supported yet! :-(
|
1994-11-18 12:54:45 +00:00
|
|
|
not_supported()
|
|
|
|
{
|
1994-11-21 04:35:26 +00:00
|
|
|
echo "<Feature not supported>" > /dev/ttyv1
|
1994-11-28 22:13:07 +00:00
|
|
|
dialog --title "Sorry!" --msgbox \
|
|
|
|
"This feature is not supported in the current version of the
|
|
|
|
installation tools. Barring some sort of fatal accident, we do
|
|
|
|
expect it to be in a later release. Please press RETURN to go on." -1 -1
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Get a string from the user
|
|
|
|
input()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
TITLE=${TITLE-"User Input Required"}
|
|
|
|
dialog --title "${TITLE}" \
|
|
|
|
--inputbox "$*" -1 -1 "${DEFAULT_VALUE}" 2> ${TMP}/inputbox.tmp.$$
|
1994-11-16 07:51:45 +00:00
|
|
|
if ! handle_rval $?; then rm -f ${TMP}/inputbox.tmp.$$; return 1; fi
|
1994-11-28 22:13:07 +00:00
|
|
|
ANSWER=`cat ${TMP}/inputbox.tmp.$$`
|
1994-11-16 07:51:45 +00:00
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
}
|
|
|
|
|
|
|
|
# Ask a networking question
|
|
|
|
network_dialog()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
TITLE="Network Configuration"
|
1994-11-16 07:51:45 +00:00
|
|
|
if ! input "$*"; then return 1; fi
|
|
|
|
}
|