-
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

OPNsense Firewall VPN QAT 8-Core Atom C3758 2.20GHz 16GB DDR4 128GB SSD 8xNIC
$175.00

Ubuntu Server 26.04.1 LTS Bootable USB Flash Drive – Latest September 2026
$12.99

RED HAT ENTERPRISE LINUX 5 SERVER RHF0382US-R1 for PC x86 AMD 64 INTEL 64 30 Day
$188.24

OPNsense pfSense 8-Core Atom C3758 2.2GHz 8GB DDR4 64GB SSD 8x NIC QAT AES VPN
$115.00

Novell SUSE Linux Enterprise Server 9, Linux Professional 8.2 / 9.1 — 3 DVD Set
$58.00

ZimaBoard 2 1664 Home Server 16GB
$350.00

Start9 Server Pure 32GB 4TB Intel i7 Node StartOS — Box + PSU
$649.00

All New Ubuntu 26.04 LTS Linux Bootable USB Flash Drive
$15.95

SQL Server 2022 Enterprise 96 Core License & DVD Unlimited CALs with CoA
$284.99

Microsoft SQL Server 2019 Enterprise 40 Core Unlimited CAL Retail License FPP
$299.00