Bug 88007

Summary: kickstart 8.0 ignores I/O redirectors in POST section
Product: [Retired] Red Hat Linux Reporter: Craig <craig>
Component: anacondaAssignee: Jeremy Katz <katzj>
Status: CLOSED NOTABUG QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-04-07 15:08:46 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 Craig 2003-04-04 15:41:25 UTC
Description of problem:
IN 7.2 and 7.3 this post script worked fine. In Version 8.0 it completly 
ignores the commands. I have tried enclosing the 

whole string in back tics and that does not work. I have tried 
specifying /bin/sh as the interpreter and that does not work, 

I have tried specifying nothing to the interpreter (like with 7.2 and 7.3) and 
that does not work either.

# This is the syntax which should work as it did in previous versions!

%post 

/bin/cat <<MOTD >/etc/motd

                        Red Hat Linux 8.0 Kickstart-installed

                                    COMPANY NAME
        UNAUTHORIZED PERSONS WILL BE PROSECUTED TO THE FULL EXTENT OF THE LAW

                        All Trafic is Logged and Monitored on remote machines

MOTD



# This is the only way it will work now which is ridiculous!

%post --interpreter /bin/sh  

echo "========> Setting MOTD"
`/bin/echo "" >/etc/motd`
`/bin/echo "	     Red Hat Linux 8.0 Kickstart-installed 
`/bin/date`">>/etc/motd`
`/bin/echo "">>/etc/motd`
`/bin/echo "			  ??? INTERNET SERVICES NETWORK">>/etc/motd`
`/bin/echo "">>/etc/motd`
`/bin/echo "	UNAUTHORIZED PERSONS WILL BE PROSECUTED TO THE FULL EXTENT OF 
THE LAW">>/etc/motd`
`/bin/echo "">>/etc/motd`
`/bin/echo "		  -- Helpdesk Information: (????)">>/etc/motd`
`/bin/echo "">>/etc/motd`
`/bin/echo "		  All Trafic is Logged and Monitored on remote 
machines">>/etc/motd`
`/bin/echo "">>/etc/motd`

#Here is the full kickstart file for 8.0:


######################################################################

#Kickstart config file for emcweb.com
#Generated on Thu Apr  3 14:15:30 EST 2003
#Host_Name = test.emcweb.com

######################################################################

# Language Support - Time Zone 

######################################################################

install 
lang en_US 
langsupport --default en_US en_US
timezone US/Eastern 

######################################################################

# Networking Support

######################################################################

network --bootproto dhcp
nfs --server 192.168.204.11 --dir /kickstart/8.0 

######################################################################

# Keyboard, Mouse, Monitor and X Config 

######################################################################


keyboard us
mouse generic3ps/2
skipx

######################################################################

# Boot Partitions, FS Types, Size, Location, MBR 

######################################################################

zerombr yes
clearpart --all
bootloader --useLilo --linear mbr

part /boot --fstype ext3 --size 125 --asprimary --ondisk sda
part / --fstype ext3 --size 4750 --asprimary --ondisk sda
part swap --size 1024 --asprimary --ondisk sda
part /tmp --size 256 --ondisk sda
part /var --fstype ext3 --size 2048 --ondisk=sda
part /home --fstype ext3 --size 2048 --ondisk=sda
part /uo1 --fstype ext3 --size 2048 --ondisk=sda
part /uo2 --fstype ext3 --size 245 --ondisk=sda
part /uo3 --fstype ext3 --size 256 --ondisk=sdb

######################################################################

# Security Setting and Encrypted Password 

######################################################################


rootpw --iscrypted "removed for thismail"
auth --useshadow --enablemd5

######################################################################


# End System Config - Start Package List 

######################################################################

%packages --resolvedeps 

@ Editors
tcpdump
libesmtp

#End Packages and Dependencies - begin POST Scripts 

######################################################################

%post --interpreter /bin/sh  

/bin/cat <<MOTD >/etc/motd

                        Red Hat Linux 8.0 Kickstart-installed

                        Company
        UNAUTHORIZED PERSONS WILL BE PROSECUTED TO THE FULL EXTENT OF THE LAW

                        All Trafic is Logged and Monitored on remote machines

MOTD

######################################################################

#Setup Network
######################################################################


#Start /etc/hosts
######################################################################


/bin/cat <<END_HOSTS >/etc/hosts

127.0.0.1	localhost.localdomain	localhost
198.77.112.250	test	test.emcweb.com
172.27.5.24	test-nbr	test-nbr.emcweb.com
172.28.60.65	test-p	test-p.emcweb.com

END_HOSTS

######################################################################

######################################################################



/bin/cat <<END_NETWORK >/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=test.emcweb.com
GATEWAY="192.168.100.1"
GATEWAYDEVICE="ETH0"

END_NETWORK

######################################################################


#Start /etc/resolv.conf

######################################################################

/bin/cat <<END_RESOLV >/etc/resolv.conf

search emcweb.com
nameserver 192.168.100.217
nameserver 192.168.100.218

END_RESOLV
######################################################################

######################################################################


#Setup ETH0 - Static Routable IP 

######################################################################


/bin/cat <<END_ETH0 >/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=66.66.66.66
NETMASK=255.255.255.0
GATEWAY=66.66.66.1
TYPE=ETHERNET
USERCTL=no
NETWORK=66.66.66.0
BROADCAST=66.66.66.255

END_ETH0

######################################################################

#Start /etc/ntp.conf

######################################################################

/bin/cat <<END_NTP >/etc/ntp.conf

server	18.26.4.105
server	18.145.0.30
server	208.184.49.9
driftfile /etc/ntp/drift
authenticate no

END_NTP

######################################################################

#Setup root shell - tcsh

######################################################################


/usr/bin/chsh -s /bin/tcsh root

######################################################################

#Start date and version creation

######################################################################


/bin/echo "Kickstarted `/bin/date +%D`" > /.version

######################################################################

#Setup serial connection - Change lilo.conf - Change /etc/inittab -
 /etc/securetty

######################################################################


/bin/cp /etc/lilo.conf /etc/lilo.conf.orig
/bin/awk '{print};/root=\/dev\/sda2/{print "append=\"console=tty0 
console=ttyS0,9600n8\""}' /etc/lilo.conf.orig > 

/etc/lilo.conf.new1
/bin/awk '{print};/^default=linux/
{print "serial=0,9600n8"}' /etc/lilo.conf.new1 > /etc/lilo.conf
/bin/cp /etc/inittab /etc/inittab.orig
/bin/awk '{print};/# Run gettys in standard runlevels/
{print "s0:2345:respawn:/sbin/agetty -ihL ttyS0 9600 vt100"}' 

/etc/inittab.orig > /etc/inittab
/bin/echo ttyS0 >> /etc/securetty

/bin/mkdir /mnt/floppy /mnt/cdrom
######################################################################

#Setup list of all installed RPM's

######################################################################


/bin/rpm -qa | sort >> /.version

######################################################################

#Setup list of all RPM's to be removed form base install

######################################################################

rpm -e desktop-backgrounds
rpm -e dhcpcd
rpm -e efax
rpm -e fetchmail
rpm -e finger
rpm -e finger-server
rpm -e gftp
rpm -e xisdnload
rpm -e isdn4k-utils
rpm -e foomatic
rpm -e LPRng
rpm -e metamail
rpm -e ncftp
rpm -e pine
rpm -e rp-pppoe
rpm -e printconf-gui
rpm -e printconf
rpm -e procmail
rpm -e rsh
rpm -e rsh-server
rpm -e rwall-server
rpm -e rsync
rpm -e rwho
rpm -e rdate
rpm -e rusers
rpm -e rusers-server
rpm -e talk-server
rpm -e telnet-server
rpm -e wvdial
rpm -e ypserv
rpm -e yp-tools
######################################################################


#Setup Runtime Parameters for each service

######################################################################

/sbin/chkconfig --level 12345 kudzu off
/sbin/chkconfig --level 12345 sendmail off
/sbin/chkconfig --level 12345 rawdevices off
/sbin/chkconfig --level 12345 apmd off
/sbin/chkconfig --level 12345 ipchains off
/sbin/chkconfig --level 12345 iptables off
/sbin/chkconfig --level 12345 lpd off
/sbin/chkconfig --level 12345 portmap off
/sbin/chkconfig --level 12345 autofs off
/sbin/chkconfig --level 12345 nfs off
/sbin/chkconfig --level 12345 nfslock off
/sbin/chkconfig --level 12345 nscd off
/sbin/chkconfig --level 12345 radvd off
/sbin/chkconfig --level 12345 rwhod off
/sbin/chkconfig --level 12345 snmpd off
/sbin/chkconfig --level 12345 rhnsd off
/sbin/chkconfig --level 12345 isdn off
/sbin/chkconfig --level 12345 bcm5820 off
/sbin/chkconfig --level 12345 httpd off
/sbin/chkconfig --level 12345 squid off
/sbin/chkconfig --level 12345 tux off
/sbin/chkconfig --level 12345 rarpd off
/sbin/chkconfig --level 12345 mysqld off
/sbin/chkconfig --level 12345 keytable on
/sbin/chkconfig --level 12345 atd on
/sbin/chkconfig --level 12345 syslog on
/sbin/chkconfig --level 12345 gpm on
/sbin/chkconfig --level 12345 network on
/sbin/chkconfig --level 12345 random on
/sbin/chkconfig --level 12345 crond on
/sbin/chkconfig --level 12345 anacron on
/sbin/chkconfig --level 12345 ntpd on
/sbin/chkconfig --level 12345 sshd on
/sbin/chkconfig --level 12345 linuxconf on

######################################################################

Version-Release number of selected component (if applicable):

How reproducible: Run kickstart with I/O redirectos. (use above with own 
encrypted password added)

Steps to Reproduce:
1. Use kickstart above but enter in you own encrypted password
2. Run any commands in the post section with /bin/sh
3. That's it.

Actual results:

The install works fine accept all the custom configuration done foe each 
individual machine is lost as the I/O directors "<<EOF" are ignored and 
actually error out if you what the F4 console at the end of the install.

Expected results:

The I/O operators should be followed and the hosts file, ntp file and motd file 
should all be changes with the text that is pushed to them.



There is no error output when I use the /bin/sh as interpreter but the commands 
do not get executed.

Comment 1 Tim Waugh 2003-04-04 15:45:53 UTC
This sort of thing certainly works for kickstart in Red Hat Linux 9, FWIW.

Redirection is a shell thing, not sh-utils.  Besides, since shell redirection
certainly works in 8.0, this must be something wrong in anaconda.

Comment 2 Jeremy Katz 2003-04-04 20:16:04 UTC
This works fine for me.  Do you mistakenly have DOS line returns at the end of
your lines or something similar?

Comment 3 Craig 2003-04-07 13:58:51 UTC
The script is generated the same way as it was for 7.2 and 7.3. Perl writes out
the file from a script. I have opended the file in vi and there are no visable
^M. I also ran the script through dos2unix and again the post instructions
failed to work. 

The F3 console displays "command not founde 1:"

Comment 4 Craig 2003-04-07 15:00:25 UTC
Ok chaps, sorry! you are right. There was an extra whitespaces at the end of 5
lines which was casuing the "post" to tank. Not sure why it worked on the 7.2
and 7.3 but I apologize for the wild-goose-chase! I tried everything else and
even dos2unix was not help, which of course it wouldn't be in this situation.

Thanks!

Comment 5 Jeremy Katz 2003-04-07 15:08:46 UTC
Great, glad you tracked it down.