# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils python IUSE="doc" #http://free.grisoft.com/filedir/inst/avg75flr-r51-a1243.i386.rpm #http://free.grisoft.com/filedir/doc/LINUX_GROUP/AVG_Free_for_Linux/avg_afl_uma_en_75_1.pdf G_URI="http://free.grisoft.com" AVG_N="avg75flr" #AVG_V="${PV/.24/-24}_free_rh_a1243.i386" AVG_V="r51-a1243.i386" RPM_N="${AVG_N}-${AVG_V}" DOC_N="avg_afl_uma_en_75_1.pdf" DESCRIPTION="Grisoft AVG Anti-Virus for Linux" HOMEPAGE="http://free.grisoft.com" SRC_URI="${G_URI}/filedir/inst/${RPM_N}.rpm doc? ( ${G_URI}/doc/LINUX_GROUP/AVG_Free_for_Linux/${DOC_N} )" LICENSE="free-noncomm" SLOT="0" KEYWORDS="~x86" DEPEND="app-arch/rpm2targz sys-apps/sed" # since avg delivers compiled binaries, # we need to freeze expat and include # lib-compat otherwise it won't run on # development platforms, like ~x86, etc. RDEPEND=">=dev-lang/python-2.2 >=gnome-base/libglade-2.0 >=dev-python/pygtk-2.0" # sys-libs/lib-compat" pkg_setup() { # set group and user for directory access rights enewgroup avg enewuser avg -1 -1 -1 avg -c "AVG Anti-Virus User" } src_unpack() { rpm2targz ${DISTDIR}/${RPM_N}.rpm tar -zxf ${WORKDIR}/${RPM_N}.tar.gz } src_compile() { # do some sed magic for correct dir access cd ${WORKDIR}/opt/grisoft/avg7/etc sed -i -e {s:/opt/grisoft/avg7/var/:/var/avg7/:} avg.conf #we've moved license_cz to the doc directory. Forget about it. cd ${WORKDIR}/opt/grisoft/avggui/prog sed -i -e {s:\'license_cz_utf8.txt:\#\'license_cz_utf8.txt:} sysdep.py } src_install() { # AVG wants everything in opt, but some things # should be in /var. Selective copy cd ${WORKDIR} dodir /opt/grisoft/avg7 dodir /opt/grisoft/avg7/doc keepdir /opt/grisoft/avg7/var/run keepdir /var/avg7/update/backup keepdir /var/avg7/update/download keepdir /var/avg7/update/log keepdir /var/avg7/update/preinstall dodir /usr/bin /usr/sbin dodir /etc /etc/init.d /etc/pam.d dosym /opt/grisoft/avg7/bin/avgdmilter /usr/bin/avgdmilter dosym /opt/grisoft/avggui/bin/avggui /usr/bin/avggui dosym /opt/grisoft/avggui/bin/avgqrtctl /usr/bin/avgqrtctl dosym /opt/grisoft/avg7/bin/avgscan /usr/bin/avgscan dosym /opt/grisoft/avggui/bin/avgspmctl /usr/bin/avgspmctl dosym /opt/grisoft/avg7/bin/avgupdate /usr/bin/avgupdate dosym /opt/grisoft/avggui/bin/pamwrap /usr/sbin/pamwrap # now desktop icon and file insinto /usr cd usr doins -r share cd .. # everything in opt/ taking care with var and license file cd opt/grisoft/avg7 exeinto /opt/grisoft/avg7/bin doexe bin/* insinto /opt/grisoft/avg7 doins -r data etc lib insinto /opt/grisoft/avg7/doc doins doc/license* # copy /etc stuff doinitd ${FILESDIR}/avgd exeinto /etc/cron.daily doexe ${FILESDIR}/avgupdate.cron dosym /opt/grisoft/avg7/etc/avg.conf /etc/avg.conf dosym /opt/grisoft/avggui/config/avggui /etc/pam.d/avggui # man pages cd man doman man1/* man5/* # doc cd ../doc dodoc * # avggui dir cd ${WORKDIR}/opt/grisoft/avggui exeinto /opt/grisoft/avggui/bin doexe bin/* insinto /opt/grisoft/avggui doins -r config glade prog # copy manual if requested if use doc; then insinto /usr/share/doc/${PF}/manual doins ${DISTDIR}/${DOC_N} else einfo "AVG Manual not installed..." fi } pkg_preinst() { chown -R avg:avg ${D}/opt/grisoft/avg7 chown -R avg:avg ${D}/var/avg7 chown avg:avg ${D}/etc/avg.conf # this dir must be g+w otherwise update won't run for user chmod -R 0775 ${D}/opt/grisoft/avg7/data chmod -R 0775 ${D}/opt/grisoft/avg7/var/run chmod -R 0775 ${D}/var/avg7 chmod 0775 ${D}/etc/avg.conf # these two files need to be SetUID to work chmod 4711 ${D}/opt/grisoft/avggui/bin/pamwrap chmod 4711 ${D}/opt/grisoft/avg7/bin/avgupdate touch ${D}/opt/grisoft/avg7/data/set_vers.cfg touch ${D}/opt/grisoft/avggui/config/userinfo.cfg # compile python modules python_mod_optimize ${D}/opt/grisoft/avggui/prog } pkg_postinst() { local DAZUKO # see if Dazuko is installed DAZUKO=`/sbin/lsmod | grep dazuko` if [ -z "${DAZUKO}" ]; then ewarn "The Dazuko kernel driver is not installed." ewarn "AVG cannot run its daemon without it." einfo "You may run the programs on demand though." einfo "The daemon file has been installed to /etc/init.d" einfo "for future use when Dazuko is installed." else einfo "The avgd daemon has been installed to /etc/init.d and" einfo "can be added to the init sequence by running" einfo "rc-update add avgd default." fi echo einfo "In addition, a daily cron job file has been installed" einfo "to /etc/cron.daily which will download updates every day." einfo "To activate, simply uncomment the avgupdate line." einfo "You may designate users to run AVG with update privileges" einfo "by making them members of the group \`avg'." echo if ! use doc; then einfo "There is an avg manual, but it was not installed" einfo "because the doc use flag was not specified." einfo "You may download it at http://free.grisoft.com or add" einfo " app-antivirus/avgfree doc" einfo "to the /etc/portage/package.use file." einfo "Example:" einfo "echo \"app-antivirus/avgfree doc\" >> /etc/portage/package.use" echo else einfo "AVG Manual was copied to /usr/share/doc/${PF}/manual" fi einfo "Registering Product" /usr/bin/avgscan -register 70FREE-TX-IB-P1-C01-S139FC-327-9FPB &>/dev/null echo einfo "AVG Anti-Virus Free Edition ${PV} has been installed." einfo "Please read the man pages and documentation." } pkg_postrm() { # clear out stuff only if unmerge completed. If # it's an update, forget it. if [ ! -f /opt/grisoft/avg7/bin/avgupdate ]; then einfo "cleaning out /etc and other files left over..." rm -frv /opt/grisoft rm -frv /var/avg7 rm -fv /etc/avg.conf /etc/init.d/avgd /etc/cron.daily/avgupdate.cron \ /etc/pam.d/avggui fi }