[oe-commits] org.oe.dev clamav 0.84: Handle the /var directories correctly by making use of the
lenehan commit
openembedded-commits at lists.openembedded.org
Thu Oct 5 06:41:03 UTC 2006
clamav 0.84: Handle the /var directories correctly by making use of the
volatiles system. Previously these packages were broken after a reboot if
/var was on tmpfs due to missing directories and files. Note that the
updated virus definitions are stored in /var so they will be lost after a
reboot (but immediately re-downloaded) if using var on tmpfs.
Author: lenehan at openembedded.org
Branch: org.openembedded.dev
Revision: 9be6b44e77d5700f176e18553c62b41c1f894dc3
ViewMTN: http://monotone.openembedded.org/revision.psp?id=9be6b44e77d5700f176e18553c62b41c1f894dc3
Files:
1
packages/clamav/files/volatiles.02_clamav-data
packages/clamav/files/volatiles.03_clamav-daemon
packages/clamav/files/volatiles.03_clamav-freshclam
packages/clamav/clamav_0.88.4.bb
Diffs:
#
# mt diff -r43a00136393cf6b705dc81f93e15bb8ca90475fa -r9be6b44e77d5700f176e18553c62b41c1f894dc3
#
#
#
# add_file "packages/clamav/files/volatiles.02_clamav-data"
# content [d9016d31c590fb54d6b9256776e232491c2060a5]
#
# add_file "packages/clamav/files/volatiles.03_clamav-daemon"
# content [0620253623d516e9abbbe60df3adab0c4c97184c]
#
# add_file "packages/clamav/files/volatiles.03_clamav-freshclam"
# content [2ee4728617c337d945dfc6328f589777c399bf5d]
#
# patch "packages/clamav/clamav_0.88.4.bb"
# from [33420975a8baf0d61cb2385c9d18feb2b58f93d5]
# to [293c33440cbc35ab0321eeed632ee7aee546014c]
#
============================================================
--- packages/clamav/files/volatiles.02_clamav-data d9016d31c590fb54d6b9256776e232491c2060a5
+++ packages/clamav/files/volatiles.02_clamav-data d9016d31c590fb54d6b9256776e232491c2060a5
@@ -0,0 +1,4 @@
+# <type> <owner> <group> <mode> <path> [<linksource>]
+d clamav clamav 0755 /var/lib/clamav
+l clamav clamav 0644 /var/lib/clamav/main.cvd /usr/lib/clamav/main.cvd
+l clamav clamav 0644 /var/lib/clamav/daily.cvd /usr/lib/clamav/daily.cvd
============================================================
--- packages/clamav/files/volatiles.03_clamav-daemon 0620253623d516e9abbbe60df3adab0c4c97184c
+++ packages/clamav/files/volatiles.03_clamav-daemon 0620253623d516e9abbbe60df3adab0c4c97184c
@@ -0,0 +1,4 @@
+# <type> <owner> <group> <mode> <path> [<linksource>]
+d clamav clamav 0775 /var/log/clamav
+d clamav clamav 0755 /var/lib/clamav
+d clamav clamav 0755 /var/run/clamav
============================================================
--- packages/clamav/files/volatiles.03_clamav-freshclam 2ee4728617c337d945dfc6328f589777c399bf5d
+++ packages/clamav/files/volatiles.03_clamav-freshclam 2ee4728617c337d945dfc6328f589777c399bf5d
@@ -0,0 +1,4 @@
+# <type> <owner> <group> <mode> <path> [<linksource>]
+d clamav clamav 0775 /var/log/clamav
+d clamav clamav 0755 /var/lib/clamav
+d clamav clamav 0755 /var/run/clamav
============================================================
--- packages/clamav/clamav_0.88.4.bb 33420975a8baf0d61cb2385c9d18feb2b58f93d5
+++ packages/clamav/clamav_0.88.4.bb 293c33440cbc35ab0321eeed632ee7aee546014c
@@ -16,7 +16,7 @@ RRECOMMENDS_${PN}-daemon = "${PN}-freshc
RDEPENDS_${PN}-daemon = "${PN}-data"
RRECOMMENDS_${PN} = "${PN}-freshclam"
RRECOMMENDS_${PN}-daemon = "${PN}-freshclam"
-PR = "r2"
+PR = "r3"
SRC_URI = "${SOURCEFORGE_MIRROR}/clamav/clamav-${PV}.tar.gz \
file://cross-compile-fix.patch;patch=1 \
@@ -25,7 +25,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/clamav/
file://clamav-freshclam.init \
file://clamav-daemon.default \
file://clamd.conf \
- file://freshclam.conf"
+ file://freshclam.conf \
+ file://volatiles.02_clamav-data \
+ file://volatiles.03_clamav-daemon \
+ file://volatiles.03_clamav-freshclam"
inherit autotools update-rc.d binconfig
@@ -35,22 +38,36 @@ do_install_append() {
--with-dbdir=${localstatedir}/lib/clamav"
do_install_append() {
- install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
- ${D}${docdir}/clamav
+ install -m 0755 -d ${D}${sysconfdir}/default/volatiles \
+ ${D}${sysconfdir}/init.d ${D}${docdir}/clamav
+
# Save the installed clamd.conf in the doc dir and then install our new one
install -m 0755 ${D}${sysconfdir}/clamd.conf ${D}${docdir}/clamav/clamd.conf.example
install -m 0755 ${WORKDIR}/clamd.conf ${D}${sysconfdir}/clamd.conf
+
# Save the installed freshclam.conf in the doc dir and then install our new one
install -m 0755 ${D}${sysconfdir}/freshclam.conf ${D}${docdir}/clamav/freshclam.conf.example
+
# Install our config files and init scripts
install -m 0755 ${WORKDIR}/freshclam.conf ${D}${sysconfdir}/freshclam.conf
install -m 0755 ${WORKDIR}/clamav-daemon.default ${D}${sysconfdir}/default/clamav-daemon
install -m 0755 ${WORKDIR}/clamav-daemon.init ${D}${sysconfdir}/init.d/clamav-daemon
install -m 0755 ${WORKDIR}/clamav-freshclam.init ${D}${sysconfdir}/init.d/clamav-freshclam
+
+ # We need some /var directories
+ for i in 02_clamav-data 03_clamav-daemon 03_clamav-freshclam; do
+ install -m 0644 ${WORKDIR}/volatiles.$i ${D}${sysconfdir}/default/volatiles/$i
+ done
+
+ # Move the clamav data to a non-volatile location, we'll symlink back
+ # If freshclam is running it'll break the link to this static data
+ # once it has succesfully downloaded an update
+ install -m 0755 -d ${D}${libdir}
+ mv ${D}${localstatedir}/lib/clamav ${D}${libdir}
}
do_stage () {
- oe_libinstall -a -so libclamav ${STAGING_LIBDIR}
- install -m 0644 libclamav/clamav.h ${STAGING_INCDIR}
+ oe_libinstall -a -so libclamav ${STAGING_LIBDIR}
+ install -m 0644 libclamav/clamav.h ${STAGING_INCDIR}
}
PACKAGES += "${PN}-freshclam ${PN}-daemon ${PN}-data ${PN}-lib"
@@ -59,13 +76,16 @@ FILES_${PN}-freshclam = "${bindir}/fresh
FILES_${PN}-lib = "${libdir}/libclamav.so.*"
FILES_${PN}-freshclam = "${bindir}/freshclam \
${sysconfdir}/freshclam.conf \
- ${sysconfdir}/init.d/clamav-freshclam"
+ ${sysconfdir}/init.d/clamav-freshclam \
+ ${sysconfdir}/default/volatiles/03_clamav-freshclam"
FILES_${PN}-daemon = "${sysconfdir}/clamd.conf \
${sbindir}/clamd \
${sysconfdir}/init.d/clamav-daemon \
- ${sysconfdir}/default/clamav-daemon"
-FILES_${PN}-data = "${localstatedir}/lib/clamav/main.cvd \
- ${localstatedir}/lib/clamav/daily.cvd"
+ ${sysconfdir}/default/clamav-daemon \
+ ${sysconfdir}/default/volatiles/03_clamav-daemon"
+FILES_${PN}-data = "${libdir}/clamav/main.cvd \
+ ${libdir}/clamav/daily.cvd \
+ ${sysconfdir}/default/volatiles/02_clamav-data"
FILES_${PN}-dev += "${bindir}/clamav-config"
# Add clamav's user and groups
@@ -73,30 +93,25 @@ pkg_postinst_${PN}-freshclam () {
grep -q clamav: /etc/group || addgroup clamav
grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
--ingroup clamav -g "ClamAV" clamav
+ /etc/init.d/populate-volatile.sh
}
pkg_postinst_${PN}-daemon () {
grep -q clamav: /etc/group || addgroup clamav
grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
--ingroup clamav -g "ClamAV" clamav
+ /etc/init.d/populate-volatile.sh
}
pkg_postinst_${PN}-data () {
grep -q clamav: /etc/group || addgroup clamav
grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
--ingroup clamav --no-create-home -g "ClamAV" clamav
- chown clamav:clamav \
- ${localstatedir}/lib/clamav \
- ${localstatedir}/lib/clamav/main.cvd \
- ${localstatedir}/lib/clamav/daily.cvd
+ /etc/init.d/populate-volatile.sh
}
# Indicate that the default files are configuration files
CONFFILES_${PN}-daemon = "${sysconfdir}/clamd.conf \
${sysconfdir}/default/clamav-daemon"
CONFFILES_${PN}-freshclam = "${sysconfdir}/freshclam.conf"
-# Mark the database as conffiles so that newer data file won't replace
-# updates generated by freshclam
-CONFFILES_${PN}-data = "${localstatedir}/lib/clamav/main.cvd \
- ${localstatedir}/lib/clamav/daily.cvd"
INITSCRIPT_PACKAGES = "${PN}-daemon ${PN}-freshclam"
INITSCRIPT_NAME_${PN}-daemon = "clamav-daemon"
More information about the Openembedded-commits
mailing list