31.7. Post-installation Script
%postcommand. This section is useful for functions such as installing additional software and configuring an additional nameserver.
%postsection. If you configured the network for DHCP, the
/etc/resolv.conffile has not been completed when the installation executes the
%postsection. You can access the network, but you can not resolve IP addresses. Thus, if you are using DHCP, you must specify IP addresses in the
- Allows you to specify commands that you would like to run outside of the chroot environment.The following example copies the file
/etc/resolv.confto the file system that was just installed.
%post --nochroot cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
- Allows you to specify a different scripting language, such as Python. Replace /usr/bin/python with the scripting language of your choice.
- Logs the output of the post-install script. Note that the path of the log file must take into account whether or not you use the
--nochrootoption. For example, without
--nochroot:This command is available in Red Hat Enterprise Linux 5.5 and later.
%post --nochroot --log=/mnt/sysimage/root/ks-post.log
--logoption to log the result (in Red Hat Enterprise Linux 5.5 and later):
%post --log=/root/ks-post.log /usr/sbin/subscription-manager register --firstname.lastname@example.org --password=secret --serverurl=sam-server.example.com --org="Admin Group" --environment="Dev" --servicelevel=standard
runmefrom an NFS share:
mkdir /mnt/temp mount -o nolock 10.10.0.2:/usr/new-machines /mnt/temp open -s -w -- /mnt/temp/runme umount /mnt/temp
-o nolockis required when mounting an NFS mount.