Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
1
#!/bin/bash
APPNAME="EazyTranslator"
APPVER="0.96a Setup"
APPFILEDIR=`pwd`
APPFILENAME="translate"
function title {
clear
echo $APPNAME" "$APPVER" - (C) 2001 Thomas Lahn (webmaster@PointedEars.de)"
}
function Error {
echo
pause "c"
}
function EFailed {
echo -e "$rc_failed"
Error
}
X=""
function val2x {
case $1 in
-1) X="-";;
0) X=" ";;
1) X="x";;
esac
}
# Acquire default text values for process success/failure messages
. /etc/rc.config
if [ -n "$1" ]; then CPDEST=$1 ; else CPDEST="/opt/EazyTrans" ; fi
CREATELNK=1
MODI_USERS=1
MODI_ROOT=1
MODI_SKEL=1
YES="Yes!"
NO="No."
DEF="Default"
YESNO="$YES $NO"
YESNODEF="$YES $NO $DEF"
CONTINUE=0
while [ $CONTINUE -eq 0 ]; do
title
echo
# if [ `whoami` != "root" ]; then echo "Sorry, only 'root' can do this!" ; echo ; exit 1 ; fi
echo "This program will do the following:"
echo
echo "1) Copy the program files to: '"$CPDEST"'"
val2x $CREATELNK
echo "2) ["$X"] Create a symbolic link to /usr/bin"
val2x $MODI_USERS
echo "3) ["$X"] Modify the ~/.bashrc file of existing users (default)"
val2x $MODI_ROOT
echo "4) ["$X"] Modify the /root/.bashrc file (default)"
val2x $MODI_SKEL
echo "5) ["$X"] Modify the /etc/skel/.bashrc file (default)"
echo
echo "Select the value to be changed, proceed with these values or cancel:"
OPT_PROCEED="Proceed!"
OPT_CANCEL="Cancel."
OPTIONS="1 2 3 4 5 $OPT_PROCEED $OPT_CANCEL"
select SELOPT in $OPTIONS; do
case $SELOPT in
"1")
echo
echo "Where should the program files be copied to? (RETURN cancels):"
echo -n "> "
read S
if [ -n "$S" ]; then CPDEST=$S ; fi
break;;
"2")
echo
echo "Should a symbolic link '/usr/bin/"$APPFILENAME"' be created"
echo "so that the program becomes available to all users?"
select SELOPT in $YESNODEF; do
case $SELOPT in
$YES)
CREATELNK=1
break;;
$NO)
CREATELNK=0
break;;
$DEF)
CREATELNK=1
break;;
*)
echo "Bad option"
echo;;
esac
done
break;;
"3")
echo
echo "Should the ~/.bashrc file of existing users be modified"
echo "so that they can use the global dictionary files without typing a path?"
select SELOPT in $YESNODEF; do
case $SELOPT in
$YES)
MODI_USERS=1
break;;
$NO)
MODI_USERS=0
break;;
$DEF)
MODI_USERS=1
break;;
*)
echo "Bad option"
echo;;
esac
done
break;;
"4")
echo
echo "Should /root/.bashrc be modified so that 'root' can use"
echo "the global dictionary files without typing a path?"
select SELOPT in $YESNODEF; do
case $SELOPT in
$YES)
MODI_ROOT=1
break;;
$NO)
MODI_ROOT=0
break;;
$DEF)
MODI_ROOT=1
break;;
*)
echo "Bad option"
echo
esac
done
break;;
"5")
echo
echo "Should /etc/skel/.bashrc be modified so that new users"
echo "can use the global dictionary files without typing a path?"
select SELOPT in $YESNODEF; do
case $SELOPT in
$YES)
MODI_SKEL=1
break;;
$NO)
MODI_SKEL=0
break;;
$DEF)
MODI_SKEL=1
break;;
*)
echo "Bad option"
echo
esac
done
break;;
$OPT_PROCEED)
title
echo
echo "Creating program directory '"$CPDEST"'"
if [ -d
if [ -x "$APPFILENAME" ]; then
ln -s -v $APPFILEDIR/$APPFILENAME /usr/bin/$APPFILENAME
else
echo $0": Unable to find the file "$APPFILEDIR/$APPFILENAME"' in current directory."
fi
echo
echo
exit 0;;
$OPT_CANCEL)
title
echo
echo "Canceled."
echo
exit 0;;
*)
break;;
esac
done
done
exit 0