wok-4.x rev 1253
Add squid & squidguard
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 13 07:40:55 2008 +0000 (2008-08-13) |
parents | 345c3a4577f1 |
children | 588285bf0a2a |
files | squid/receipt squid/stuff/etc/init.d/squid squidguard/receipt |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/squid/receipt Wed Aug 13 07:40:55 2008 +0000 1.3 @@ -0,0 +1,78 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="squid" 1.7 +VERSION="3.0.STABLE8" 1.8 +CATEGORY="network" 1.9 +SHORT_DESC="Web/ftp proxy." 1.10 +MAINTAINER="pascal.bellard@slitaz.org" 1.11 +TARBALL="$PACKAGE-$VERSION.tar.bz2" 1.12 +WEB_SITE="http://www.squid-cache.org/" 1.13 +WGET_URL="${WEB_SITE}Versions/v3/3.0/$TARBALL" 1.14 +CONFIG_FILES="/etc/squid" 1.15 +#DEPENDS="iptables" 1.16 + 1.17 +# Rules to configure and make the package. 1.18 +compile_rules() 1.19 +{ 1.20 + cd $src 1.21 + ./configure --prefix=/usr --infodir=/usr/share/info \ 1.22 + --sysconfdir=/etc/squid --localstatedir=/var \ 1.23 + --mandir=/usr/share/man $CONFIGURE_ARGS 1.24 + make 1.25 + make DESTDIR=$PWD/_pkg install 1.26 +} 1.27 + 1.28 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.29 +genpkg_rules() 1.30 +{ 1.31 + mkdir -p $fs/usr/share/errors $fs/var/cache/squid $fs/var/log/squid 1.32 + cp -a $_pkg/etc $fs 1.33 + rm -rf $fs/etc/squid/*.default 1.34 + cp -a stuff/etc $fs 1.35 + cp -a $_pkg/var $fs 1.36 + cp -a $_pkg/usr/bin $fs/usr 1.37 + cp -a $_pkg/usr/sbin $fs/usr 1.38 + cp -a $_pkg/usr/libexec $fs/usr 1.39 + cp -a $_pkg/usr/share/mib.txt $fs/usr/share 1.40 + cp -a $_pkg/usr/share/icons $fs/usr/share 1.41 + cp -a $_pkg/usr/share/errors/English $fs/usr/share/errors 1.42 + cp -a $_pkg/usr/share/errors/French $fs/usr/share/errors 1.43 + rm -f $fs/etc/*conf* 1.44 + sed -i -e 's/TAG: visible_hostname/TAG: visible_hostname\nvisible_hostname slitaz/' \ 1.45 + -e 's|^access_log /var/logs|access_log /var/log/squid|' \ 1.46 + -e 's|^# cache_store_log /var/logs|cache_store_log /var/cache/squid|' \ 1.47 + -e 's|^# cache_log /var/logs|cache_log /var/cache/squid|' \ 1.48 + -e 's|^# cache_dir ufs /var/cache|cache_dir ufs /var/cache/squid|' \ 1.49 + -e 's|^# pid_filename /var/logs|pid_filename /var/run|' \ 1.50 + -e 's|^coredump_dir /var/logs|coredump_dir /var/cache/squid|' \ 1.51 + $fs/etc/squid/squid.conf 1.52 + # Package all squid pkgs 1.53 + for i in $(cd $WOK; ls -d squid-*) 1.54 + do 1.55 + tazwok genpkg $i 1.56 + done 1.57 +} 1.58 + 1.59 +# Pre and post install commands for Tazpkg. 1.60 +post_install() 1.61 +{ 1.62 + ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \ 1.63 + $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT 1.64 +$(cd $1/ ; find etc/squid -type f) 1.65 +EOT 1.66 + chown nobody.nogroup /var/cache/squid /var/log/squid 1.67 + cat <<EOF 1.68 +---- 1.69 +To start $PACKAGE server you can run : 1.70 + 1.71 + /etc/init.d/$PACKAGE start 1.72 + 1.73 +Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf 1.74 +---- 1.75 +EOF 1.76 +} 1.77 + 1.78 +repack_cleanup() 1.79 +{ 1.80 + zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id ) 1.81 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/squid/stuff/etc/init.d/squid Wed Aug 13 07:40:55 2008 +0000 2.3 @@ -0,0 +1,68 @@ 2.4 +#!/bin/sh 2.5 +# /etc/init.d/squid : Start, stop and restart Squid proxy server on SliTaz, at 2.6 +# boot time or with the command line. 2.7 +# 2.8 +# To start Squid proxy server at boot time, just put squid in the $RUN_DAEMONS 2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf 2.10 +# 2.11 +. /etc/init.d/rc.functions 2.12 +. /etc/daemons.conf 2.13 + 2.14 +NAME=Squid 2.15 +DESC="Squid proxy server" 2.16 +DAEMON=/usr/sbin/squid 2.17 +OPTIONS=$SQUID_OPTIONS 2.18 +PIDFILE=/var/run/squid.pid 2.19 +http_port=$(grep ^http_port /etc/squid/squid.conf | awk '{ print $2 }') 2.20 +[ -n "$http_port" ] || http_port=3128 2.21 +[ -n "$OPTIONS" ] || OPTIONS="-a $http_port" 2.22 + 2.23 +case "$1" in 2.24 + start) 2.25 + if [ -f $PIDFILE ] ; then 2.26 + echo "$NAME already running." 2.27 + exit 1 2.28 + fi 2.29 + cache_dir=$(grep ^cache_dir /etc/squid/squid.conf | awk '{ print $3 }') 2.30 + [ -n "$cache_dir" ] || cache_dir=/var/cache 2.31 + if [ -d "$cache_dir" -a ! -d "$cache_dir/00" ]; then 2.32 + echo -n "Creating squid spool directory structure" 2.33 + $DAEMON -z 2.34 + status 2.35 + fi 2.36 + echo -n "Starting $DESC: $NAME... " 2.37 + $DAEMON $OPTIONS 2.38 + status 2.39 + sleep 2 2.40 + ;; 2.41 + stop) 2.42 + if [ ! -f $PIDFILE ] ; then 2.43 + echo "$NAME is not running." 2.44 + exit 1 2.45 + fi 2.46 + echo -n "Stopping $DESC: $NAME... " 2.47 + kill `cat $PIDFILE` 2.48 + status 2.49 + sleep 2 2.50 + ;; 2.51 + restart) 2.52 + if [ ! -f $PIDFILE ] ; then 2.53 + echo "$NAME is not running." 2.54 + exit 1 2.55 + fi 2.56 + echo -n "Restarting $DESC: $NAME... " 2.57 + kill `cat $PIDFILE` 2.58 + sleep 2 2.59 + $DAEMON $OPTIONS 2.60 + status 2.61 + sleep 2 2.62 + ;; 2.63 + *) 2.64 + echo "" 2.65 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 2.66 + echo "" 2.67 + exit 1 2.68 + ;; 2.69 +esac 2.70 + 2.71 +exit 0
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/squidguard/receipt Wed Aug 13 07:40:55 2008 +0000 3.3 @@ -0,0 +1,60 @@ 3.4 +# SliTaz package receipt. 3.5 + 3.6 +PACKAGE="squidguard" 3.7 +VERSION="1.3" 3.8 +CATEGORY="network" 3.9 +SHORT_DESC="Web filter." 3.10 +MAINTAINER="pascal.bellard@slitaz.org" 3.11 +SOURCE="squidGuard" 3.12 +TARBALL="$SOURCE-$VERSION.tar.gz" 3.13 +WEB_SITE="http://www.squidguard.org/" 3.14 +WGET_URL="${WEB_SITE}Downloads/$TARBALL" 3.15 +DEPENDS="squid libdb" 3.16 +BUILD_DEPENDS="db-dev" 3.17 + 3.18 +# Rules to configure and make the package. 3.19 +compile_rules() 3.20 +{ 3.21 + cd $src 3.22 + ./configure --prefix=/usr --infodir=/usr/share/info \ 3.23 + --sysconfdir=/etc --with-sg-config=/etc/squid/squidGuard.conf \ 3.24 + --with-sg-logdir=/var/lib/squidGuard/log \ 3.25 + --with-sg-dbhome=/var/lib/squidGuard/db \ 3.26 + --mandir=/usr/share/man $CONFIGURE_ARGS 3.27 + make 3.28 + sed -e 's|^prefix =.*|prefix = _pkg/usr|' \ 3.29 + -e 's|^logdir =.*|logdir = _pkg/var/lib/squidGuard/log|' \ 3.30 + -e 's|^configfile =.*|configfile = _pkg/etc/squid/squidGuard.conf|' \ 3.31 + -e 's|^dbhomedir =.*|dbhomedir = _pkg/var/lib/squidGuard/db|' \ 3.32 + -e 's|^SQUIDUSER =.*|SQUIDUSER = root|' \ 3.33 + < Makefile > Makefile.slitaz-install 3.34 + mkdir -p _pkg/etc/squid 3.35 + make -f Makefile.slitaz-install install 3.36 +} 3.37 + 3.38 +# Rules to gen a SliTaz package suitable for Tazpkg. 3.39 +genpkg_rules() 3.40 +{ 3.41 + cp -a $_pkg/* $fs/ 3.42 +} 3.43 + 3.44 +# Pre and post install commands for Tazpkg. 3.45 +post_install() 3.46 +{ 3.47 + ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \ 3.48 + $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOF 3.49 +etc/squid/squidGuard.conf 3.50 +EOF 3.51 + chown -R nobody /var/lib/squidGuard/* /usr/squidGuard 3.52 + if ! grep ^redirect_program $1/etc/squid/squid.conf ; then 3.53 + echo "Updating /etc/squid/squid.conf" 3.54 + cat >> $1/etc/squid/squid.conf <<EOF 3.55 +redirect_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf 3.56 +EOF 3.57 + fi 3.58 +} 3.59 + 3.60 +repack_cleanup() 3.61 +{ 3.62 + zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id ) 3.63 +}