Pārlūkot izejas kodu

completely overhaul this package to make it equal in functionality to 'sav'

Ralf S. Engelschall 22 gadi atpakaļ
vecāks
revīzija
bccce39b7a
3 mainītis faili ar 103 papildinājumiem un 13 dzēšanām
  1. 59 0
      uvscan/rc.uvscan
  2. 1 1
      uvscan/uvscan.sh
  3. 43 12
      uvscan/uvscan.spec

+ 59 - 0
uvscan/rc.uvscan

@@ -0,0 +1,59 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.uvscan -- Run-Commands
+##
+
+%config
+    uvscan_enable="$openpkg_rc_def"
+    uvscan_dat_url="ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/"
+    uvscan_dat_update="daily"
+
+%common
+    rcService uvscan enable yes || exit 0
+    uvscan_update () {
+        #   determine information
+        uvscan_datadir="@l_prefix@/var/uvscan/data"
+        uvscan_datfile=`@l_prefix@/bin/curl -s "$uvscan_dat_url" 2>/dev/null |\
+                        grep 'dat-[0-9][0-9]*\.tar' | sort | tail -1 |\
+                        sed -e 's;^.*\(dat-[0-9][0-9]*\.tar\).*$;\1;'`
+        uvscan_tmpdir=`echo "${uvscan_datfile}" | sed -e 's;\.tar$;;'`
+
+        #   download and unpack latest DATs
+        umask 077
+        cd ${uvscan_datadir} || exit 1
+        rm -f ${uvscan_datfile} >/dev/null 2>&1 || true
+        @l_prefix@/bin/curl -s -o ${uvscan_datfile} \
+            ${uvscan_dat_url}/${uvscan_datfile} || exit 1
+        rm -rf ${uvscan_tmpdir} >/dev/null 2>&1 || true
+        mkdir ${uvscan_tmpdir}
+        ( cd ${uvscan_tmpdir} && @l_prefix@/bin/tar -xf ../${uvscan_datfile} ) || exit 1
+
+        #   update DAT repository by installing updated DAT files
+        @l_prefix@/lib/openpkg/shtool install -m 644 -o @l_musr@ -g @l_mgrp@ \
+            ${uvscan_tmpdir}/*.dat .
+        uvscan_version=`echo "${uvscan_datfile}" | sed -e 's;^dat-;;' -e 's;\.tar$;;'`
+        echo "${uvscan_version}" >VERSION
+
+        #   cleanup
+        rm -f  ${uvscan_datfile} >/dev/null 2>&1 || true
+        rm -rf ${uvscan_tmpdir}  >/dev/null 2>&1 || true
+    }
+
+%hourly -u @l_musr@
+    rcService uvscan enable yes || exit 0
+    if [ ".$uvscan_dat_update" = .hourly ]; then
+        uvscan_update || exit $?
+    fi
+
+%daily -u @l_musr@
+    rcService uvscan enable yes || exit 0
+    if [ ".$uvscan_dat_update" = .daily ]; then
+        uvscan_update || exit $?
+    fi
+
+%weekly -u @l_musr@
+    rcService uvscan enable yes || exit 0
+    if [ ".$uvscan_dat_update" = .weekly ]; then
+        uvscan_update || exit $?
+    fi
+

+ 1 - 1
uvscan/uvscan.sh

@@ -2,4 +2,4 @@
 LD_LIBRARY_PATH="@l_prefix@/libexec/uvscan:/usr/lib:$LD_LIBRARY_PATH"
 export LD_LIBRARY_PATH
 exec @l_prefix@/libexec/uvscan/uvscan \
-    --data-directory @l_prefix@/libexec/uvscan "$@"
+    --data-directory @l_prefix@/var/uvscan/data "$@"

+ 43 - 12
uvscan/uvscan.spec

@@ -24,29 +24,29 @@
 ##
 
 #   package versions
-%define       V_engine       4.1.6
-%define       V_engine_dist1 4.16
-%define       V_engine_dist2 416
-%define       V_datfiles     4289
+%define       V_engine      4.24
+%define       V_engine_comp 424
+%define       V_datfiles    4290
 
 #   package information
 Name:         uvscan
 Summary:      McAfee VirusScan
 URL:          http://www.mcafee-at-home.com/
-Vendor:       Network Associates, Inc (NAI)
+Vendor:       Network Associates
 Packager:     The OpenPKG Project
 Distribution: OpenPKG [EVAL]
 Group:        Filesystem
 License:      Commercial/Free-Trial
-Version:      %{V_engine}.%{V_datfiles}
+Version:      %{V_engine}+%{V_datfiles}
 Release:      20030828
 
 #   list of sources
 Source0:      ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/dat-%{V_datfiles}.tar
-Source1:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/bsd/version_%{V_engine_dist1}/vbsd%{V_engine_dist2}e.tar.Z
-Source2:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/linux/version_%{V_engine_dist1}/vlnx%{V_engine_dist2}e.tar.Z
-Source3:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/sun/version_%{V_engine_dist1}/vsun%{V_engine_dist2}e.tar.Z
+Source1:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/bsd/version_%{V_engine}/vbsd%{V_engine_comp}e.tar.Z
+Source2:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/linux/version_%{V_engine}/intel/vlnx%{V_engine_comp}e.tar.Z
+Source3:      http://download.nai.com/products/evaluation/virusscan/english/cmdline/sun/version_%{V_engine}/vsun%{V_engine_comp}e.tar.Z
 Source4:      uvscan.sh
+Source5:      rc.uvscan
 %NoSource     0
 %NoSource     1
 %NoSource     2
@@ -56,7 +56,7 @@ Source4:      uvscan.sh
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 20030717
-PreReq:       OpenPKG, openpkg >= 20030717
+PreReq:       OpenPKG, openpkg >= 20030717, curl, tar
 AutoReq:      no
 AutoReqProv:  no
 
@@ -67,6 +67,8 @@ AutoReqProv:  no
 %prep
     %integrity
     %setup -q -c -T
+
+    #   unpack platform-specific Engine
     case "%{l_target}" in
         *-freebsd* ) engine="%{SOURCE1}" ;;
         *-linux*   ) engine="%{SOURCE2}" ;;
@@ -76,7 +78,9 @@ AutoReqProv:  no
     ( mkdir engine; cd engine
       %{l_gzip} -d -c $engine | %{l_tar} xf -
     ) || exit $?
-    ( mkdir datfiles; cd datfiles;
+
+    #   unpack latest DAT file set
+    ( mkdir datfiles; cd datfiles
       %{l_tar} xf %{SOURCE0}
     ) || exit $?
 
@@ -84,20 +88,47 @@ AutoReqProv:  no
 
 %install
     rm -rf $RPM_BUILD_ROOT
+
+    #   create installation hierarchy
     %{l_shtool} mkdir -f -p -m 755 \
         $RPM_BUILD_ROOT%{l_prefix}/bin \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
         $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan \
+        $RPM_BUILD_ROOT%{l_prefix}/var/uvscan/data \
         $RPM_BUILD_ROOT%{l_prefix}/man/man1
-    cp datfiles/*.dat engine/
+
+    #   install Engine
     ( cd engine
       (echo "n"; echo "n"; echo "n"; echo "n"; echo "n") |\
       ./install-uvscan $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/
     ) || exit $?
+
+    #   post-adjust Engine installation
+    for dat in clean names scan; do
+        rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/$dat.dat
+    done
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/*.txt
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/*.pdf
     rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/uninstall-uvscan
     mv  $RPM_BUILD_ROOT%{l_prefix}/libexec/uvscan/uvscan.1 \
         $RPM_BUILD_ROOT%{l_prefix}/man/man1/uvscan.1
+
+    #   install Engine command line wrapper
     %{l_shtool} install -c -m 755 %{l_value -s -a} \
         %{SOURCE uvscan.sh} $RPM_BUILD_ROOT%{l_prefix}/bin/uvscan
+
+    #   install initial DAT file set
+    %{l_shtool} install -c -m 644 \
+        datfiles/*.dat $RPM_BUILD_ROOT%{l_prefix}/var/uvscan/data/
+    echo "%{V_datfiles}" >VERSION
+    %{l_shtool} install -c -m 644 \
+        VERSION $RPM_BUILD_ROOT%{l_prefix}/var/uvscan/data/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.uvscan} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   determine installation files
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
 
 %files -f files