jumpstart - finish scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers jumpstart - finish scripts
# 1  
Old 03-27-2003
jumpstart - finish scripts

hi,

where i can find some help on how to write finish scripts for jump-start??
i tried sun-blueprints but i couldnt find it...
# 2  
Old 03-27-2003
I saw a small blurb here:

Quote:
4.0 Begin & Finish Scripts

These are the optional features of jumpstart .

A begin script is a shell script which is used to perform the task before Solaris OS is installed. A finish script is used to perform the tasks after the OS is installed but before reboot.

Output of these scripts goes to /var/adm/begin.log and finish.log.
These should be owned by the root with permission 644
Also, check out http://www.blacksheepnetworks.com/security/resources/ and search for the phrase "SOLARIS JUMPSTART" - there's gotta be something you can use there. Smilie

Here another resource:
http://www.sun.com/solutions/blueprints/0800/jssec2.pdf

Last edited by oombera; 03-27-2003 at 11:12 AM..
# 3  
Old 04-03-2003
If you can try

For example:

Look at the following line for your rule file, that is you have a SUN E420R, with between 512 and 1024 RAM size and a hard disk between 8 and 18 GB, use the normal_BE.profile ( in the /jumpstart/Profiles/BE directory) and a Finish script MR_inst_drivers_BE.sh (in /jumpstart/Drivers directory)

model SUNW,Ultra-80 && memsize 512-1024 && disksize c0t0d0 8192-194560 - Profiles/BE/normal_BE.profile Drivers/MR_inst_drivers_BE.sh


The MR_inst_drivers_BE.sh can look like this:
Code:
#!/bin/sh
#
# Basic driver for Enterprise Engineering lab hosts.
#
FINISH_DIR="${SI_CONFIG_DIR}/Finish"
SCRIPT_LIST="install_recommended_patches.sh dns_config.sh cust_prof.sh"

for script in ${SCRIPT_LIST}
do
    if [ -f "${FINISH_DIR}/${script}" ]; then
        echo "Starting finish script: ${script}"
        echo ""
        . ${FINISH_DIR}/${script}
    else
        echo "ERROR: File not found: ${script}"
    fi
done

This Finish script look in the /jumpstart/Finish Directory and run
3 scripts:

install_recommended_patches.sh

dns_config.sh

cust_prof.sh



For example install_recommended_patches.sh looks like:
Code:
#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`ps -ef |grep agregar |grep -v grep |awk '{print $13}'`"

mount -F nfs -o ro 192.168.215.183:/jumpstart/Patches ${BASEDIR}${PATCH_DIR}
case ${OE_VER} in

   5.8)
      PATCH_SERV_DIR=8_Recommended
      ;;

   5.7)
      PATCH_SERV_DIR=7_Recommended
      ;;

   5.6)
      PATCH_SERV_DIR=2.6_Recommended
      ;;

   5.5.1)
      PATCH_SERV_DIR=2.5.1_Recommended
      ;;

   *)
      errorCondition=1
      ;;

esac


if [ ${errorCondition} = 0 ]; then
   if [ ! -d ${BASEDIR}${PATCH_DIR} ]; then
      echo  "The directory, ${PATCH_DIR}, does not exist."
   else

      # Some patches require a loopback filesystem be used when 
      # installing using chroot.

      if [ -d /proc ]; then
         if [ "`df -n /proc | awk '{ print $3 }'`" = "proc" ]; then
            if [ -d ${BASEDIR}/proc ]; then
               if [ "`df -n ${BASEDIR}/proc | \
                  awk '{ print $3 }'`" != "proc" ]; then
                  mount -F lofs /proc ${BASEDIR}/proc
                  mountedProc=1
               fi
            fi
         fi
      fi

      if [ ! -s ${MNTTAB} ]; then
         if [ -s /etc/mnttab ]; then

            # First create ${MNTTAB} so patches can read it:

            echo "Copying /etc/mnttab from miniroot to ${MNTTAB}"
            echo ""

            rm -f ${MNTTAB}

            if [ "${OE_VER}" = "5.5.1" ]; then

               # This is necessary for "install_cluster" to get the mount
               # point for /var/sadm/patch from the "real" root filesystem.

               cat /etc/mnttab | sed 's/\/a/\//g' > ${MNTTAB}

               # This is necessary for "df" to execute which is needed by
               # "install_cluster" to determine if enough free disk 
               # space exists on the target system.

               touch           ${BASEDIR}/etc/.mnttab.lock
               chown root:root ${BASEDIR}/etc/.mnttab.lock
               chmod 644       ${BASEDIR}/etc/.mnttab.lock
            else
               cp /etc/mnttab ${MNTTAB}
            fi
         else
            echo  "Could not find a valid /etc/mnttab"
            errorCondition=1
         fi
      fi

      if [ ${errorCondition} = 0 ]; then

         SHOWCOMMAND=""

         if [ -x ${BASEDIR}/usr/sbin/patchadd ]; then
            SHOWCOMMAND="/usr/sbin/patchadd"
         elif [ -x ${BASEDIR}/usr/bin/showrev ]; then
            SHOWCOMMAND="/usr/bin/showrev"
         fi

#         if [ "${SHOWCOMMAND}" != "" ]; then
#            echo "The following patches are currently installed:"
#            echo ""
#            chroot ${BASEDIR} ${SHOWCOMMAND} -p
#            echo ""
#         fi
   
         cd ${BASEDIR}${PATCH_DIR}
   
         if [ -d ${PATCH_SERV_DIR} ]; then
            echo "Installing the ${PATCH_SERV_DIR} patch cluster."
            echo ""
   
            if [ "${SHOWCOMMAND}" = "/usr/sbin/patchadd" ]; then
               chroot ${BASEDIR} /usr/sbin/patchadd -d -u \
                  -M ${PATCH_DIR}/${PATCH_SERV_DIR} patch_order
            elif [ -x ${PATCH_DIR}/${PATCH_SERV_DIR}/install_cluster ]; then
               chroot ${BASEDIR} \
                  ${PATCH_DIR}/${PATCH_SERV_DIR}/install_cluster -q \
                  ${PATCH_DIR}/${PATCH_SERV_DIR}
            else
                  echo  "Cannot find /usr/sbin/patchadd or install_cluster"
            fi
         else 
            echo  "Could not find the ${PATCH_SERV_DIR} patch cluster"
         fi
      fi
cp -p ${BASEDIR}${PATCH_DIR}/nsswitch.conf /a/etc/nsswitch.conf

      umount ${BASEDIR}${PATCH_DIR}
      if [ ${mountedProc} = 1 ]; then
         umount ${BASEDIR}/proc
      fi
   fi
fi

For example dns_config.sh looks like:
Code:
#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`uname -r`"
echo "domain labo.mr.com.ar" >> /a/etc/resolv.conf
echo "nameserver 200.149.64.166" >> /a/etc/resolv.conf
echo "nameserver 200.149.64.167" >> /a/etc/resolv.conf

and cust_prof.sh looks like:
Code:
#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`uname -r`"
echo "PATH=$PATH:/usr/local/bin:/usr/dt/bin:/usr/openwin/bin" >> /a/etc/profile
echo "export PATH" >> /a/etc/profile

This help you ?

Regards. Hugo.

added code tags for readability --oombera

Last edited by oombera; 02-17-2004 at 03:27 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Who can finish this script?

Good morning dear friends, I want to write an UNIX script to do the following task: We have 6 directories, called (SMS_01, SMS_02 ....... SMS_06), some files are distributed across these directories, but the distribution process is not good, I mean when I check these directories I found the... (14 Replies)
Discussion started by: Mohannad
14 Replies

2. Shell Programming and Scripting

Waiting a job to finish

Hello again, I am runnning a job on a cluster and I submit a job with the command qsub script.sh where script.sh is a script with the command i want o use. When i enter this command the cluster gives a huber like 123456 as the JOB ID. I want the job to run about 12 hours and when it... (5 Replies)
Discussion started by: lengolass
5 Replies

3. Shell Programming and Scripting

Please help me to finish this scripts

Hi All, Can anyone help me to finish the scripts. this scripts is this scripts will run on crontab in every 4 minutes to get the newest router interface status. I would like to add a function to count the router interface flapping, if more than 2 times in 20 minutes (scripts run 5 times)... (1 Reply)
Discussion started by: momo0617
1 Replies

4. Shell Programming and Scripting

finish of file

Hello, I'm doing a script where I'm traveling a file, and moves down line by line, and is copied to another file, up to the line 100, then the smaller file passes to another format ... but the problem I have is that if there are 357 lines for example, file 1 2 i 3, converted correctly but the 4... (1 Reply)
Discussion started by: uri_crack
1 Replies

5. Shell Programming and Scripting

Finish script help

I am trying to add a finish script that can copy hosts, static routes and a few other files into relevant directories on a client system. These files would be mounted as nfs resource on the client as hosts.hostname, static_route.hostname etc. Script will compare the hostname of the client and copy... (0 Replies)
Discussion started by: c0kazaz
0 Replies

6. UNIX for Dummies Questions & Answers

Jumpstart finish script (Solaris 10)

Hi there, I wanted to write a finish script for my jumpstart server which creates a ntp.conf file and enables ntp on the client machines during installation. Is that possible? Thanks for the help :) P.S. I'm a real Solaris noob, so do excuse me if I sound like an idiot..lol (1 Reply)
Discussion started by: iman453
1 Replies

7. UNIX for Advanced & Expert Users

commands do not finish

Hi, I have strange problem executing some command on solaris 5.9 ps command does not finish(hangs) and runs forever without any result. same with cc command too.Please suggest (1 Reply)
Discussion started by: Raom
1 Replies

8. UNIX for Dummies Questions & Answers

how do i finish this last one..

i tried to build a command to replaces the word "include" with "exclude" in each *.h type of file in a certain directory and to display the lines in which the switch happened. i did a command and i dont know why its not working find /usr -name "*.h" -exec sed 's/include/exclude/g' {} \;... (2 Replies)
Discussion started by: newby2
2 Replies

9. UNIX for Advanced & Expert Users

insert pipe in the finish of the line

hi, i have a flat file, with lines (records), and fields, and each field is separated by pipe ( | ) : 1|078|012006|3,9 2|078|012006|8692275|4|2|GON3507090 2|078|012006|7655734|9|0|GON3507090 2|078|012006|7572405|5|4|GCR5N07090 what i need is to insert a pipe in the end of the line:... (3 Replies)
Discussion started by: DebianJ
3 Replies

10. UNIX for Advanced & Expert Users

How can I wait for PID to finish in another shell

Have a need to schedule programs that can run after other programs are completed. Here's the catch: 1) The list of programs will not always be the same (kind of a plug-n-play deal) 2) The invoking shell may not be the same as the shell of the program being waited on In other words, I need... (2 Replies)
Discussion started by: superdelic
2 Replies
Login or Register to Ask a Question