From owner-freebsd-stable@FreeBSD.ORG Tue Feb 1 12:35:19 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A50B106564A for ; Tue, 1 Feb 2011 12:35:19 +0000 (UTC) (envelope-from vanopen@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C34958FC0C for ; Tue, 1 Feb 2011 12:35:18 +0000 (UTC) Received: by iwn39 with SMTP id 39so6575502iwn.13 for ; Tue, 01 Feb 2011 04:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:mime-version :content-type:content-disposition:organization:x-operating-system :user-agent; bh=Pvzwf0kDuZbScqfi1htCWt6w9oplviXWrpo1CltNGKE=; b=BjJnAOfQrKNPVZjcXgo7MAyo8rwOxRzusE0tUmn8njlotR+tyA2uUyWnbJ7aySmgin 3uDM1gUORAR1foB5Nc4n1wU0hF6Q3l4sU6Osmls3kQPuJjkmdVjJIeHeYZqhEcfRRzph Eupi8veatFlCyT++p2FgEpk2YCqsVARXqMy88= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:organization:x-operating-system:user-agent; b=qAsOCzD31ztgZEX57O48sSe2/EBbmH0VbBd8aguS2zMOMXfThgTiYqMmzXDXK597uF QXOjT7XzIgQslI0FMhJsE6+q9ePBQGPWC2TdpnA1UREhz4aEe4GZEOmHsDvtC6SgWZKe jZT0iQhC1oP+detKcm30GiBMik3K/IRLGhF2s= Received: by 10.231.36.205 with SMTP id u13mr8139072ibd.155.1296563718016; Tue, 01 Feb 2011 04:35:18 -0800 (PST) Received: from fbsd.t60.cpu ([180.141.178.90]) by mx.google.com with ESMTPS id d21sm18869351ibg.21.2011.02.01.04.35.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 01 Feb 2011 04:35:17 -0800 (PST) Date: Tue, 1 Feb 2011 20:35:06 +0800 From: Yue Wu To: ml-freebsd-stable Message-ID: <20110201123506.GA97242@fbsd.t60.cpu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: China Pharmaceutical University, Nanjing, China X-Operating-System: FreeBSD 8.2-PRERELEASE i386 User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Is /etc/rc.conf scriptable? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2011 12:35:19 -0000 Hi list, I'm trying to do something to make rc.conf can act conditionally What I want is: 1. List the wireless access points, grep if there is one which bssid is 'bb:bb:bb:bb:bb:bb', if there is, then set ifconfig_wlan0 to the value: "inet 192.168.1.111 netmask 255.255.255.0 WPA" 2. check if bitlbee has been installed, if so, then let bitlbee service start. So I tried with following settings in rc.conf, but all of them failed, i.e., the networking can't be connected and bitlbee service doesn't run. /etc/rc.conf if ifconfig wlan0 list scan 2>/dev/null | grep -q 'bb:bb:bb:bb:bb:bb' >/dev/null 2>&1; then ifconfig_wlan0="inet 192.168.1.111 netmask 255.255.255.0 WPA" fi if [ -x /usr/local/sbin/bitlbee ]; then bitlbee_enable="YES" fi My question is, how to achieve what I want? The simpler, the better :) -- Regards, Yue Wu Key Laboratory of Modern Chinese Medicines Department of Traditional Chinese Medicine China Pharmaceutical University No.24, Tongjia Xiang Street, Nanjing 210009, China