wok-current view squidguard/receipt @ rev 24465

Add some current_version
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 17 12:02:46 2022 +0000 (2022-02-17)
parents be2ab6ab8f7e
children 8e505f99deb3
line source
1 # SliTaz package receipt.
3 PACKAGE="squidguard"
4 VERSION="1.4"
5 CATEGORY="network"
6 SHORT_DESC="Web filter."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL"
9 SOURCE="squidGuard"
10 TARBALL="$SOURCE-$VERSION.tar.gz"
11 WEB_SITE="http://www.squidguard.org/"
12 WGET_URL="${WEB_SITE}Downloads/$TARBALL"
13 DEPENDS="squid libdb"
14 BUILD_DEPENDS="db-dev"
16 # What is the latest version available today?
17 current_version()
18 {
19 wget -O - ${WGET_URL%/*}/ 2>/dev/null | \
20 sed "/latest/d;/$SOURCE-[0-9]/!d;/tar/!d;s|.*$SOURCE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q
21 }
23 # Rules to configure and make the package.
24 compile_rules()
25 {
26 # Security patches
27 while read patch_file; do
28 echo "Apply $patch_file"
29 tar xvzf $stuff/$patch_file || return 1
30 cp -a $(basename $patch_file .tar.gz)/* src
31 done <<EOT
32 squidGuard-1.4-patch-20091015.tar.gz
33 squidGuard-1.4-patch-20091019.tar.gz
34 squidGuard-1.4-patch-20150201.tar.gz
35 EOT
36 # Add support for squid 3.4
37 patch -p1 < $stuff/squidGuard-1.4_upgrade.patch
38 patch -p1 < $stuff/squidGuard-1.4-dnsbl.patch
40 ./configure --prefix=/usr --infodir=/usr/share/info \
41 --sysconfdir=/etc --with-sg-config=/etc/squidGuard/squidGuard.conf \
42 --with-sg-logdir=/var/lib/squidGuard/log \
43 --with-sg-dbhome=/var/lib/squidGuard/db \
44 --mandir=/usr/share/man $CONFIGURE_ARGS
46 make
47 sed -e "s|^prefix =.*|prefix = $DESTDIR/usr|" \
48 -e "s|^logdir =.*|logdir = $DESTDIR/var/lib/squidGuard/log|" \
49 -e "s|^configfile =.*|configfile = $DESTDIR/etc/squidGuard/squidGuard.conf|" \
50 -e "s|^dbhomedir =.*|dbhomedir = $DESTDIR/var/lib/squidGuard/db|" \
51 -e "s|^SQUIDUSER =.*|SQUIDUSER = nobody|" \
52 < Makefile > Makefile.slitaz-install
53 mkdir -p $DESTDIR/etc/squidGuard
54 make -f Makefile.slitaz-install install
55 }
57 # Rules to gen a SliTaz package suitable for Tazpkg.
58 genpkg_rules()
59 {
60 mkdir -p $fs/etc/squid/conf.d
62 cp -a $install/* $fs/
63 cp -pa $stuff/squidguard.conf $fs/etc/squid/conf.d
65 # Cleanup.
66 rmdir $fs/usr/squidGuard
68 }
70 # Pre and post install commands for Tazpkg.
71 post_install()
72 {
73 chown -R nobody "$1"/var/lib/squidGuard/*
74 # Recharge squid config
75 [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
76 }
78 post_remove()
79 {
80 # Recharge squid config
81 [ "$1" ] || { [ -x $(which squid) ] && $(which squid) -k reconfigure 2> /dev/null; }
82 }
84 check_config()
85 {
86 su -c 'echo "http://www.example.com 192.168.0.6/- - GET" | \
87 squidGuard -c /etc/squidGuard/squidGuard.conf -d' nobody
88 }