0

I'm using CentOS 6.5 with Cobbler 2.4 (from EPEL). I'm trying to use a heredoc comment to create a repo file (which works) without the $basearch being interpreted. What happens is the file is created except $basearch is replaced with nothing (e.g. it's removed).

What I have:

%post
#raw
cat > /etc/yum.repos.d/blah.repo <<REPO
[repo]
name=repo
baseurl=http://repo.local/repo/$basearch
enabled=1
priority=99
gpgcheck=0
REPO
#end raw
%end

What actually gets put in /etc/yum.repos.d/blah.repo ($basearch is missing):

[repo]
name=repo
baseurl=http://repo.local/repo/
enabled=1
priority=99
gpgcheck=0

Things I have have verified:

  • I know it's not Cobbler or Cheetah because cobbler validateks and cobbler profile getks ... reports back to me the kickstart script unmodified (when using #raw and #end raw.
  • I created a sample of the template within Cheetah and it properly showed the un-escaped string.

I was doing some further research and found this, from the first bullet it looks like $basearch is a special variable within kickstart. Are there any suggestions on how to get around this without using curl to get the file or explicitly defining the architecture? I want to keep this within the kickstart file for simplicity sake.

1 Answers1

0

The issue was that I had to escape the #raw and #end raw as it was being interpreted by bash.

%post
#raw
cat > /etc/yum.repos.d/blah.repo <<REPO
[repo]
name=repo
baseurl=http://repo.local/repo/\$basearch
enabled=1
priority=99
gpgcheck=0
REPO
#end raw
%end