wok view squid/receipt @ rev 11906

squid: Improve package
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Wed Feb 29 22:08:35 2012 +0100 (2012-02-29)
parents efa7f405d08c
children b2aa205abf59
line source
1 # SliTaz package receipt.
3 PACKAGE="squid"
4 VERSION="3.1.19"
5 CATEGORY="network"
6 SHORT_DESC="Web/ftp proxy."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://www.squid-cache.org/"
10 WGET_URL="${WEB_SITE}Versions/v3/3.1/$TARBALL"
11 CONFIG_FILES="/etc/squid"
12 DEPENDS="libsasl libldap libssl libltdl"
13 BUILD_DEPENDS="perl openssl-dev openldap-dev cyrus-sasl-dev"
14 SUGGESTED="iptables"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 ./configure \
21 --prefix=/usr \
22 --sysconfdir=/etc/squid \
23 --datadir=/usr/share/squid \
24 --libexecdir=/usr/lib/squid \
25 --localstatedir=/var \
26 --with-logdir=/var/log/squid \
27 --disable-poll \
28 --disable-snmp \
29 --disable-icmp \
30 --enable-http-violations \
31 --disable-ident-lookups \
32 --enable-storeio="aufs,diskd,ufs" \
33 --enable-ssl \
34 --enable-underscores \
35 --enable-ntlm-fail-open \
36 --enable-removal-policies="heap,lru" \
37 --enable-delay-pools \
38 --enable-linux-netfilter \
39 --enable-basic-auth-helpers="NCSA,SMB,MSNT,LDAP" \
40 --enable-ntlm-auth-helpers="smb_lm,no_check,fakeauth" \
41 --enable-useragent-log \
42 --enable-referer-log \
43 --enable-icap-client \
44 --with-pthreads ac_cv_header_linux_netfilter_ipv4_h="yes" \
45 $CONFIGURE_ARGS &&
46 make $MAKEFLAGS && make install
47 }
49 # Rules to gen a SliTaz package suitable for Tazpkg.
50 genpkg_rules()
51 {
52 mkdir -p $fs/usr/share/squid/errors $fs/var/cache/squid $fs/var/log/squid \
53 $fs/usr/lib/squid
55 touch $fs/var/log/squid/cache.log
57 cp -a $install/etc $fs
58 rm -rf $fs/etc/squid/*.default
59 cp -a $stuff/etc $fs
61 cp -a $install/var $fs
62 cp -a $install/usr/bin $fs/usr
63 cp -a $install/usr/sbin $fs/usr
64 cp -a $install/usr/lib/squid/*kd $fs/usr/lib/squid
65 cp -a $install/usr/lib/squid/*.cgi $fs/usr/lib/squid
67 cp -a $install/usr/share/squid/mib.txt $fs/usr/share/squid
68 cp -a $install/usr/share/squid/icons $fs/usr/share/squid
69 cp -a $install/usr/share/squid/errors/templates $fs/usr/share/squid/errors
70 cp -a $install/usr/share/squid/errors/en* $fs/usr/share/squid/errors
71 cp -a $install/usr/share/squid/errors/fr* $fs/usr/share/squid/errors
73 sed -i \
74 -e 's/TAG: visible_hostname/TAG: visible_hostname\nvisible_hostname slitaz/' \
75 -e 's|^access_log /var/logs|access_log /var/log/squid|' \
76 -e 's|^#cache_store_log /var/logs|cache_store_log /var/cache/squid|' \
77 -e 's|^#cache_log /var/logs|cache_log /var/cache/squid|' \
78 -e 's|^#cache_dir ufs /var/cache 100|cache_dir ufs /var/cache/squid 256|' \
79 -e 's|^#pid_filename /var/logs|pid_filename /var/run/squid.pid|' \
80 -e "s|^coredump_dir.*|coredump_dir /var/cache/squid|" \
81 -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
82 -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
83 $fs/etc/squid/squid.conf
85 cat <<EOF>>$fs/etc/squid/squid.conf
87 cache_effective_user squid
88 cache_effective_group squid
90 access_log /var/log/squid
91 EOF
92 }
94 # Pre and post install commands for Tazpkg.
95 post_install()
96 {
97 local root
98 local user
99 local group
101 user=squid
102 group=squid
104 if ! grep -q $user $1/etc/passwd; then
105 echo -n "Adding user/group $user..."
106 chroot $1/ addgroup -S $group
107 chroot $1/ adduser -S -D -H -G $group $user
108 status
109 fi
112 # Set perms for files and directories
113 chroot $1/ chown -R ${user}.${group} /var/log/squid \
114 /var/cache/squid
116 cat <<EOF
117 ----
118 To start $PACKAGE server you can run :
120 /etc/init.d/$PACKAGE start
122 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
123 ----
124 EOF
125 }
128 post_remove()
129 {
130 echo "Removing stalled files..."
131 test -d /var/cache/squid && rm -rf /var/cache/squid
132 test -d /var/log/squid && rm -rf /var/log/squid
133 test -d /usr/share/squid && rm -rf /usr/share/squid
135 echo "Removing user/group squid"
136 deluser squid
137 }