# !/usr/bin/ksh # # (c)Copyright 1996 Hewlett-Packard Co., All Rights Reserved. # $Header: /ignite/cold_fusion/src/scripts/os_arch_post_l 10.34 1998/07/20 19:14:04 finz Exp $ # ## ## This file is the post_load script which runs when an OS ## archive has been loaded onto a system as part of the Ignite-UX process. ## ## This file may need to be customized to match the OS archive you will be ## using. ## ## WARNING: If you need to modify this file, you should copy this file to ## /var/opt/ignite/scripts and modify that copy. You will ## then need to change any config files that reference this ## file to reference the modified copy. Otherwise the ## version of this file in /opt/ignite/scripts will get ## overwritten the next time Ignite-UX is updated and any ## changes would be lost. ## ARCHIVE_SAVE_DIR="/tmp/ign_configure/os/archive_save" ARCHIVE_SAVE_FILE="/tmp/ign_configure/os/archive_save/ig_save_file" INSTALL_VARS_FILE=/tmp/install.vars RECOVERY_MODE=FALSE ############################################################################### # # Function: save_file # # Purpose: Save a file that was delivered as part of the archive. This # routine should be called when: # - the file in question is one that Ignite-UX will # directly manipulate # - you want the version from the archive to end up on the # system # # Also keep track of what files were saved so that they can be # restored by restore_files() in os_arch_post_c (the post config # script for the OS archive). # # Parms: $1 full pathname of the file to save # save_file() { source=$1 target="$ARCHIVE_SAVE_DIR$source" if [[ -f $source ]]; then ldir=`dirname $target` mkdir -p $ldir cp -pf $source $target echo $source >> $ARCHIVE_SAVE_FILE else echo "NOTE: Could not save $source from archive: file not found" fi } # end of save_file() ############################################################################### # # Function: remove_tlinks # # Purpose: This routine walks through the transition link table and # removes all links found on the system. This is necessary when # an archive contains the links because the extraction cmds # do not handle the "t" bit. By removing them here and then # allowing tlinstall to run, it makes it possible # to use tlremove in the future. # # This routine does not need to be run if a tlremove was done on # the system before the archive was produced. # remove_tlinks() { # The order is significant here since tl_ttdb typically contains entries # for directories which have isu_tl_ttdb file entries. TABLES="/opt/upgrade/lib/isu_tl_ttdb /opt/upgrade/lib/tl_ttdb" for tab in $TABLES; do if [[ -f $tab ]] ; then awk -F: '{print $1}' ${tab} | while read pathname ; do if [[ -L ${pathname} ]] ; then /usr/bin/rm -f ${pathname} fi done fi done } # end of remove_tlinks() ############################################################################### # # MAIN # # Manipulate which of the actions take place by commenting or uncommenting # the various routines below. For the parts you may want to change to # match your needs below, you will normally be changing the non-recovery # case. # # # Source the install.vars file so we know if this is recovery mode or not. # if [[ -f $INSTALL_VARS_FILE ]]; then . $INSTALL_VARS_FILE else echo "Could not source $INSTALL_VARS_FILE: will assume recovery_mode is false" fi # # Handle the recovery mode case first. Note that recovery mode is by default # off. # if [[ "$RECOVERY_MODE" = "TRUE" ]]; then echo "Running in recovery mode." save_file /etc/hosts save_file /etc/resolv.conf save_file /etc/rc.config.d/namesvrs cp -p /etc/rc.config.d/netconf /etc/rc.config.d/netconf.final save_file /etc/fstab # save_file /etc/mnttab # save_file /etc/lvmtab # save_file /var/adm/sbtab # TODO: will this work for mult disks? # rm -f /stand/vmunix # rm -f /stand/bootconf save_file /etc/ioconfig save_file /stand/ioconfig # save_file /etc/eisa/config.log # save_file /etc/eisa/config.err save_file /etc/eisa/system.sci save_file /var/adm/sw/security/_ACL save_file /var/adm/sw/security/_OWNER save_file /var/adm/sw/security/_PROD_DFLT_ACL save_file /var/adm/sw/security/_SOC_DFLT_ACL save_file /var/adm/sw/security/secrets save_file /var/adm/sw/defaults save_file /var/opt/ignite/local/manifest/manifest save_file /var/opt/ignite/local/manifest/manifest.info save_file /var/opt/ignite/local/manifest/manifest.oinfo save_file /var/opt/ignite/local/manifest/manifest.orig save_file /var/opt/ignite/local/manifest/manifest.seed save_file /opt/ignite/bin/print_manifest save_file /opt/ignite/share/man/man1m.Z/print_manifest.1m # save_file /tmp/install.vars save_file /etc/kbdlang rm -f /etc/dhcpclient.data rm -f /var/adm/crash/* if [[ -f "/etc/nsswitch.conf" ]]; then mv /etc/nsswitch.conf /etc/nsswitch.final fi remove_tlinks # save_file /opt/upgrade/bin/tlinstall # rm -f /opt/upgrade/bin/tlinstall return 0 fi # # Networking files: # /etc/hosts # /etc/resolv.conf # /etc/rc.config.d/namesvrs # By default, these files will be constructed from the information # in the config file. The starting point for the hosts file is the # /usr/newconfig version, which just has a loopback entry. The other files # are built from scratch. To get the archive versions of these files, # uncomment the save_file()s here and comment out the rm's. # #save_file /etc/hosts rm -f /etc/resolv.conf #save_file /etc/resolv.conf #save_file /etc/rc.config.d/namesvrs # # Netconf Networking file: # /etc/rc.config.d/netconf # By default, this file will be constructed from the information # in the config file. The starting point for the file is the # netconf file in the archive (which is normally a newconfig version). # To get the archive versions of this file, uncomment the copy below. # #cp -p /etc/rc.config.d/netconf /etc/rc.config.d/netconf.final # # Disk layout files: # /etc/fstab # /etc/mnttab # /etc/lvmtab # /var/adm/sbtab # By default, these files will be constructed from the information # in the config file. To get the archive versions of these files, # uncomment the save_file()s here (and comment out the remove of lvmtab). # #save_file /etc/fstab #save_file /etc/mnttab rm -f /etc/lvmtab #save_file /etc/lvmtab #save_file /var/adm/sbtab # # Kernel files: # /stand/vmunix # By default, this file is re-generated based on a concatenation # of: # - the /stand/system file in the archive # - the results of running the create_sysfile program (builds a list of # drivers needed to match the hardware found on the target system). # - additions to the kernel via the mod_kernel attribute or changes # made via SD control scripts # To get this behavior, the kernel must not be in the archive or must # be removed here. If you do not want a new kernel built, include a # kernel in the archive and comment out the remove here. # /stand/system # This file should always exist in the archive. If the kernel itself is # not in the archive, this file will be one of the building blocks # for the kernel to generate (as described above). This file should # include directives for everything needed except what create_sysfile # will generate based on the hardware of the target machine. # /stand/bootconf # This file describes where the boot device can be found and how it # is laid out. By default, the file will be generated to match the disks # that were produced. This will happen when the file is not in the archive # or when it is removed here. If the file is in the archive and is not # removed here, it will be used regardless of its contents. # if [ -x /stand/vmunix ] ; then # The kernel is not removed if it is not executable, this is a # behavior relied on by a workaround that makes it appear that # "diag0" is loading in the kernel. (A workaround for the # HPAutoRAID product) A non-executable /stand/vmunix is created in # this case by a pre_load_cmd which is removed later by a # post_load_cmd. rm -f /stand/vmunix fi rm -f /stand/bootconf # # Device files and friends: # /etc/ioconfig # /stand/ioconfig # These files will be re-built with an ioinit -c. If you wish to # keep the archive versions, you must save them here. # /dev/* # By default, device files in the archive are removed here. # The insf -e command will be run to create device # files for all hardware which is present on the system. In most cases, # the archives should contain no device files to let the correct # device files be generated by insf. Of course, some device files are not # generated by insf. These can be created via add_devfile() in # os_arch_post_c. If device files from the archive are wanted, the # removal should be commented out or ammended here. # /etc/lvmconf/*.conf # Any LVM configuration files in the archive will be overwritten. # #save_file /etc/ioconfig cd /dev rm -rf * #save_file /stand/ioconfig # # EISA configuration files # /etc/eisa/config.log # /etc/eisa/config.err # /etc/eisa/system.sci # By default, any of these files which are put down as part of the archive # will be overwritten. If you wish to end up with the archive version # of any of these files, uncomment the save_file()s here. # #save_file /etc/eisa/config.log #save_file /etc/eisa/config.err #save_file /etc/eisa/system.sci # # SD security files and defaults file # /var/adm/sw/security/* # These files are re-initialized after the archive is loaded. If you wish # the archive versions to end up on the disk, save them here and restore # them in os_arch_post_c. # /var/adm/sw/defaults # This file is re-initialized after the archive is loaded. The file will # be saved from the archive here and restored in os_arch_post_c. If you # do not want this behavior, comment the steps out. In that case, the # newconfig version of the defaults file will be installed (if it was # in your archive). # #save_file /var/adm/sw/security/_ACL #save_file /var/adm/sw/security/_OWNER #save_file /var/adm/sw/security/_PROD_DFLT_ACL #save_file /var/adm/sw/security/_SOC_DFLT_ACL #save_file /var/adm/sw/security/secrets #save_file /var/adm/sw/defaults # # Manifest files # /var/opt/ignite/local/manifest/* # Ignite-UX will always try to create a new manifest. If you want your # existing manifest files to end up on the target system, you should # uncomment the save_files here. The files will then be restored by # os_arch_post_c - overwriting the changes made by Ignite-UX. # /opt/ignite/bin/print_manifest # /opt/ignite/share/man/man1m.Z/print_manifest.1m # These files are automatically installed by Ignite-UX. If you want # the versions of these files that are in the archive, uncomment the # save_file()s for them below. # #save_file /var/opt/ignite/local/manifest/manifest #save_file /var/opt/ignite/local/manifest/manifest.info #save_file /var/opt/ignite/local/manifest/manifest.oinfo #save_file /var/opt/ignite/local/manifest/manifest.orig #save_file /var/opt/ignite/local/manifest/manifest.seed #save_file /opt/ignite/bin/print_manifest #save_file /opt/ignite/share/man/man1m.Z/print_manifest.1m # # Install vars file # /tmp/install.vars # This file is used to tell the set_parms program what the defaults # are for networking parameters, etc. If this file is in the archive, # it will be overwritten by Ignite-UX. You should not need to save # your own version and later restore it, but if you do, this is the # place. # #save_file /tmp/install.vars # Keyboard language file # /etc/kbdlang # If this file is in the archive, it will be overwritten. If you want # the archive version to end up on the system, save it here and restore it # in os_arch_post_c. # #save_file /etc/kbdlang # # DHCP client data file # /etc/dhcpclient.data # If this file is in the archive, it will be overwritten. There is no # way to get the archive version onto the end system. Do *not* remove # this remove statement. # rm -f /etc/dhcpclient.data # # savecore crash dump files # /var/adm/crash/* # The files in this directory are as a result of a system crash. By # default, they are removed. # rm -f /var/adm/crash/* # # /etc/nsswitch.conf file # If you want this file to be put in place from the archive, uncomment # the following line. By default, the file will be overwritten during # the install and then removed at the end of the installation. # # mv /etc/nsswitch.conf /etc/nsswitch.final # # Transition Links # /opt/upgrade/bin/tlinstall # Most archives do not have any transition links. Ignite-UX will do # a tlinstall after the archive has been loaded. If you wish to skip # the tlinstall, remove the cmd here and save it for later if you want it # on your target system. Some SD control scripts rely on transition # links being in place, so it is wise to either allow Ignite-UX to # create them or to ensure that they are in your archive. # # If an archive was created without removing transition links, the links # are in the archive, but as symlinks. In that case, you will need to # remove the links restored from the archive and then let Ignite-UX # re-create them by running tlinstall. We remove tlinks here by default. # remove_tlinks #save_file /opt/upgrade/bin/tlinstall #rm -f /opt/upgrade/bin/tlinstall # Add fiber channel drivers when needed. insf -e -d dev_config if ioscan -fk |grep -q "^fcp " ; then if ! grep -q "^fcT1_fcp$" /stand/system ; then echo "fcT1_fcp" >> /stand/system fi fi # # Exit cleanly. # return 0