You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
2.0 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.sav -- Run-Commands
##
%config
sav_enable="$openpkg_rc_def"
sav_ides="http://downloads.sophos.com/downloads/ide/"
sav_update="daily"
%common
sav_update () {
# determine information
sav_datadir="@l_prefix@/var/sav/data"
sav_version=`@l_prefix@/bin/sweep -v |\
sed -n -e 's;^Product version[^0-9]*\([0-9]\)\.\([0-9]*\).*$;\1\2;p'`
sav_zipfile="${sav_version}_ides.zip"
sav_tmpdir="${sav_version}_ides"
# download and unpack latest IDEs
umask 077
cd ${sav_datadir} || exit 1
rm -f ${sav_zipfile} >/dev/null 2>&1 || true
@l_prefix@/bin/curl -s -o ${sav_zipfile} ${sav_ides}/${sav_zipfile} || exit 1
rm -rf ${sav_tmpdir} >/dev/null 2>&1 || true
mkdir ${sav_tmpdir}
( cd ${sav_tmpdir} && @l_prefix@/bin/unzip -jo ../${sav_zipfile} ) || exit 1
# remove deprecated IDEs which are not part of the latest IDE pack
shopt -s nullglob
for ide in *.ide; do
if [ ! -f ${sav_tmpdir}/$ide ]; then
rm -f $ide
fi
done
# update IDE repository by installing IDE files
@l_prefix@/lib/openpkg/shtool install -m 644 -o @l_musr@ -g @l_mgrp@ \
${sav_tmpdir}/*.ide .
# cleanup
rm -f ${sav_zipfile} >/dev/null 2>&1 || true
rm -rf ${sav_tmpdir} >/dev/null 2>&1 || true
}
%quarterly -u @l_musr@
rcService sav enable yes || exit 0
if [ ".$sav_update" = .quarterly ]; then
sav_update || exit $?
fi
%hourly -u @l_musr@
rcService sav enable yes || exit 0
if [ ".$sav_update" = .hourly ]; then
sav_update || exit $?
fi
%daily -u @l_musr@
rcService sav enable yes || exit 0
if [ ".$sav_update" = .daily ]; then
sav_update || exit $?
fi
%weekly -u @l_musr@
rcService sav enable yes || exit 0
if [ ".$sav_update" = .weekly ]; then
sav_update || exit $?
fi