wok-current annotate squid/receipt @ rev 24094

Add fasmg
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Aug 09 16:49:29 2021 +0000 (2021-08-09)
parents a12efd5783ec
children fb22330086d8
rev   line source
pascal@1253 1 # SliTaz package receipt.
pascal@1253 2
pascal@1253 3 PACKAGE="squid"
erjo@15767 4 VERSION="3.4.2"
pascal@1253 5 CATEGORY="network"
pascal@1253 6 SHORT_DESC="Web/ftp proxy."
pascal@1253 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15002 8 LICENSE="GPL2"
pascal@1253 9 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pascal@1253 10 WEB_SITE="http://www.squid-cache.org/"
erjo@14812 11 WGET_URL="${WEB_SITE}Versions/v3/${VERSION%.*}/$TARBALL"
pascal@1253 12 CONFIG_FILES="/etc/squid"
pascal@15002 13
slaxemulator@9628 14 DEPENDS="libsasl libldap libssl libltdl"
pascal@19730 15 BUILD_DEPENDS="perl openssl-dev openldap-dev cyrus-sasl-dev libcap-dev libdb"
pascal@2440 16 SUGGESTED="iptables"
pascal@1253 17
pascal@24094 18 current_version()
pascal@24094 19 {
pascal@24094 20 wget -O - $WEB_SITE/Versions 2>/dev/null | \
pascal@24094 21 sed '1,/suitable for production use/d;/href/!d;s|.*[0-9]/">||;s|<.*||;q'
pascal@24094 22 }
pascal@24094 23
pascal@1253 24 # Rules to configure and make the package.
pascal@1253 25 compile_rules()
pascal@1253 26 {
pankso@10793 27 ./configure \
pankso@10793 28 --prefix=/usr \
pankso@10793 29 --sysconfdir=/etc/squid \
pankso@10793 30 --datadir=/usr/share/squid \
pankso@10793 31 --libexecdir=/usr/lib/squid \
pankso@10793 32 --localstatedir=/var \
pankso@10793 33 --with-logdir=/var/log/squid \
pankso@10793 34 --disable-poll \
pankso@10793 35 --disable-snmp \
pankso@10793 36 --disable-icmp \
pankso@10793 37 --enable-http-violations \
pankso@10793 38 --disable-ident-lookups \
pankso@10793 39 --enable-storeio="aufs,diskd,ufs" \
pankso@10793 40 --enable-ssl \
erjo@15767 41 --enable-ssl-crtd \
pankso@10793 42 --enable-underscores \
pankso@10793 43 --enable-ntlm-fail-open \
pankso@10793 44 --enable-removal-policies="heap,lru" \
pankso@10793 45 --enable-delay-pools \
pankso@10793 46 --enable-linux-netfilter \
pankso@10793 47 --enable-basic-auth-helpers="NCSA,SMB,MSNT,LDAP" \
pankso@10793 48 --enable-ntlm-auth-helpers="smb_lm,no_check,fakeauth" \
pankso@10793 49 --enable-useragent-log \
pankso@10793 50 --enable-referer-log \
erjo@11906 51 --enable-icap-client \
pankso@10793 52 --with-pthreads ac_cv_header_linux_netfilter_ipv4_h="yes" \
pankso@10793 53 $CONFIGURE_ARGS &&
gokhlayeh@11574 54 make $MAKEFLAGS && make install
pascal@1253 55 }
pascal@1253 56
pascal@1253 57 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1253 58 genpkg_rules()
pascal@1253 59 {
erjo@4662 60 mkdir -p $fs/usr/share/squid/errors $fs/var/cache/squid $fs/var/log/squid \
erjo@11915 61 $fs/usr/lib/squid $fs/etc/squid/conf.d
pankso@10793 62
pankso@10793 63 touch $fs/var/log/squid/cache.log
pankso@10793 64
erjo@11906 65 cp -a $install/etc $fs
pascal@1253 66 rm -rf $fs/etc/squid/*.default
pankso@10793 67 cp -a $stuff/etc $fs
pankso@10793 68
erjo@11906 69 cp -a $install/var $fs
erjo@11906 70 cp -a $install/usr/bin $fs/usr
erjo@11906 71 cp -a $install/usr/sbin $fs/usr
erjo@15767 72 cp -a $install/usr/lib/squid/* $fs/usr/lib/squid
erjo@15767 73
erjo@15767 74 # Remove auth libs
erjo@15767 75 rm -f $fs/usr/lib/squid/*_auth*
pankso@10793 76
erjo@11906 77 cp -a $install/usr/share/squid/mib.txt $fs/usr/share/squid
erjo@11906 78 cp -a $install/usr/share/squid/icons $fs/usr/share/squid
erjo@11906 79 cp -a $install/usr/share/squid/errors/templates $fs/usr/share/squid/errors
erjo@11906 80 cp -a $install/usr/share/squid/errors/en* $fs/usr/share/squid/errors
erjo@11906 81 cp -a $install/usr/share/squid/errors/fr* $fs/usr/share/squid/errors
pankso@10793 82
pankso@10793 83 sed -i \
pankso@10793 84 -e 's/TAG: visible_hostname/TAG: visible_hostname\nvisible_hostname slitaz/' \
erjo@11906 85 -e 's|^#cache_dir ufs /var/cache 100|cache_dir ufs /var/cache/squid 256|' \
erjo@11906 86 -e 's|^#pid_filename /var/logs|pid_filename /var/run/squid.pid|' \
erjo@11906 87 -e "s|^coredump_dir.*|coredump_dir /var/cache/squid|" \
erjo@11906 88 -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
erjo@2387 89 -e 's|^# error_directory|error_directory /usr/share/squid/errors/French|' \
pascal@1253 90 $fs/etc/squid/squid.conf
erjo@11906 91
erjo@11906 92 cat <<EOF>>$fs/etc/squid/squid.conf
erjo@11906 93
erjo@11906 94 cache_effective_user squid
erjo@11906 95 cache_effective_group squid
erjo@11906 96
erjo@11915 97 access_log /var/log/squid/access.log
erjo@11915 98 cache_log /var/log/squid/cache.log
erjo@11915 99 cache_store_log /var/log/squid/store.log
erjo@11915 100
erjo@11915 101 include /etc/squid/conf.d/*.conf
erjo@11906 102 EOF
pascal@1253 103 }
pascal@1253 104
pascal@1253 105 # Pre and post install commands for Tazpkg.
pascal@1253 106 post_install()
pascal@1253 107 {
erjo@11906 108 local user
erjo@11906 109 local group
erjo@11906 110
erjo@11906 111 user=squid
erjo@11906 112 group=squid
erjo@11906 113
pascal@18730 114 if ! grep -q $user "$1/etc/passwd"; then
erjo@11906 115 echo -n "Adding user/group $user..."
pascal@18730 116 chroot "$1/" addgroup -S $group
pascal@18730 117 chroot "$1/" adduser -S -D -H -G $group $user
erjo@11906 118 status
erjo@11906 119 fi
erjo@11906 120
erjo@11906 121
erjo@11906 122 # Set perms for files and directories
pascal@18730 123 chroot "$1/" chown -R ${user}.${group} /var/log/squid \
erjo@11906 124 /var/cache/squid
erjo@11906 125
pascal@1253 126 cat <<EOF
pascal@1253 127 ----
pascal@1253 128 To start $PACKAGE server you can run :
pascal@1253 129
pascal@1253 130 /etc/init.d/$PACKAGE start
pascal@1253 131
pascal@1253 132 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
pascal@1253 133 ----
pascal@1253 134 EOF
pascal@1253 135 }
erjo@2387 136
erjo@11906 137
erjo@2387 138 post_remove()
erjo@2387 139 {
erjo@2387 140 echo "Removing stalled files..."
erjo@2387 141 test -d /var/cache/squid && rm -rf /var/cache/squid
erjo@2387 142 test -d /var/log/squid && rm -rf /var/log/squid
erjo@11906 143 test -d /usr/share/squid && rm -rf /usr/share/squid
erjo@11906 144
erjo@11906 145 echo "Removing user/group squid"
erjo@11906 146 deluser squid
erjo@2387 147 }