[et-mgmt-tools] Cobbler, Cheetah and scripts in KS files
Aaron Lippold
lippold at gmail.com
Mon Jun 11 13:26:15 UTC 2007
Hi,
When I tried that I got an 'end of line expected' now.
Here is the code that I am trying to use in my ks file.
FSTAB=/etc/fstab
SED=/bin/sed
# nosuid on /home
if [ $(grep " \/home " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then
MNT_OPTS=$(grep " \/home " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/home.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB}
fi
# nosuid on /sys
if [ $(grep " \/sys " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then
MNT_OPTS=$(grep " \/sys " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/sys.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB}
fi
# nosuid on /boot
if [ $(grep " \/boot " ${FSTAB} | grep -c "nosuid") -eq 0 ]; then
MNT_OPTS=$(grep " \/boot " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/boot.*${MNT_OPTS}\)/\1,nosuid/" ${FSTAB}
fi
# nodev on /usr
if [ $(grep " \/usr " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/usr " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/usr.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
#nodev on /home
if [ $(grep " \/home " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/home " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/home.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
# nodev on /usr
if [ $(grep " \/usr " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/usr " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/usr.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
# nodev on /usr/local
if [ $(grep " \/usr\/local " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/usr\/local " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/usr\/local.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
# nodev on /tmp
if [ $(grep " \/tmp " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/tmp " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/tmp.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
# nodev on /var
if [ $(grep " \/var " ${FSTAB} | grep -c "nodev") -eq 0 ]; then
MNT_OPTS=$(grep " \/var " ${FSTAB} | awk '{print $4}')
${SED} -i "s/\( \/var.*${MNT_OPTS}\)/\1,nodev/" ${FSTAB}
fi
Thanks,
Aaron
On 6/8/07, Michael DeHaan <mdehaan at redhat.com> wrote:
> Aaron Lippold wrote:
> > Hi All,
> >
> > I am having issues with cobbler and importing a ks file of mine. All
> > is well with the simple parts of the %post section, but when I get to
> > a bit of scripting, the Cheetah parser complains at '" \/home "
> > ${FSTAB} ' etc.
> >
> > How can I escape this section or something?
> >
> > Thanks,
> >
> > Aaron
>
> Dollar signs need to be escaped with \$ since Cheetah is viewing the
> shell invocations as Cheetah code.
>
> This is not true of something like $foosball, where it will just say as
> "$foosball" if there is no key, but for something like ${foosball}, then
> yes, it must be escaped.
>
> Unfortunate, I agree. If anyone has any suggestions on better
> templating libraries that don't require something heinous like Kid's
> XML, I'm all ears. Templating systems
> all appear to have their ups and downs, which is apparently why everyone
> seems to write their own. That's an option too, but I'm trying to not
> go there :)
>
> --Michael
>
>
> _______________________________________________
> et-mgmt-tools mailing list
> et-mgmt-tools at redhat.com
> https://www.redhat.com/mailman/listinfo/et-mgmt-tools
>
More information about the et-mgmt-tools
mailing list