As part of the move from SVR4/jumpstart to IPS/AI,
I'm going to need to convert my finish script into
something that works for AI.

The script sets up the system so that root can login
from anywhere, including via ssh. It then sets the
keyboard type so that there is no need for sys-config
to ask about it, dumps a bunch of configuration data
into jumpstart_environment and finally copies over some
files. The files installed are a combination of configuration
files that are common to all the hosts that this finish
script is used for and some that are specific to the host.
The common ones are stored in a .tar file (because they do
not change often) whereas others, such as /etc/hostname.*,
are placed in a directory tree that mirrors that of the
system after install.

Finally it adds a user and updates the pam configuration.

Darren

#!/bin/sh
BASE=/a
 > ${BASE}/jumpstart_environment 2>&1
set -x
#
# The sequence "mv, cp -p, sed" is intended to ensure that the original file
# times, etc, are preserved while the new file gets all of the same 
owner/group
# and permissions before being overwritten with the new contents.
#
LOGIN=${BASE}/etc/default/login
if [ -f ${LOGIN} ] ; then
         mv ${LOGIN} ${LOGIN}.dist
         cp -p ${LOGIN}.dist ${LOGIN}
         sed -e 's/^CONSOLE/#CONSOLE/' ${LOGIN}.dist > ${LOGIN}
fi
SSHD=${BASE}/etc/ssh/sshd_config
if [ -f ${SSHD} ] ; then
         mv ${SSHD} ${SSHD}.dist
         cp -p ${SSHD}.dist ${SSHD}
         sed -e 's/PermitRootLogin no/PermitRootLogin yes/' ${SSHD}.dist 
 > ${SSHD
}
fi
KBD=${BASE}/etc/default/kbd
cp ${KBD} ${BASE}
if [ -f ${KBD} ] ; then
         mv ${KBD} ${KBD}.dist
         cp -p ${KBD}.dist ${KBD}
         sed -e 's/^#LAYOUT.*/LAYOUT=US-English/' ${KBD}.dist > ${KBD}
fi

set >> ${BASE}/jumpstart_environment 2>&1
df -k >> ${BASE}/jumpstart_environment 2>&1
pwd >> ${BASE}/jumpstart_environment 2>&1
ps -ef >> ${BASE}/jumpstart_environment 2>&1
ifconfig -a >> ${BASE}/jumpstart_environment 2>&1
cd /a
ls -aCFR ${SI_CONFIG_DIR}
pwd
#
# Extract all of the common configuration bits
#
tar xvpf ${SI_CONFIG_DIR}/config.tar
pwd
cd ${SI_CONFIG_DIR}/root
#
# Copy over the host specific bits
#
pax -r -w -v -pp . /a
#
# Add a test user
#
echo 'testusr:*:101:101:::/bin/false' >> ${BASE}/etc/passwd
echo 'testusr:*LK*:101:::::' >> ${BASE}/etc/shadow
#
# When enabling TX label extensions, this is required to allow
# logins from normal hosts
#
echo 'other     account required        pam_tsol_account.so.1   
allow_unlabeled'
 >> ${BASE}/etc/pam.conf

exit 0


Reply via email to