Begin work on config tool

master
bbruns 2010-11-18 19:54:43 +00:00
parent 2ae4d264f0
commit 890c66cba0
1 changed files with 13 additions and 4 deletions

View File

@ -28,9 +28,11 @@ AUTOCONFIG_BIN="iptables:IPTABLES ip6tables:IP6TABLES modprobe:MODPROBE"
# These are string variables
WELCOME_HEAD="Welcome to the Firewall/SOSDG Config Tool v${CONFIGTOOL_VER}"
TOOL_TITLE="Welcome to the Firewall/SOSDG Config Tool v${CONFIGTOOL_VER}"
WELCOME_BODY="This tool is a quick way to do a basic setup of the firewall script.\n\nThe results of this tool will be output to a file of your choosing at the end of configuration.\nContinue?"
AUTOCONFIG_PATHS="Would you like to try to configure paths of important programs automatically?"
FAILED_BINS="The following binaries were not found on this system:"
FAILED_BINS_FOOT="Please edit the config file by hand and put in the proper path."
if [ ! -x $WHIPTAIL ]; then
echo "Error: please make sure you have whiptail installed, and the WHIPTAIL variable
@ -39,7 +41,7 @@ if [ ! -x $WHIPTAIL ]; then
exit 1
fi
if ! ( $WHIPTAIL --yesno "${WELCOME_HEAD}\n${WELCOME_BODY}" 12 70 --no-button "Quit" ); then
if ! ( $WHIPTAIL --title "${TOOL_TITLE}" --yesno "${WELCOME_BODY}" 12 70 --no-button "Quit" ); then
echo "Quitting config tool."
rm -f "$TMPCONFIG"
exit 1
@ -52,16 +54,23 @@ else
exit 1
fi
if ( $WHIPTAIL --yesno "${AUTOCONFIG_PATHS}" 10 40 ); then
if ( $WHIPTAIL --title "${TOOL_TITLE}" --yesno "${AUTOCONFIG_PATHS}" 10 40 ); then
unset FAILED_CMD_PATH
for i in $AUTOCONFIG_BIN; do
IFS_OLD=${IFS};IFS=:
BIN_PATH=($i)
IFS=${IFS_OLD}
if ( ${WHICH} ${BIN_PATH[0]} ); then
if ( ${WHICH} ${BIN_PATH[0]}&>/dev/null ); then
BIN_FULL="`${WHICH} ${BIN_PATH[0]}`"
echo "${BIN_PATH[1]}=\"${BIN_FULL}\"" >>"${TMPCONFIG}"
else
FAILED_CMD_PATH="${FAILED_CMD_PATH} ${BIN_PATH[0]"
echo "#${BIN_PATH[1]}=\"\"" >>"${TMPCONFIG}"
fi
done
if [ $FAILED_CMD_PATH ]; then
$WHIPTAIL --title "${TOOL_TITLE}" --msgbox "${FAILED_BINS}\n${FAILED_CMD_PATH}\n${FAILED_BINS_FOOT}" 10 60
fi
#
#else
fi