Print this page




 333 get_zonepath_ds() {
 334         ZONEPATH_DS=`/usr/sbin/zfs list -H -t filesystem -o name,mountpoint | \
 335             /usr/bin/nawk -v zonepath=$1 '{
 336                 if ($2 == zonepath)
 337                         print $1
 338         }'`
 339 
 340         if [ -z "$ZONEPATH_DS" ]; then
 341                 fail_fatal "$f_no_ds"
 342         fi
 343 }
 344 
 345 #
 346 # Perform validation and cleanup in the zoneroot after unpacking the archive.
 347 #
 348 post_unpack()
 349 {
 350         #
 351         # Check if the image was created with a valid libc.so.1.
 352         #
 353         if [[ -f $ZONEROOT/lib/libc.so.1 ]]; then
 354                 hwcap=`moe -v -32 $ZONEROOT/lib/libc.so.1 2>&1`
 355                 if (( $? != 0 )); then
 356                         vlog "$f_hwcap_info" "$hwcap"
 357                         fail_fatal "$f_sanity_hwcap"
 358                 fi
 359         fi
 360 
 361         ( cd "$ZONEROOT" && \
 362             find . \( -type b -o -type c \) -exec rm -f "{}" \; )
 363 }
 364 
 365 #
 366 # Determine flar compression style from identification file.
 367 #
 368 get_compression()
 369 {
 370         typeset ident=$1
 371         typeset line=$(grep "^files_compressed_method=" $ident)
 372 
 373         print ${line##*=}
 374 }
 375 
 376 #
 377 # Determine flar archive style from identification file.
 378 #
 379 get_archiver()


1005 
1006                 vlog "$stage1 $insrc | zfs receive -F $DATASET"
1007                 ( $stage1 $insrc | /usr/sbin/zfs receive -F $DATASET )
1008                 unpack_result=$?
1009         fi
1010 
1011         # Clean up any fs mounts used during unpacking.
1012         umnt_fs
1013         rm -f $fstmpfile $fscpiofile $fspaxfile
1014 
1015         chmod 700 $zonepath
1016 
1017         (( $unpack_result != 0 )) && fatal "$f_unpack_failed"
1018 
1019         # Verify this is a valid image.
1020         sanity_check $ZONEROOT
1021 
1022         return 0
1023 }
1024 
1025 e_cannot_wrap="%s: error: wrapper file already exists"
1026 e_baddir="Invalid '%s' directory within the zone"
1027 e_badfile="Invalid '%s' file within the zone"
1028 e_path_abs="Pathname specified to -a '%s' must be absolute."
1029 e_not_found="%s: error: file or directory not found."
1030 e_install_abort="Installation aborted."
1031 e_not_readable="Cannot read directory '%s'"
1032 e_not_dir="Error: must be a directory"
1033 e_unknown_archive="Error: Unknown archive format. Must be a flash archive, a cpio archive (can also be gzipped or bzipped), a pax XUSTAR archive, or a level 0 ufsdump archive."
1034 e_absolute_archive="Error: archive contains absolute paths instead of relative paths."
1035 e_mismatch_archive="Error: the archive top-level directory (%s) does not match the zonepath (%s)."
1036 e_tmpfile="Unable to create temporary file"
1037 e_root_full="Zonepath root %s exists and contains data; remove or move aside prior to install."
1038 f_mkdir="Unable to create directory %s."
1039 f_chmod="Unable to chmod directory %s."
1040 f_chown="Unable to chown directory %s."
1041 f_hwcap_info="HWCAP: %s\n"
1042 f_sanity_hwcap="The image was created with an incompatible libc.so.1 hwcap lofs mount.\n"\





1043 "       The zone will not boot on this platform.  See the zone's\n"\
1044 "       documentation for the recommended way to create the archive."
1045 
1046 m_analyse_archive="Analysing the archive"
1047 
1048 not_readable="Cannot read file '%s'"
1049 not_flar="Input is not a flash archive"
1050 bad_flar="Flash archive is a corrupt"
1051 bad_zfs_flar="Flash archive contains a ZFS send stream.\n\tRecreate the flar using the -L option with cpio or pax."
1052 f_unpack_failed="Unpacking the archive failed"
1053 unknown_archiver="Archiver %s is not supported"
1054 cmd_not_exec="Required command '%s' not executable!"
1055 
1056 #
1057 # Exit values used by the script, as #defined in <sys/zone.h>
1058 #
1059 #       ZONE_SUBPROC_OK
1060 #       ===============
1061 #       Installation was successful
1062 #
1063 #       ZONE_SUBPROC_USAGE
1064 #       ==================
1065 #       Improper arguments were passed, so print a usage message before exiting
1066 #
1067 #       ZONE_SUBPROC_NOTCOMPLETE
1068 #       ========================
1069 #       Installation did not complete, but another installation attempt can be
1070 #       made without an uninstall
1071 #
1072 #       ZONE_SUBPROC_FATAL
1073 #       ==================
1074 #       Installation failed and an uninstall will be required before another


 333 get_zonepath_ds() {
 334         ZONEPATH_DS=`/usr/sbin/zfs list -H -t filesystem -o name,mountpoint | \
 335             /usr/bin/nawk -v zonepath=$1 '{
 336                 if ($2 == zonepath)
 337                         print $1
 338         }'`
 339 
 340         if [ -z "$ZONEPATH_DS" ]; then
 341                 fail_fatal "$f_no_ds"
 342         fi
 343 }
 344 
 345 #
 346 # Perform validation and cleanup in the zoneroot after unpacking the archive.
 347 #
 348 post_unpack()
 349 {
 350         #
 351         # Check if the image was created with a valid libc.so.1.
 352         #

 353         hwcap=`moe -v -32 $ZONEROOT/lib/libc.so.1 2>&1`
 354         if (( $? != 0 )); then
 355                 vlog "$f_hwcap_info" "$hwcap"
 356                 fail_fatal "$f_sanity_hwcap"
 357         fi

 358 
 359         ( cd "$ZONEROOT" && \
 360             find . \( -type b -o -type c \) -exec rm -f "{}" \; )
 361 }
 362 
 363 #
 364 # Determine flar compression style from identification file.
 365 #
 366 get_compression()
 367 {
 368         typeset ident=$1
 369         typeset line=$(grep "^files_compressed_method=" $ident)
 370 
 371         print ${line##*=}
 372 }
 373 
 374 #
 375 # Determine flar archive style from identification file.
 376 #
 377 get_archiver()


1003 
1004                 vlog "$stage1 $insrc | zfs receive -F $DATASET"
1005                 ( $stage1 $insrc | /usr/sbin/zfs receive -F $DATASET )
1006                 unpack_result=$?
1007         fi
1008 
1009         # Clean up any fs mounts used during unpacking.
1010         umnt_fs
1011         rm -f $fstmpfile $fscpiofile $fspaxfile
1012 
1013         chmod 700 $zonepath
1014 
1015         (( $unpack_result != 0 )) && fatal "$f_unpack_failed"
1016 
1017         # Verify this is a valid image.
1018         sanity_check $ZONEROOT
1019 
1020         return 0
1021 }
1022 
1023 # Setup i18n output
1024 TEXTDOMAIN="SUNW_OST_OSCMD"
1025 export TEXTDOMAIN
1026 
1027 e_cannot_wrap=$(gettext "%s: error: wrapper file already exists")
1028 e_baddir=$(gettext "Invalid '%s' directory within the zone")
1029 e_badfile=$(gettext "Invalid '%s' file within the zone")
1030 e_path_abs=$(gettext "Pathname specified to -a '%s' must be absolute.")
1031 e_not_found=$(gettext "%s: error: file or directory not found.")
1032 e_install_abort=$(gettext "Installation aborted.")
1033 e_not_readable=$(gettext "Cannot read directory '%s'")
1034 e_not_dir=$(gettext "Error: must be a directory")
1035 e_unknown_archive=$(gettext "Error: Unknown archive format. Must be a flash archive, a cpio archive (can also be gzipped or bzipped), a pax XUSTAR archive, or a level 0 ufsdump archive.")
1036 e_absolute_archive=$(gettext "Error: archive contains absolute paths instead of relative paths.")
1037 e_mismatch_archive=$(gettext "Error: the archive top-level directory (%s) does not match the zonepath (%s).")
1038 e_tmpfile=$(gettext "Unable to create temporary file")
1039 e_root_full=$(gettext "Zonepath root %s exists and contains data; remove or move aside prior to install.")
1040 f_mkdir=$(gettext "Unable to create directory %s.")
1041 f_chmod=$(gettext "Unable to chmod directory %s.")
1042 f_chown=$(gettext "Unable to chown directory %s.")
1043 f_hwcap_info=$(gettext "HWCAP: %s\n")
1044 f_sanity_hwcap=$(gettext \
1045 "The image was created with an incompatible libc.so.1 hwcap lofs mount.\n"\
1046 "       The zone will not boot on this platform.  See the zone's\n"\
1047 "       documentation for the recommended way to create the archive.")
1048 
1049 m_analyse_archive=$(gettext "Analysing the archive")
1050 
1051 not_readable=$(gettext "Cannot read file '%s'")
1052 not_flar=$(gettext "Input is not a flash archive")
1053 bad_flar=$(gettext "Flash archive is a corrupt")
1054 bad_zfs_flar=$(gettext "Flash archive contains a ZFS send stream.\n\tRecreate the flar using the -L option with cpio or pax.")
1055 f_unpack_failed=$(gettext "Unpacking the archive failed")
1056 unknown_archiver=$(gettext "Archiver %s is not supported")
1057 cmd_not_exec=$(gettext "Required command '%s' not executable!")
1058 
1059 #
1060 # Exit values used by the script, as #defined in <sys/zone.h>
1061 #
1062 #       ZONE_SUBPROC_OK
1063 #       ===============
1064 #       Installation was successful
1065 #
1066 #       ZONE_SUBPROC_USAGE
1067 #       ==================
1068 #       Improper arguments were passed, so print a usage message before exiting
1069 #
1070 #       ZONE_SUBPROC_NOTCOMPLETE
1071 #       ========================
1072 #       Installation did not complete, but another installation attempt can be
1073 #       made without an uninstall
1074 #
1075 #       ZONE_SUBPROC_FATAL
1076 #       ==================
1077 #       Installation failed and an uninstall will be required before another