From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1HPb6N-0004Ov-Eo for garchives@archives.gentoo.org; Fri, 09 Mar 2007 09:09:28 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l2998SkZ028065; Fri, 9 Mar 2007 09:08:28 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l2998Roi028055 for ; Fri, 9 Mar 2007 09:08:28 GMT Received: from [66.92.11.131] (dsl092-011-131.sfo1.dsl.speakeasy.net [66.92.11.131]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id DBFD764CEF; Fri, 9 Mar 2007 09:08:26 +0000 (UTC) Subject: Re: [gentoo-embedded] init.d scripts and bash From: Ned Ludd To: Roy Marples Cc: gentoo-embedded@lists.gentoo.org In-Reply-To: <20070309073937.154cff79@uberpc.marples.name> References: <1173369604.5480.20.camel@localhost> <1173398450.31695.26.camel@onyx.private.gni.com> <20070309073937.154cff79@uberpc.marples.name> Content-Type: text/plain Organization: Gentoo Linux Date: Fri, 09 Mar 2007 01:08:25 -0800 Message-Id: <1173431305.6147.12.camel@here.linbsd.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-embedded@gentoo.org Reply-to: gentoo-embedded@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.8.2.1 Content-Transfer-Encoding: 7bit X-Archives-Salt: 4099fa30-9bad-42f5-aba3-9d7ebaba818b X-Archives-Hash: ffada85117bb959c96227d8c839110e4 On Fri, 2007-03-09 at 07:39 +0000, Roy Marples wrote: > On Thu, 08 Mar 2007 16:00:50 -0800 > Ned Ludd wrote: > > > On Thu, 2007-03-08 at 17:00 +0100, Natanael Copa wrote: > > > Hi, > > > > > > Are there anybody more than me that use the gentoo init.d scripts > > > without using bash? > > > > > > Most init.d scripts runs just fine with a small runscript wrapper. > > > A few needs patching to work, typically replacing: > > > > > > [[ expr || expr ]] > > > > > > with: > > > > > > [[ expr ]] || [[ expr ]] > > Well, not many shells support that either. > [ expr -o expr ] > or > [ expr ] || [ expr] > should work across the board. > > > > But sometimes arrays and such are used (very often its easy to work > > > around) > > Yes it's easy to work around. > Infact we had a discussion about this on -dev and posted the below > function > > _get_array() { > if [ -n "${BASH}" ] ; then > case "$(declare -p "$1" 2>/dev/null)" in > "declare -a "*) > echo "set -- \"\${$1[@]}\"" > return > ;; > esac > fi > > echo "eval set -- \"\$$1\"" > } > > eval "$(_get_array "config_${IFVAR}")" > for cmd in "$@" ; do > ... > done > > Which means we can support bash arrays AND a non bash array > config_eth0=( "one" "t w o" "three" ) > and > config_eth0="'one' 't w o' 'three'" > > > > > > > Are there any hope for setting a gentoo policy that says bash > > > specific things should be avoided if possible in init.d scripts? > > There's no such policy. Our policy has always been init scripts should > be parseable by a shell. The shell in question has always been bash > because > 1) baselayout-1 requires it > 2) bash forces itself to be /bin/sh anyway > > The lastest bash in the tree no longer enforces it's /bin/sh - instead > it only creates the link if it does not exist, allowing any shell to be > used. Yay! Sweet ass sweet... I'm sure it will take time to get 99% of the misc remaining bash init scripts converted over as we find them. If we mostly target server stuff for now we will be fine.. > > That is a goal with baselayout-2. I'd be interested if we started a > > tracker bug for such things. I think policy might be a bit far > > reaching at this point. But it's for sure a worthwhile goal. > > baselayout-2 is pure C (except for the init scripts themselves) and is > nearing the final stage of development before it enters the tree. It > currently works with any shell in portage except for zsh and ksh. It > can work with bb provided that some things are disabled. Gimme bugs.. I need #'s if I'm going to work toward solving them. I'd rather not disable vs update bb to conform with what you need. Removing our s-s-d for us is very undesirable as long as we have an alternative to the current bloated s-s-d. So please give us bugs to work towards solving etc.. I think Natanael might also become one of your best testers and bug reporters. He has been very helpful in the past and I'm sure he will continue to be in the future. > > I'm making it a policy that all init scripts on my local machines have > already been changed. Naughty me. I've filed bugs for a few other > scripts too. Natanael please search bugzilla for scripts you have noticed in which Roy has not already filed bugs. If no bug exists please file one (patches attached if you can) > So for a desktop it should work off the bat. Not sure if > I'll put baselayout-2 on my server right now as it's headless and it's a > PITA to get a head to it. > > Once baselayout-2 hits portage then we can have a tracker bug. > > Thanks > > Roy > -- Ned Ludd Gentoo Linux -- gentoo-embedded@gentoo.org mailing list