On Friday 04 Feb 2011 13:19:43 Hagberg, Keith wrote: > What determines when you need raw mode.
Basically with templating you have two levels at which $-variables are interpreted. If you want them interpreted when the kickstart is generated, do *not* escape them, if you want them interpreted by the shell at kickstart time (pre/post script) *do* escape them. The '#raw' thing is a method for escaping entire blocks. That is you need to use it when you want an entire block passed to shell at kickstart time as is, it disables templating of the encompassed block. > If I remove #raw and #end raw the snippet does not get put into the > kickstart. When the kickstart is created it still has the snippet name in > it. The '$SNIPPET()' is an instruction to the templating system. The '#raw' block disables templating. > I tried to escape the $ETH variable and it still will not replace it. Where do you define ETH? Is it a variable defined in 'Kickstart Details/Variables' section in the wizard? If so then you actually do *not* want to escape it. > Here is my snippet > > #raw #raw disables templating so you don't want it here. > SPEED=`ethtool $ETH | grep Speed | cut -d' ' -f2` SPEED is a shell variable defined at the kickstart time, so $-references to it *will* need to be escaped. > if [ "$SPEED" == "1000Mb/s" ]; then like here, this should be ... "\$SPEED" == "1000Mb/s" ... > echo NIC running at 1000mb/s > echo "ETHTOOL_OPTS=\"speed 1000 duplex full autoneg on\"" >> > /etc/sysconfig/network-scripts/ifcfg-$ETH echo "Resetting "$ETH if ETH is a template variable then it should stay as is (unescaped) > ifup $DEV what's DEV? > elif [ "$SPEED" == "100Mb/s" ]; then again, SPEED needs to be escaped here > echo NIC running at 100mb/s > echo "ETHTOOL_OPTS=\"speed 100 duplex full autoneg off\"" >> > /etc/sysconfig/network-scripts/ifcfg-"$ETH" echo "Resetting "$ETH > ifup $ETH and ETH stays as is > else > echo could not determine speed > fi > ethtool $ETH likewise here > #end raw and get rid of that. Hope I managed to explain this a bit. Remember that you also need the script where you're including the '$SNIPPET()' call to have the 'Template' option checked, as otherwise it will be implicitly wrapped in '#raw' and '#end raw' statements which would disable templating (and therefore prevent ETH variable from being resolved in your example). -- Michael Gliwinski Henderson Group Information Services 9-11 Hightown Avenue, Newtownabby, BT36 4RT Phone: 028 9034 3319 ********************************************************************************************** The information in this email is confidential and may be legally privileged. It is intended solely for the addressee and access to the email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing client engagement leter or contract. If you have received this email in error please notify [email protected] John Henderson (Holdings) Ltd Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT. Registered in Northern Ireland Registration Number NI010588 Vat No.: 814 6399 12 ********************************************************************************* _______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
