head 1.5; access; symbols OPENPKG_E1_MP_HEAD:1.5 OPENPKG_E1_MP:1.5 OPENPKG_E1_MP_2_STABLE:1.5.2.2 OPENPKG_E1_FP:1.5.2.2 OPENPKG_2_STABLE_MP:1.5 OPENPKG_2_STABLE_20061018:1.5.2.2 OPENPKG_2_STABLE:1.5.0.2 OPENPKG_CW_FP:1.4; locks; strict; comment @# @; 1.5 date 2006.08.25.19.20.14; author rse; state Exp; branches 1.5.2.1; next 1.4; commitid Tvsj1UyQ8rQ89gKr; 1.4 date 2004.08.30.13.43.40; author rse; state Exp; branches; next 1.3; 1.3 date 2004.08.02.18.08.49; author rse; state Exp; branches; next 1.2; 1.2 date 2004.05.23.11.19.41; author rse; state Exp; branches; next 1.1; 1.1 date 2003.08.28.13.55.39; author rse; state Exp; branches; next ; 1.5.2.1 date 2006.08.25.19.20.14; author rse; state dead; branches; next 1.5.2.2; commitid iZxwRSmmWscPXUQr; 1.5.2.2 date 2006.10.16.14.57.40; author rse; state Exp; branches; next ; commitid iZxwRSmmWscPXUQr; desc @@ 1.5 log @replace '@@l_prefix@@/lib/openpkg/bash @@l_prefix@@/etc/rc' in shebang with '@@l_prefix@@/bin/openpkg rc' to allow people who run the rc.xxx scripts directly (as executables) to leverage from the Set-UID functionality @ text @#!@@l_prefix@@/bin/openpkg rc ## ## rc.uvscan -- Run-Commands ## %config uvscan_enable="$openpkg_rc_def" uvscan_dat="ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/" uvscan_update="daily" %common uvscan_update () { # determine information i=0 while [ $i -lt 3 ]; do uvscan_datfile=`@@l_prefix@@/bin/curl -s "${uvscan_dat}" 2>/dev/null |\ grep 'dat-[0-9][0-9]*\.tar' | sort | tail -1 |\ sed -e 's;^.*\(dat-[0-9][0-9]*\.tar\).*$;\1;'` if [ ".${uvscan_datfile}" != . ]; then break else sleep 10 fi i=$(($i + 1)) done if [ ".${uvscan_datfile}" = . ]; then echo "rc:uvscan:ERROR: unable to determine latest DAT file version" 1>&2 return 1 fi uvscan_tmpdir=`echo "${uvscan_datfile}" | sed -e 's;\.tar$;;'` uvscan_datadir="@@l_prefix@@/var/uvscan/data" # determine old (installed) and new (available) versions uvscan_version_new=`echo "${uvscan_datfile}" | sed -e 's;^dat-;;' -e 's;\.tar$;;'` uvscan_version_old=`(cat "${uvscan_datadir}/VERSION") 2>/dev/null` if [ ".${uvscan_version_new}" = ".${uvscan_version_old}" ]; then # still no need for updating return 0 fi # download and unpack latest DATs umask 077 cd ${uvscan_datadir} || return 1 rm -f ${uvscan_datfile} >/dev/null 2>&1 || true i=0 while [ $i -lt 3 ]; do @@l_prefix@@/bin/curl -s -o ${uvscan_datfile} \ ${uvscan_dat}/${uvscan_datfile} || return 1 if [ $? -eq 0 ]; then break else rm -f ${uvscan_datfile} >/dev/null 2>&1 || true sleep 10 fi i=$(($i + 1)) done if [ ! -f ${uvscan_datfile} ]; then echo "rc:uvscan:ERROR: unable to download latest DAT file" 1>&2 return 1 fi rm -rf ${uvscan_tmpdir} >/dev/null 2>&1 || true mkdir ${uvscan_tmpdir} ( cd ${uvscan_tmpdir} && \ @@l_prefix@@/bin/tar -xf ../${uvscan_datfile} ) || return 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 . echo "${uvscan_version_new}" >VERSION # cleanup rm -f ${uvscan_datfile} >/dev/null 2>&1 || true rm -rf ${uvscan_tmpdir} >/dev/null 2>&1 || true } %quarterly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .quarterly ]; then uvscan_update || exit $? fi %hourly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .hourly ]; then uvscan_update || exit $? fi %daily -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .daily ]; then uvscan_update || exit $? fi %weekly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .weekly ]; then uvscan_update || exit $? fi @ 1.5.2.1 log @file rc.uvscan was added on branch OPENPKG_2_STABLE on 2006-10-16 14:57:40 +0000 @ text @d1 100 @ 1.5.2.2 log @Mass merge from CURRENT to 2-STABLE (all packages except those of JUNK class) @ text @a0 100 #!@@l_prefix@@/bin/openpkg rc ## ## rc.uvscan -- Run-Commands ## %config uvscan_enable="$openpkg_rc_def" uvscan_dat="ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/" uvscan_update="daily" %common uvscan_update () { # determine information i=0 while [ $i -lt 3 ]; do uvscan_datfile=`@@l_prefix@@/bin/curl -s "${uvscan_dat}" 2>/dev/null |\ grep 'dat-[0-9][0-9]*\.tar' | sort | tail -1 |\ sed -e 's;^.*\(dat-[0-9][0-9]*\.tar\).*$;\1;'` if [ ".${uvscan_datfile}" != . ]; then break else sleep 10 fi i=$(($i + 1)) done if [ ".${uvscan_datfile}" = . ]; then echo "rc:uvscan:ERROR: unable to determine latest DAT file version" 1>&2 return 1 fi uvscan_tmpdir=`echo "${uvscan_datfile}" | sed -e 's;\.tar$;;'` uvscan_datadir="@@l_prefix@@/var/uvscan/data" # determine old (installed) and new (available) versions uvscan_version_new=`echo "${uvscan_datfile}" | sed -e 's;^dat-;;' -e 's;\.tar$;;'` uvscan_version_old=`(cat "${uvscan_datadir}/VERSION") 2>/dev/null` if [ ".${uvscan_version_new}" = ".${uvscan_version_old}" ]; then # still no need for updating return 0 fi # download and unpack latest DATs umask 077 cd ${uvscan_datadir} || return 1 rm -f ${uvscan_datfile} >/dev/null 2>&1 || true i=0 while [ $i -lt 3 ]; do @@l_prefix@@/bin/curl -s -o ${uvscan_datfile} \ ${uvscan_dat}/${uvscan_datfile} || return 1 if [ $? -eq 0 ]; then break else rm -f ${uvscan_datfile} >/dev/null 2>&1 || true sleep 10 fi i=$(($i + 1)) done if [ ! -f ${uvscan_datfile} ]; then echo "rc:uvscan:ERROR: unable to download latest DAT file" 1>&2 return 1 fi rm -rf ${uvscan_tmpdir} >/dev/null 2>&1 || true mkdir ${uvscan_tmpdir} ( cd ${uvscan_tmpdir} && \ @@l_prefix@@/bin/tar -xf ../${uvscan_datfile} ) || return 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 . echo "${uvscan_version_new}" >VERSION # cleanup rm -f ${uvscan_datfile} >/dev/null 2>&1 || true rm -rf ${uvscan_tmpdir} >/dev/null 2>&1 || true } %quarterly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .quarterly ]; then uvscan_update || exit $? fi %hourly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .hourly ]; then uvscan_update || exit $? fi %daily -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .daily ]; then uvscan_update || exit $? fi %weekly -u @@l_musr@@ rcService uvscan enable yes || exit 0 if [ ".$uvscan_update" = .weekly ]; then uvscan_update || exit $? fi @ 1.4 log @make downloading more robust and perform retries @ text @d1 1 a1 1 #!@@l_prefix@@/lib/openpkg/bash @@l_prefix@@/etc/rc @ 1.3 log @download only if necessary and allow checking every 15 minutes @ text @d14 17 a31 4 uvscan_datfile=`@@l_prefix@@/bin/curl -s "$uvscan_dat" 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$;;'` d45 16 a60 2 @@l_prefix@@/bin/curl -s -o ${uvscan_datfile} \ ${uvscan_dat}/${uvscan_datfile} || return 1 @ 1.2 log @align variables with clamav and sav @ text @d20 8 d30 1 a30 1 cd ${uvscan_datadir} || exit 1 d33 1 a33 1 ${uvscan_dat}/${uvscan_datfile} || exit 1 d36 3 a38 1 ( cd ${uvscan_tmpdir} && @@l_prefix@@/bin/tar -xf ../${uvscan_datfile} ) || exit 1 d43 1 a43 2 uvscan_version=`echo "${uvscan_datfile}" | sed -e 's;^dat-;;' -e 's;\.tar$;;'` echo "${uvscan_version}" >VERSION d50 6 @ 1.1 log @completely overhaul this package to make it equal in functionality to 'sav' @ text @d8 2 a9 2 uvscan_dat_url="ftp://ftp.nai.com/pub/antivirus/datfiles/4.x/" uvscan_dat_update="daily" a11 1 rcService uvscan enable yes || exit 0 d15 1 a15 1 uvscan_datfile=`@@l_prefix@@/bin/curl -s "$uvscan_dat_url" 2>/dev/null |\ d25 1 a25 1 ${uvscan_dat_url}/${uvscan_datfile} || exit 1 d43 1 a43 1 if [ ".$uvscan_dat_update" = .hourly ]; then d49 1 a49 1 if [ ".$uvscan_dat_update" = .daily ]; then d55 1 a55 1 if [ ".$uvscan_dat_update" = .weekly ]; then @