Home

view_bootarchive.sh




Purpose

The script view_bootarchive.sh can be used to view the files in a Solaris boot archive. The script is the "next generation" version of my script boot_archive which is described in more detail here: Which files are in the boot_archive?

The script view_bootarchive.sh can also be used to mount a failsafe image, a wanboot image, or any other type of boot image Solaris uses (see the example below).



Back to top

License


# CDDL HEADER START
#
# The contents of this file and the script are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END


Back to top

History


Version
Release date
         Description
v1.0.0
12.10.2011 initial release

####   12.10.2011 v1.0.0/bs
####     script rewritten using the template scriptt.sh
####     changed the name boot_archive to view_bootarchive.sh
####     the script now also works with the new Solaris 10 versions
####       without separate 32 Bit kernel
####     added the parameter -m to use any boot archive
####     did come code cleanup



Back to top

Operating system


Solaris 10 x86 or Solaris 10 SPARC.



Back to top

Language / type


Kornshell Script



Back to top

Prerequisites

n/a, plain Solaris is sufficient



Back to top

Usage


# /data/develop/scripts/view_bootarchive.sh  -v -h   
[13.10.2011 22:00:42] view_bootarchive.sh v1.0.0 started on Thu Oct 13 22:00:42 CEST 2011 
[13.10.2011 22:00:42] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
  view_bootarchive.sh v1.0.0 - view the contents of a Solaris boot archive for SPARC or x86

  Usage: view_bootarchive.sh [-v|+v] [-q|+q] [-h] [-l logfile|+l] [-y|+y] [-n|+n]
                    [-D|+D] [-a|+a] [-O|+O] [-f|+f] [-C] [-H] [-X] [-S n] [-V] [-T]

                    [-m mountpoint] [mount|umount|status] {boot_archive}

 

 Note: Use -{switch} or --{longswitch} to turn an option on;
       use +{switch} or ++{longswitch} to turn an option off

       The long format of the parameter (--parameter/++parameter) is not supported by all ksh implementations
      
      
    Parameter:

      -v|+v - turn verbose mode on/off; current value: y
              Long format: --verbose / ++verbose
      -q|+q - turn quiet mode on/off; current value: n
              Long format: --quiet / ++quiet
      -h    - show usage
              Long format: --help
      -l    - set the logfile
              current value: /var/tmp/view_bootarchive.LOG
              Long format: --logfile     
      +l    - do not write a logfile
              Long format: ++logfile
      -y|+y - assume yes to all questions or not
              Long format: --yes / ++yes
      -n|+n - assume no to all questions or not
              Long format: --no /++no
      -D|+D - run main in single step mode (and turn colors on); current value: n
              Long format: --debug / ++debug
      -a|+a - turn colors on/off; current value: n
              Long format: --color / ++color
      -O|+O - overwrite existing files or not; current value: n
              Long format: --overwrite / ++overwrite
      -f|+f - force; do it anyway; current value: n
              Long format: --force / ++force
      -C    - write a default config file in the current directory and exit
              Long format: --writeconfigfile
      -H    - write extended usage to STDERR and exit
              Long format: --doc
      -X    - write usage examples to STDERR and exit
              Long format: --view_examples
      -S n  - print error/warning summaries:
              n = 0 no summariess, 1 = print error msgs,
              2 = print warning msgs, 3 = print error and warning mgs
              Current value: 0
              Long format: --summaries
      -V    - write version number to STDOUT and exit
              Long format: --version
      -T    - append STDOUT and STDERR to the file "/var/tmp/view_bootarchive.sh.19210.tee.log"
              Long format: --tee

      -m mountpoint
         use this mount point to mount the boot archive

      mount
        mount a boot archive
      umount
        umount a boot archive
      status
        show the status (mounted/not mounted) of a boot archive

      boot_archive
        name of the boot archive to use
        This parameter is optional; the default is the boot archive for the current architecture


[13.10.2011 22:00:42] The log file used was "/tmp/view_bootarchive.sh.19210.TEMP" 
[13.10.2011 22:00:42] view_bootarchive.sh v1.0.0 ended on Thu Oct 13 22:00:42 CEST 2011.
[13.10.2011 22:00:42] The RC is 1.

 
 
 



back to top

Example

Note: Use the parameter -X to get the list of examples

 
  Mount the boot archive for the current platform
 
  ./view_bootarchive.sh
 
  Mount a specific boot archive
 
  ./view_bootarchive.sh mount /var/tmp/other_boot_archive
 
  Umount the boot archive for the current platform
 
  ./view_bootarchive.sh umount
 
  Umount a specific boot archive
 
  ./view_bootarchive.sh umount /var/tmp/other_boot_archive
 


back to top

Example with output


#
#  /var/tmp/view_bootarchive.sh
[14.10.2011 07:18:44] view_bootarchive.sh v1.0.0 started on Fri Oct 14 07:18:44 MEST 2011
[14.10.2011 07:18:44] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
[14.10.2011 07:18:44] Using the log file "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:18:44] Using the boot archive "/platform/sun4v/boot_archive" ...
[14.10.2011 07:18:44] Copying "/platform/sun4v/boot_archive" to "/tmp/_platform_sun4v_boot_archive.uncompressed" ...
[14.10.2011 07:19:10] The boot_archive is mounted readwrite (ufs)]:
/tmp/boot_archive..16785 on /dev/lofi/1 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=24c0001 on Fri Oct 14 07:19:09 2011
[14.10.2011 07:19:10] The log file used was "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:19:10] view_bootarchive.sh v1.0.0 ended on Fri Oct 14 07:19:10 MEST 2011.
[14.10.2011 07:19:10] The RC is 0.
[Fri Oct 14 07:19:10 root@rtdev02 ~]

#  /var/tmp/view_bootarchive.sh
[14.10.2011 07:21:36] view_bootarchive.sh v1.0.0 started on Fri Oct 14 07:21:36 MEST 2011
[14.10.2011 07:21:36] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
[14.10.2011 07:21:36] Using the log file "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:21:36] Using the boot archive "/platform/sun4v/boot_archive" ...
[14.10.2011 07:21:36] The boot_archive is already mounted:
[14.10.2011 07:21:36] /tmp/boot_archive..16785 on /dev/lofi/1 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=24c0001 on Fri Oct 14 07:19:09 2011
[14.10.2011 07:21:36] The log file used was "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:21:36] view_bootarchive.sh v1.0.0 ended on Fri Oct 14 07:21:36 MEST 2011.
[14.10.2011 07:21:36] The RC is 0.

[Fri Oct 14 07:21:36 root@rtdev02 ~]
#  /var/tmp/view_bootarchive.sh status
[14.10.2011 07:21:39] view_bootarchive.sh v1.0.0 started on Fri Oct 14 07:21:39 MEST 2011
[14.10.2011 07:21:39] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
[14.10.2011 07:21:39] Using the log file "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:21:39] The boot archive "/platform/sun4v/boot_archive" is already mounted on "/tmp/boot_archive..16785"
[14.10.2011 07:21:39] The log file used was "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:21:39] view_bootarchive.sh v1.0.0 ended on Fri Oct 14 07:21:39 MEST 2011.
[14.10.2011 07:21:39] The RC is 0.
[Fri Oct 14 07:21:39 root@rtdev02 ~]
# ls "/tmp/boot_archive..16785"
etc         kernel      lost+found  platform
[Fri Oct 14 07:21:46 root@rtdev02 ~]
# ls -R "/tmp/boot_archive..16785"
/tmp/boot_archive..16785:
etc         kernel      lost+found  platform

/tmp/boot_archive..16785/etc:
dacf.conf

/tmp/boot_archive..16785/kernel:
crypto  dacf    drv     dtrace  exec    fs      ipp     kmdb    mac     misc    sched   strmod  sys

/tmp/boot_archive..16785/kernel/crypto:
sparcv9
.....


back to top

How to use view_bootarchive.sh to change files in the failsafe image


view_bootarchive.sh  can also be used to view the files in the failsafe image or a wanboot image. And with a little manual tasks it can also be used to change files these files (but only if the images are formated with the UFS filesystem!):


# first mount the failsafe image
#

[Fri Oct 14 07:21:55 root@rtdev02 ~]
#  /var/tmp/view_bootarchive.sh status /platform/sun4v/failsafe
[14.10.2011 07:23:23] view_bootarchive.sh v1.0.0 started on Fri Oct 14 07:23:23 MEST 2011
[14.10.2011 07:23:23] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
[14.10.2011 07:23:23] Using the log file "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:23:23] The boot archive "/platform/sun4v/failsafe" is currently not in use by this script.
[14.10.2011 07:23:23] The log file used was "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:23:23] view_bootarchive.sh v1.0.0 ended on Fri Oct 14 07:23:23 MEST 2011.
[14.10.2011 07:23:23] The RC is 200.


[Fri Oct 14 07:23:23 root@rtdev02 ~]
#  /var/tmp/view_bootarchive.sh mount /platform/sun4v/failsafe
[14.10.2011 07:23:44] view_bootarchive.sh v1.0.0 started on Fri Oct 14 07:23:44 MEST 2011
[14.10.2011 07:23:44] No config file ("view_bootarchive.conf") found (use -C to create a default config file)
[14.10.2011 07:23:44] Using the log file "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:23:44] Using the boot archive "/platform/sun4v/failsafe" ...
[14.10.2011 07:23:44] Copying "/platform/sun4v/failsafe" to "/tmp/_platform_sun4v_failsafe.uncompressed" ...
[14.10.2011 07:23:58] The boot_archive is mounted readwrite (ufs)]:
/tmp/boot_archive..17116 on /dev/lofi/2 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=24c0002 on Fri Oct 14 07:23:56 2011
[14.10.2011 07:23:58] The log file used was "/var/tmp/view_bootarchive.LOG"
[14.10.2011 07:23:58] view_bootarchive.sh v1.0.0 ended on Fri Oct 14 07:23:58 MEST 2011.
[14.10.2011 07:23:58] The RC is 0
.

# Make sure that filesystem type for the image is UFS:  The boot_archive is mounted readwrite (ufs)
#



# Next change the files in the mounted boot archive
#


[Fri Oct 14 07:26:45 root@rtdev02 ~]
# ls /tmp/boot_archive..17116
a            boot         dev          etc          lib          opt          proc         sbin         tmp          var
bin          cdrom        devices      kernel       mnt          platform     reconfigure  system       usr
[Fri Oct 14 07:26:45 root@rtdev02 ~]

#


# when finished - umount the boot archive manually
#
[Fri Oct 14 07:28:59 root@rtdev02 ~]
# umount /tmp/boot_archive..17116




# and copy the changed boot archive
#
[Fri Oct 14 07:29:40 root@rtdev02 ~]
# cp /tmp/_platform_sun4v_failsafe.uncompressed /platform/sun4v/new_failsafe



# to boot into the new failsafe boot archive use
#
[Fri Oct 14 07:39:40 root@rtdev02 ~]
reboot -- " -F new_failsafe"



# Note that you should compress the used boot archive again using gzip or bzip2 if
# the source boot archive is also in compressed format (see the output of view_bootarchive.sh)
#
# Note further that you can NOT change boot archives with hsfs file format using this
# method.
#





Back to top

Internas


see the documentation for the script template used for this script: scriptt.sh




Back to top

Notes

Please see the source code of the script for additional information



Back to top

Download


Download view_bootarchive.sh


Back to top