how to clamav and nautilus extension ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all

I've recently install clamAV anti-virus on my FC 11(as I'm sharing files with windows pc also ), it works fine .... but there is one question in my mind that .. is it possible to add scan option in mouse right-click ( may be as Nautilus extensions )

I've tried this[1] script ( copied it to ~/.gnome2/nautilus-script/virus-scan ) it tries to scan file and finally gives the error like

file is not accessible (the file which I'm trying to scan ...in my home folder )

[1]
------------------------------------------------------------------------------------------------------------
#!/bin/bash

#  Set some variables used in the script
files=$1
if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
        files_path=$HOME"/Desktop"
else
files_path=`echo $NAUTILUS_SCRIPT_CURRENT_URI | sed -e 's/^file:\/\///'`
fi
gui=`which zenity`
vscan=`which clamscan`

#  Function to scan file(s)
scan_it()
{
        touch /tmp/scanresult
        if [ "$files_path" = "" ]; then
# Script can run from launchers, scripts other than from Nautilus, etc. (doesn't require $NAUTILUS_SCRIPT_CURRENT_URI) result=`$vscan -r "$files" --log=/tmp/scanresult | $gui --title "Virus Scanner" --progress \ --text="Scanning $files..." --pulsate --auto-close; cat /tmp/scanresult` &> /dev/null
        else
result=`$vscan -r "$files_path/$files" --log=/tmp/scanresult | $gui --title "Virus Scanner" --progress \ --text="Scanning $files..." --pulsate --auto-close; cat /tmp/scanresult` &> /dev/null
        fi
        rm -f /tmp/scanresult &> /dev/null
# Feedback - if scan ended with errors or was terminated prematurely...
        if [ "$result" = "" ]; then
                err_text="Virus scan on $files terminated!"
                errors
        fi
        #  Feedback - if scan completed successfully...
        clean=`echo $result | grep 'FOUND'`
# Alter gui feedback according to presense/absense of virus(s) found during scan
        if [ "$clean" != "" ]; then
$gui --title "Virus Found!" --error --text="$result" &> /dev/null
        else
$gui --title "Virus Scan Results!" --info --text="$result" & &> /dev/null
        fi
}
#  Function to handle errors
errors()
{
$gui --title "Virus Scan Error!" --error --text="$err_text" &> /dev/null
        exit 1
}

#  Check for presense of required utilities
if [[ -x "$vscan" && -x "$gui" ]]; then
        scan_it
else
        if [ -x "$vscan" ]; then
                echo "Zenity was NOT found on the system!"
                exit 1
        else
                err_text="Clam Anti-virus was NOT found on the system!"
                errors
        fi
fi
exit 0

---------------------------------------------------------------------------------------------------------------------------------



--
  °v°
 /(_)\
  ^ ^  Jatin Khatri

No MS

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux