-
Junior Member
registered user
Howdy. Ive actually modified the old fprot script to use dialogs. I dont have the net so i dont know if this works, so let me know! So here it is anyway. just modify what is needed from the post above 
Code:
#!/bin/bash
#
# install_fprot - Install fprot. Userful in combination with persistant home
# Author Fabian Franz <[email protected]>
# Allan Stones <[email protected]>
# Licensed under the GPL
#
VERSION="1.0"
FPROT_NAME="fp-linux-sb.tar.gz"
FPROT_DIR="$HOME/software/f-prot/"
FPROT_DL_PATH="ftp://ftp.f-prot.com/pub/linux/"
[ -z "$HOME" ] && HOME="/home/knoppix"
INTERACTIVE="yes"
clean_exit()
{
[ -n "$TMP" ] && rm -f "$TMP"
}
function setup_dialog()
{
# Set up dialog
XDIALOG_HIGH_DIALOG_COMPAT=1
export XDIALOG_HIGH_DIALOG_COMPAT
TMP="/tmp/install_fprot.tmp$$"
DIALOG="dialog"
[ -n "$DISPLAY" ] && [ -x /usr/bin/Xdialog ] && DIALOG="Xdialog"
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
MAX=4 # number of steps
case "$LANGUAGE" in
*)
BT="F-Prot-Installation"
T1="Installation of F-Prot (Step 0/$MAX)"
ET="Installation failed"
ST="Installation succeeded"
MESSAGE0="This script installs the F-Prot Antivirus from the internet or from a directory of your choice.\n\nAuthors: Fabian Franz <[email protected]>\n Allan Stones <[email protected]>"
MESSAGE1="Shall F-Prot be downloaded from the internet?"
MESSAGE2="Please insert the directory name, where $FPROT_NAME can be found."
MESSAGE3="PATH not found. The script will be terminated."
MESSAGE4="F-Prot Antivirus was successfully installed."
MESSAGE5="Script aborted by user"
MESSAGE6="ERROR occured during installation."
;;
esac
N=1; # Step 1
}
while [ $# -ne 0 ];
do
case "$1" in
"-ni"|"--non-interactive")
INTERACTIVE="no"
;;
"-i"|"-interactive")
INTERACTIVE="yes"
;;
"-h"|"--help")
echo "Usage: install_fprot [OPTION]..."
echo " -i, --interactive - Interactive Dialog mode (default)"
echo " -h, --help - This help"
echo " -l, --location <directory> - Where to find the flashplugin"
echo " -ni, --non-interactive - Non interactive install mode"
echo " if not given it is downloaded"
echo " from the internet"
echo " -v, --version - Display Version information"
exit 1
;;
"-l"|"--location")
FPROT_PATH=$2
;;
"-v"|"--version")
echo "install_fprot.sh Version 1.0 for Knoppix 3.2 (03-03-2003)"
echo "---------------------------------------------------------"
echo "Authors: Fabian Franz <[email protected]>"
echo " Allan Stones <[email protected]>"
echo ""
echo "Description: This script installs the F-Prot"
echo " Antivirus from the internet or"
echo " from a directory of your choice."
echo ""
echo "Licensed under the GPL"
exit 1
;;
*)
echo "install_fprot.sh does not recognise this commandline argument."
exit 1
;;
esac
shift
done
[ "$INTERACTIVE" = "yes" ] && setup_dialog
if [ -n "$DIALOG" ]; then
#Introduction Message
$DIALOG --backtitle "$BT" --title "${T1/0/$N}" --msgbox "$MESSAGE0" 15 70
N=$(($N+1))
#Shall F-Prot be downloaded from the internet?
$DIALOG --backtitle "$BT" --title "${T1/0/$N}" --yesno "$MESSAGE1" 15 70
# Grab result of yesno box
EXIT_CODE=$?
N=$(($N+1))
case $EXIT_CODE in
0) # Yes, then download from net
cd /tmp
if [ $DIALOG = "dialog" ]; then
wget $FROT_DL_PATH
else
xterm -e wget $FROT_DL_PATH
fi
N=$(($N+1))
;;
1) # No, then select path where file is located
cd /tmp
$DIALOG --backtitle "$BT" --title "${T1/0/$N}" --inputbox "$MESSAGE2" 15 70 "$FPROT_PATH" 2>$TMP
EXIT_CODE=$?
case $EXIT_CODE in
0) # Yes
N=$(($N+1))
FROT_PATH=$(<$TMP)
if [ -e $FROT_PATH/$FROT_NAME ]; then
cp $FROT_PATH/$FROT_NAME /tmp
else
$DIALOG --backtitle "$BT" --title "$ET" --msgbox "${MESSAGE3/PATH/$FROT_PATH/$FROT_NAME}" 15 70 # error!
exit 1
fi
;;
1) # Aborted by user
$DIALOG --backtitle "$BT" --title "$ET" --msgbox "$MESSAGE5" 15 70
exit 1
;;
255) # Error
$DIALOG --backtitle "$BT" --title "$ET" --msgbox "$MESSAGE6" 15 70
exit 1
;;
esac
;;
255) # Error occured during installation
$DIALOG --backtitle "$BT" --title "$ET" --msgbox "$MESSAGE6" 15 70
exit 1
;;
esac
# Now we should have a /tmp/$FROT_NAME
if [ -e /tmp/$FROT_NAME ];
then
mkdir $HOME/software
cp /tmp/$FROT_NAME $HOME/software
cd $HOME/software
tar xzf $FROT_NAME
mkdir -p $HOME/man/man8
mkdir -p $HOME/bin
ln -fs $(pwd)/f-prot/f-prot.sh $HOME/bin/f-prot
ln -fs $(pwd)/f-prot/check-updates.sh $HOME/bin/check-updates
ln -fs $(pwd)/fprot/man8/f-prot.8 $HOME/man/man8/
ln -fs $(pwd)/fprot/man8/check-updates.sh.8 $HOME/man/man8/
# Setting up Manpath & PATH for f-prot
cp $HOME/.bashrc $HOME/.bashrc.templ
cat $HOME/.bashrc.templ | grep -v "export MANPATH=\$HOME/man" | grep -v "export PATH=\$HOME/bin/"> $HOME/.bashrc
echo "export MANPATH=\$HOME/man/:\$MANPATH" >> $HOME.bashrc
echo "export PATH=\$HOME/bin:\$PATH" >> $HOME/.bashrc
rm -rf $HOME/.bashrc.templ
# Fix paths
cp f-prot/f-prot.sh /tmp/f-prot.$$
sed 's%/usr/local/f-prot/%`$(pwd)`/f-prot/%g' /tmp/f-prot.$$ > f-prot/f-prot.sh
cp f-prot/check-updates.sh /tmp/check-updates.$$
sed 's%/usr/local/f-prot/%`$(pwd)`/f-prot/%g' /tmp/check-updates.$$ > f-prot/check-updates.sh
RC=$?
cd ..
#cleanup
rm -rf /tmp/f-prot.$$
rm -rf /tmp/check-updates.$$
rm -rf fp-linux-sb.tar.gz
rm -rf /tmp/f*
else # /tmp/$FROT_NAME not found
$DIALOG --backtitle "$BT" --title "$ET" --msgbox "${MESSAGE3/PATH/tmp/$FROT_NAME}" 15 70 # error!
exit 1
fi
$DIALOG --backtitle "$BT" --title "$ST" --msgbox "$MESSAGE4" 15 70
else # non interactive
cd /tmp
if [ -n "$FROT_PATH" ];
then
cp $FROT_PATH/$FROT_NAME /tmp
else
wget $FROT_DL_PATH
fi
if [ -f /tmp/$FROT_NAME ];
then
cp /tmp/$FROT_NAME $HOME/software
cd $HOME/software
tar xzf $FROT_NAME
mkdir -p $HOME/man/man8
mkdir -p $HOME/bin
ln -fs $(pwd)/f-prot/f-prot.sh $HOME/bin/f-prot
ln -fs $(pwd)/f-prot/check-updates.sh $HOME/bin/check-updates
ln -fs $(pwd)/fprot/man8/f-prot.8 $HOME/man/man8/
ln -fs $(pwd)/fprot/man8/check-updates.sh.8 $HOME/man/man8/
# Setting up Manpath & PATH for f-prot
cp $HOME/.bashrc $HOME/.bashrc.templ
cat $HOME/.bashrc.templ | grep -v "export MANPATH=\$HOME/man" | grep -v "export PATH=\$HOME/bin/"> $HOME/.bashrc
echo "export MANPATH=\$HOME/man/:\$MANPATH" >> $HOME.bashrc
echo "export PATH=\$HOME/bin:\$PATH" >> $HOME/.bashrc
rm -rf $HOME/.bashrc.templ
# Fix paths
cp f-prot/f-prot.sh /tmp/f-prot.$$
sed 's%/usr/local/f-prot/%`$(pwd)`/f-prot/%g' /tmp/f-prot.$$ > f-prot/f-prot.sh
cp f-prot/check-updates.sh /tmp/check-updates.$$
sed 's%/usr/local/f-prot/%`$(pwd)`/f-prot/%g' /tmp/check-updates.$$ > f-prot/check-updates.sh
RC=$?
cd ..
#cleanup
rm -rf /tmp/f-prot.$$
rm -rf /tmp/check-updates.$$
rm -rf fp-linux-sb.tar.gz
rm -rf /tmp/f*
else
echo "Error accessing /tmp/$FROT_NAME"
exit 1
fi
fi
exit 0 # Success!
[Edited by Fabianx to have it as code]
Similar Threads
-
By freeballer in forum Customising & Remastering
Replies: 0
Last Post: 10-13-2003, 11:26 PM
-
By Fabianx in forum Ideas
Replies: 13
Last Post: 10-03-2003, 08:22 PM
-
By Fabianx in forum Ideas
Replies: 6
Last Post: 04-19-2003, 04:28 AM
-
By Fabianx in forum Ideas
Replies: 0
Last Post: 03-30-2003, 01:36 PM
-
By Fabianx in forum Ideas
Replies: 0
Last Post: 03-30-2003, 02:29 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

IBM System X3850-X5 Server w/4x Intel Xeon E7-4870 CPU , 512 GB DDR3 RAM,NO HDD
$1299.99

IBM QRadar xx29 2x Xeon E5-2650v4 2x 900W PSU M5120 12x 3.5" Bay Server No RAM
$179.99

Unused IBM 09P0037 MAINBOARD For RS/6000 7044-170 P-Series
$375.00

IBM ADP Server Type 7870 AC1 NO HDD | 128GB RAM PC3L | 2 x Xeon E5620
$199.99

Compaq ProLiant 1500R 5/100 rack server, Series 3155, with IBM 2.1GB HD, VINTAGE
$295.00

IBM SYSTEM X3500 M3 SERVER 7380AC1 TOWER Server XEON E5620 8GB RAID SEE NOTES
$110.30

IBM 4262 SYSTEM x3200 Tower - HDD Wiped, NO OS
$80.00

IBM SYSTEM X3550 M5 5463AC1 2.5x8 Server 2*XEON E5-2640 V3 8GB SEE NOTES
$85.99

Rare Vintage IBM 93ZZ PowerPC Server Board - MCM Ceramic CPU - 40N1844 - 1.1 lbs
$49.99

IBM Server Rackmount Sliding Rail Kit ( Part Numbers: 00D9375 / 00D9374 )
$24.99