From owner-svn-ports-head@freebsd.org Wed Sep 30 18:58:06 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CA81A0B347; Wed, 30 Sep 2015 18:58:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 033E410CE; Wed, 30 Sep 2015 18:58:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UIw5nq041887; Wed, 30 Sep 2015 18:58:05 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UIw5LN041885; Wed, 30 Sep 2015 18:58:05 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509301858.t8UIw5LN041885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 18:58:05 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r398231 - in head/www/squid: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 18:58:06 -0000 Author: bdrewery Date: Wed Sep 30 18:58:04 2015 New Revision: 398231 URL: https://svnweb.freebsd.org/changeset/ports/398231 Log: rc.d/squid: Check the config before starting, reloading, or restarting. Modified: head/www/squid/Makefile head/www/squid/files/squid.in Modified: head/www/squid/Makefile ============================================================================== --- head/www/squid/Makefile Wed Sep 30 18:34:59 2015 (r398230) +++ head/www/squid/Makefile Wed Sep 30 18:58:04 2015 (r398231) @@ -2,6 +2,7 @@ PORTNAME= squid PORTVERSION= 3.5.9 +PORTREVISION= 1 CATEGORIES= www ipv6 MASTER_SITES= http://www.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \ http://www2.us.squid-cache.org/Versions/v3/${PORTVERSION:R}/ \ Modified: head/www/squid/files/squid.in ============================================================================== --- head/www/squid/files/squid.in Wed Sep 30 18:34:59 2015 (r398230) +++ head/www/squid/files/squid.in Wed Sep 30 18:58:04 2015 (r398231) @@ -51,12 +51,15 @@ rcvar=squid_enable # Make sure that we invoke squid with "-f ${squid_conf}"; define this # variable early so reload_cmd and stop_precmd pick it up: -extra_commands=reload +extra_commands="reload configtest" reload_cmd=squid_reload start_precmd=squid_prestart start_postcmd=squid_getpid stop_precmd=squid_prestop stop_postcmd=squid_poststop +configtest_cmd=squid_configtest +reload_precmd=squid_configtest +restart_precmd=squid_configtest # squid(8) will not start if ${squid_conf} is not present so try # to catch that beforehand via ${required_files} rather than make @@ -105,6 +108,8 @@ squid_prestart() else return 0 fi + + squid_configtest } squid_reload() @@ -113,6 +118,18 @@ squid_reload() $command $required_args $squid_flags -k reconfigure } +squid_configtest() +{ + + echo "Performing sanity check on ${name} configuration." + if $command $required_args $squid_flags -k check; then + echo "Configuration for ${name} passes." + return 0 + else + return $? + fi +} + squid_getpid() { # retrieve the PID of the Squid master process explicitly here