Bug 18110

Summary: RFE: Don't strip comments from %post script - ignore instead
Product: [Retired] Red Hat Linux Reporter: Karl Hakimian <hakimian>
Component: anacondaAssignee: Michael Fulbright <msf>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 7.0Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-01-09 23:40:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karl Hakimian 2000-10-02 16:42:26 UTC
The documentation says that anaconda will ignore comments. Instead,
it actually strips them from the file including from the %post
section. This breaks post scripts such as

cat <<EOF >/etc/init.d/service
#!/bin/sh
#
# chkconfig: - 95 10
# description: local startup script
#
do something...
EOF

This can be worked around with something like

sed -n 's/^-- //p' <<EOF >/etc/init.d/service
-- #!/bin/sh
-- #
-- # chkconfig: - 95 10
-- # description: local startup script
-- #
-- do something...
EOF

But that is a bit of a pain, when just passing the comments would make
life a lot easier.

Comment 1 Erik Troan 2000-11-21 18:17:17 UTC
Fixed in CVS. Left blank lines in as well.

Comment 2 Brock Organ 2000-12-12 22:11:52 UTC
this failed in test w/the qa1212.1 tree:

lang en_US
network --bootproto dhcp
nfs --server porkchop --dir /mnt/redhat/test/qa1212.1/i386
keyboard "us"
zerombr yes
clearpart --all
part / --size 2000 --asprimary 
part swap --size 256 --asprimary 
install
mouse genericps/2
timezone America/New_York
xconfig 
rootpw xxxxxxxx
auth --useshadow --enablemd5
lilo --location mbr --append "mem=60m"
%packages
@Base
@X Window System

%post

cat <<EOF >/tmp/foo.test
#!/bin/sh
#
# chkconfig: - 95 10
# description: local startup script
#
echo "foo.test"
EOF

fails with a traceback:

Traceback (innermost last):
File "/usr/bin/anaconda", line 346, 
File "/usr/lib/anaconda/kickstart.py", line 605,
File "/usr/lib/anaconda/kickstart.py", line 566,
File "/usr/lib/anaconda/kickstart.py", line 391, in readKickstart
if args[0]=="%post" or args[0]=="%pre":

IndexError: list index out of range





Comment 3 Michael Fulbright 2001-01-09 23:40:31 UTC
Should be fixed according to ewt.

Comment 4 Brock Organ 2001-01-10 21:26:24 UTC
verified fix in qa0110.0 test tree ...

Comment 5 Mike A. Harris 2001-07-17 14:12:47 UTC
*** Bug 47343 has been marked as a duplicate of this bug. ***

Comment 6 Mike A. Harris 2001-07-17 14:15:48 UTC
No no no..  Not a dupe, 18810, not 18110..  duh..  sorry.