Print this page
XXX Remove nawk(1)


  84 # We need to do this even if unconfiguring the zone so sys-unconfig works
  85 # correctly.
  86 #
  87 fix_net()
  88 {
  89         [[ "$STACK_TYPE" == "shared" ]] && return
  90 
  91         NETIF_CNT=$(/usr/bin/ls $ZONEROOT/etc/hostname.* 2>/dev/null | \
  92             /usr/bin/wc -l)
  93         if (( $NETIF_CNT != 1 )); then
  94                 vlog "$v_nonetfix"
  95                 return
  96         fi
  97 
  98         NET=$(LC_ALL=C /usr/sbin/zonecfg -z $ZONENAME info net)
  99         if (( $? != 0 )); then
 100                 error "$e_badinfo" "net"
 101                 return
 102         fi
 103 
 104         NETIF=$(echo $NET | /usr/bin/nawk '{
 105                 for (i = 1; i < NF; i++) {
 106                         if ($i == "physical:") {
 107                                 if (length(net) == 0) {
 108                                         i++
 109                                         net = $i
 110                                 } else {
 111                                         multiple=1
 112                                 }
 113                         }
 114                 }
 115         }
 116         END {   if (!multiple)
 117                         print net
 118         }')
 119 
 120         if [[ -z "$NETIF" ]]; then
 121                 vlog "$v_nonetfix"
 122                 return
 123         fi
 124 


 133 # Note that we disable the various instances of the svc:/network/shares/group
 134 # SMF service in the fix_smf function. 
 135 #
 136 fix_nfs()
 137 {
 138         zonedfs=$ZONEROOT/etc/dfs
 139 
 140         [[ ! -d $zonedfs ]] && return
 141 
 142         if [[ -h $zonedfs/dfstab || ! -f $zonedfs/dfstab ]]; then
 143                 error "$e_badfile" "/etc/dfs/dfstab"
 144                 return
 145         fi
 146 
 147         tmpfile=$(mktemp -t)
 148         if [[ $? == 1 || -z "$tmpfile" ]]; then
 149                 error "$e_tmpfile"
 150                 return
 151         fi
 152 
 153         /usr/bin/nawk '{
 154                 if (substr($1, 0, 1) == "#") {
 155                         print $0
 156                 } else {
 157                         print "#", $0
 158                         modified=1
 159                 }
 160         }
 161         END {
 162                 if (modified == 1) {
 163                         printf("# Modified by p2v ")
 164                         system("/usr/bin/date")
 165                         exit 0
 166                 }
 167                 exit 1
 168         }' $zonedfs/dfstab >>$tmpfile
 169 
 170         if (( $? == 0 )); then
 171                 if [[ ! -f $zonedfs/dfstab.pre_p2v ]]; then
 172                         safe_copy $zonedfs/dfstab $zonedfs/dfstab.pre_p2v
 173                 fi


 181 }
 182 
 183 #
 184 # Comment out most of the old mounts since they are either unneeded or
 185 # likely incorrect within a zone.  Specific mounts can be manually 
 186 # reenabled if the corresponding device is added to the zone.
 187 #
 188 fix_vfstab()
 189 {
 190         if [[ -h $ZONEROOT/etc/vfstab || ! -f $ZONEROOT/etc/vfstab ]]; then
 191                 error "$e_badfile" "/etc/vfstab"
 192                 return
 193         fi
 194 
 195         tmpfile=$(mktemp -t)
 196         if [[ $? == 1 || -z "$tmpfile" ]]; then
 197                 error "$e_tmpfile"
 198                 return
 199         fi
 200 
 201         /usr/bin/nawk '{
 202                 if (substr($1, 0, 1) == "#") {
 203                         print $0
 204                 } else if ($1 == "fd" || $1 == "/proc" || $1 == "swap" ||
 205                     $1 == "ctfs" || $1 == "objfs" || $1 == "sharefs" ||
 206                     $4 == "nfs" || $4 == "lofs") {
 207                         print $0
 208                 } else {
 209                         print "#", $0
 210                         modified=1
 211                 }
 212         }
 213         END {
 214                 if (modified == 1) {
 215                         printf("# Modified by p2v ")
 216                         system("/usr/bin/date")
 217                         exit 0
 218                 }
 219                 exit 1
 220         }' $ZONEROOT/etc/vfstab >>$tmpfile
 221 


 244         # pkgs then use 'svccfg inventory' to get the names of the svcs
 245         # delivered by those manifests.  The svc names are saved into a
 246         # temporary file.
 247         #
 248 
 249         SMFTMPFILE=$(mktemp -t smf.XXXXXX)
 250         if [[ $? == 1 || -z "$SMFTMPFILE" ]]; then
 251                 error "$e_tmpfile"
 252                 return
 253         fi
 254 
 255         for i in $ZONEROOT/var/sadm/pkg/*
 256         do
 257                 pkg=$(/usr/bin/basename $i)
 258                 [[ ! -f $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap ]] \
 259                     && continue
 260 
 261                 /usr/bin/egrep -s "SUNW_PKG_HOLLOW=true" \
 262                     $ZONEROOT/var/sadm/pkg/$pkg/pkginfo || continue
 263 
 264                 for j in $(/usr/bin/nawk '{if ($2 == "f" &&
 265                     substr($4, 1, 17) == "var/svc/manifest/") print $4}' \
 266                     $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap)
 267                 do
 268                         svcs=$(SVCCFG_NOVALIDATE=1 \
 269                             SVCCFG_REPOSITORY=$ZONEROOT/etc/svc/repository.db \
 270                             /usr/sbin/svccfg inventory $ZONEROOT/$j)
 271                         for k in $svcs
 272                         do
 273                                 echo $k /$j >> $SMFTMPFILE
 274                         done
 275                 done
 276         done
 277 }
 278 
 279 #
 280 # Delete or disable SMF services.
 281 # Zone is booted to milestone=none when this function is called.
 282 # Use the SMF data collected by fix_smf_pre_uoa() to delete the services.
 283 #
 284 fix_smf()


 309                 /usr/bin/rm -f $SMFTMPFILE
 310                 return 1
 311         fi
 312 
 313         vlog "$v_rmhollowsvcs"
 314         while read fmri mfst
 315         do
 316                 # Delete the svc.
 317                 vlog "$v_delsvc" "$fmri"
 318                 echo "/usr/sbin/svccfg delete -f $fmri"
 319                 echo "/usr/sbin/svccfg delhash -d $mfst"
 320                 echo "rm -f $mfst"
 321         done < $SMFTMPFILE > $ZONEROOT/tmp/smf_rm
 322 
 323         /usr/sbin/zlogin -S $ZONENAME /bin/sh /tmp/smf_rm >/dev/null 2>&1
 324 
 325         /usr/bin/rm -f $SMFTMPFILE
 326 
 327         # Get a list of the svcs that now exist in the zone.
 328         LANG=C /usr/sbin/zlogin -S $ZONENAME /usr/bin/svcs -aH | \
 329             /usr/bin/nawk '{print $3}' >>$insttmpfile
 330 
 331         [[ -n $LOGFILE ]] && \
 332             printf "[$(date)] ${MSG_PREFIX}${v_svcsinzone}\n" >&2
 333         [[ -n $LOGFILE ]] && cat $insttmpfile >&2
 334 
 335         #
 336         # Import ip-interface-management service in S10C, network
 337         # loopback service requires ipmgmtd in exclusive stack zones.
 338         #
 339         /usr/sbin/zlogin -S $ZONENAME /usr/sbin/svccfg import \
 340             $ZONEROOT/var/svc/manifest/network/network-ipmgmt.xml
 341 
 342         #
 343         # Fix network services if shared stack.
 344         #
 345         if [[ "$STACK_TYPE" == "shared" ]]; then
 346                 vlog "$v_fixnetsvcs"
 347 
 348                 NETPHYSDEF="svc:/network/physical:default"
 349                 NETPHYSNWAM="svc:/network/physical:nwam"


 439 
 440 #
 441 # Zoneadmd writes a one-line index file into the zone when the zone boots,
 442 # so any information about installed zones from the original system will
 443 # be lost at that time.  Here we'll warn the sysadmin about any pre-existing
 444 # zones that they might want to clean up by hand, but we'll leave the zonepaths
 445 # in place in case they're on shared storage and will be migrated to
 446 # a new host.
 447 #
 448 warn_zones()
 449 {
 450         zoneconfig=$ZONEROOT/etc/zones
 451 
 452         [[ ! -d $zoneconfig ]] && return
 453 
 454         if [[ -h $zoneconfig/index || ! -f $zoneconfig/index ]]; then
 455                 error "$e_badfile" "/etc/zones/index"
 456                 return
 457         fi
 458 
 459         NGZ=$(/usr/bin/nawk -F: '{
 460                 if (substr($1, 0, 1) == "#" || $1 == "global")
 461                         continue
 462 
 463                 if ($2 == "installed")
 464                         printf("%s ", $1)
 465         }' $zoneconfig/index)
 466 
 467         # Return if there are no installed zones to warn about.
 468         [[ -z "$NGZ" ]] && return
 469 
 470         log "$v_rmzones" "$NGZ"
 471 
 472         NGZP=$(/usr/bin/nawk -F: '{
 473                 if (substr($1, 0, 1) == "#" || $1 == "global")
 474                         continue
 475 
 476                 if ($2 == "installed")
 477                         printf("%s ", $3)
 478         }' $zoneconfig/index)
 479 
 480         log "$v_rmzonepaths"
 481 
 482         for i in $NGZP
 483         do
 484                 log "    %s" "$i"
 485         done
 486 }
 487 
 488 #
 489 # ^C Should cleanup; if the zone is running, it should try to halt it.
 490 #
 491 zone_is_running=0
 492 trap trap_cleanup INT


 565 safe_opt_dir /etc/lu
 566 safe_opt_dir /etc/zones
 567 
 568 mk_zone_dirs
 569 
 570 # Now do the work to update the zone.
 571 
 572 # Check for zones inside of image.
 573 warn_zones
 574 fix_smf_pre_uoa
 575 
 576 log "$v_adjust"
 577 
 578 #
 579 # Any errors in these functions are not considered fatal.  The zone can be
 580 # be fixed up manually afterwards and it may need some additional manual
 581 # cleanup in any case.
 582 #
 583 
 584 STACK_TYPE=$(/usr/sbin/zoneadm -z $ZONENAME list -p | \
 585     /usr/bin/nawk -F: '{print $7}')
 586 if (( $? != 0 )); then
 587         error "$e_badinfo" "stacktype"
 588 fi
 589 vlog "$v_stacktype" "$STACK_TYPE"
 590 
 591 fix_lu
 592 fix_net
 593 fix_nfs
 594 fix_vfstab
 595 
 596 vlog "$v_booting"
 597 
 598 #
 599 # Boot the zone so that we can do all of the SMF updates needed on the zone's
 600 # repository.
 601 #
 602 
 603 zone_is_running=1
 604 
 605 /usr/sbin/zoneadm -z $ZONENAME boot -f -- -m milestone=none


 608         /usr/bin/rm -f $SMFTMPFILE
 609         fatal "$e_exitfail"
 610 fi
 611 
 612 #
 613 # Remove all files and directories installed by hollow packages.  Such files
 614 # and directories shouldn't exist inside zones.
 615 #
 616 hollow_pkgs=$(mktemp -t .hollow.pkgs.XXXXXX)
 617 hollow_file_list=$(mktemp $ZONEROOT/.hollow.pkgs.files.XXXXXX)
 618 hollow_dir_list=$(mktemp $ZONEROOT/.hollow.pkgs.dirs.XXXXXX)
 619 [ -f "$hollow_pkgs" -a -f "$hollow_file_list" -a -f "$hollow_dir_list" ] || {
 620         error "$e_tmpfile"
 621         rm -f $hollow_pkgs $hollow_file_list $hollow_dir_list
 622         fatal "$e_exitfail"
 623 }
 624 for pkg_name in $ZONEROOT/var/sadm/pkg/*; do
 625         grep 'SUNW_PKG_HOLLOW=true' $pkg_name/pkginfo >/dev/null 2>&1 && \
 626             basename $pkg_name >>$hollow_pkgs
 627 done
 628 /usr/bin/nawk -v hollowpkgs=$hollow_pkgs -v filelist=$hollow_file_list \
 629     -v dirlist=$hollow_dir_list '
 630         BEGIN {
 631                 while (getline p <hollowpkgs > 0)
 632                         pkgs[p] = 1;
 633                 close(hollowpkgs);
 634         }
 635         {
 636                 # fld is the field where the pkg names begin.
 637                 # nm is the file/dir entry name.
 638                 if ($2 == "f") {
 639                         fld=10;
 640                         nm=$1;
 641                 } else if ($2 == "d") {
 642                         fld=7;
 643                         nm=$1;
 644                 } else if ($2 == "s" || $2 == "l") {
 645                         fld=4;
 646                         split($1, a, "=");
 647                         nm=a[1];
 648                 } else {




  84 # We need to do this even if unconfiguring the zone so sys-unconfig works
  85 # correctly.
  86 #
  87 fix_net()
  88 {
  89         [[ "$STACK_TYPE" == "shared" ]] && return
  90 
  91         NETIF_CNT=$(/usr/bin/ls $ZONEROOT/etc/hostname.* 2>/dev/null | \
  92             /usr/bin/wc -l)
  93         if (( $NETIF_CNT != 1 )); then
  94                 vlog "$v_nonetfix"
  95                 return
  96         fi
  97 
  98         NET=$(LC_ALL=C /usr/sbin/zonecfg -z $ZONENAME info net)
  99         if (( $? != 0 )); then
 100                 error "$e_badinfo" "net"
 101                 return
 102         fi
 103 
 104         NETIF=$(echo $NET | /usr/xpg4/bin/awk '{
 105                 for (i = 1; i < NF; i++) {
 106                         if ($i == "physical:") {
 107                                 if (length(net) == 0) {
 108                                         i++
 109                                         net = $i
 110                                 } else {
 111                                         multiple=1
 112                                 }
 113                         }
 114                 }
 115         }
 116         END {   if (!multiple)
 117                         print net
 118         }')
 119 
 120         if [[ -z "$NETIF" ]]; then
 121                 vlog "$v_nonetfix"
 122                 return
 123         fi
 124 


 133 # Note that we disable the various instances of the svc:/network/shares/group
 134 # SMF service in the fix_smf function. 
 135 #
 136 fix_nfs()
 137 {
 138         zonedfs=$ZONEROOT/etc/dfs
 139 
 140         [[ ! -d $zonedfs ]] && return
 141 
 142         if [[ -h $zonedfs/dfstab || ! -f $zonedfs/dfstab ]]; then
 143                 error "$e_badfile" "/etc/dfs/dfstab"
 144                 return
 145         fi
 146 
 147         tmpfile=$(mktemp -t)
 148         if [[ $? == 1 || -z "$tmpfile" ]]; then
 149                 error "$e_tmpfile"
 150                 return
 151         fi
 152 
 153         /usr/xpg4/bin/awk '{
 154                 if (substr($1, 0, 1) == "#") {
 155                         print $0
 156                 } else {
 157                         print "#", $0
 158                         modified=1
 159                 }
 160         }
 161         END {
 162                 if (modified == 1) {
 163                         printf("# Modified by p2v ")
 164                         system("/usr/bin/date")
 165                         exit 0
 166                 }
 167                 exit 1
 168         }' $zonedfs/dfstab >>$tmpfile
 169 
 170         if (( $? == 0 )); then
 171                 if [[ ! -f $zonedfs/dfstab.pre_p2v ]]; then
 172                         safe_copy $zonedfs/dfstab $zonedfs/dfstab.pre_p2v
 173                 fi


 181 }
 182 
 183 #
 184 # Comment out most of the old mounts since they are either unneeded or
 185 # likely incorrect within a zone.  Specific mounts can be manually 
 186 # reenabled if the corresponding device is added to the zone.
 187 #
 188 fix_vfstab()
 189 {
 190         if [[ -h $ZONEROOT/etc/vfstab || ! -f $ZONEROOT/etc/vfstab ]]; then
 191                 error "$e_badfile" "/etc/vfstab"
 192                 return
 193         fi
 194 
 195         tmpfile=$(mktemp -t)
 196         if [[ $? == 1 || -z "$tmpfile" ]]; then
 197                 error "$e_tmpfile"
 198                 return
 199         fi
 200 
 201         /usr/xpg4/bin/awk '{
 202                 if (substr($1, 0, 1) == "#") {
 203                         print $0
 204                 } else if ($1 == "fd" || $1 == "/proc" || $1 == "swap" ||
 205                     $1 == "ctfs" || $1 == "objfs" || $1 == "sharefs" ||
 206                     $4 == "nfs" || $4 == "lofs") {
 207                         print $0
 208                 } else {
 209                         print "#", $0
 210                         modified=1
 211                 }
 212         }
 213         END {
 214                 if (modified == 1) {
 215                         printf("# Modified by p2v ")
 216                         system("/usr/bin/date")
 217                         exit 0
 218                 }
 219                 exit 1
 220         }' $ZONEROOT/etc/vfstab >>$tmpfile
 221 


 244         # pkgs then use 'svccfg inventory' to get the names of the svcs
 245         # delivered by those manifests.  The svc names are saved into a
 246         # temporary file.
 247         #
 248 
 249         SMFTMPFILE=$(mktemp -t smf.XXXXXX)
 250         if [[ $? == 1 || -z "$SMFTMPFILE" ]]; then
 251                 error "$e_tmpfile"
 252                 return
 253         fi
 254 
 255         for i in $ZONEROOT/var/sadm/pkg/*
 256         do
 257                 pkg=$(/usr/bin/basename $i)
 258                 [[ ! -f $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap ]] \
 259                     && continue
 260 
 261                 /usr/bin/egrep -s "SUNW_PKG_HOLLOW=true" \
 262                     $ZONEROOT/var/sadm/pkg/$pkg/pkginfo || continue
 263 
 264                 for j in $(/usr/xpg4/bin/awk '{if ($2 == "f" &&
 265                     substr($4, 1, 17) == "var/svc/manifest/") print $4}' \
 266                     $ZONEROOT/var/sadm/pkg/$pkg/save/pspool/$pkg/pkgmap)
 267                 do
 268                         svcs=$(SVCCFG_NOVALIDATE=1 \
 269                             SVCCFG_REPOSITORY=$ZONEROOT/etc/svc/repository.db \
 270                             /usr/sbin/svccfg inventory $ZONEROOT/$j)
 271                         for k in $svcs
 272                         do
 273                                 echo $k /$j >> $SMFTMPFILE
 274                         done
 275                 done
 276         done
 277 }
 278 
 279 #
 280 # Delete or disable SMF services.
 281 # Zone is booted to milestone=none when this function is called.
 282 # Use the SMF data collected by fix_smf_pre_uoa() to delete the services.
 283 #
 284 fix_smf()


 309                 /usr/bin/rm -f $SMFTMPFILE
 310                 return 1
 311         fi
 312 
 313         vlog "$v_rmhollowsvcs"
 314         while read fmri mfst
 315         do
 316                 # Delete the svc.
 317                 vlog "$v_delsvc" "$fmri"
 318                 echo "/usr/sbin/svccfg delete -f $fmri"
 319                 echo "/usr/sbin/svccfg delhash -d $mfst"
 320                 echo "rm -f $mfst"
 321         done < $SMFTMPFILE > $ZONEROOT/tmp/smf_rm
 322 
 323         /usr/sbin/zlogin -S $ZONENAME /bin/sh /tmp/smf_rm >/dev/null 2>&1
 324 
 325         /usr/bin/rm -f $SMFTMPFILE
 326 
 327         # Get a list of the svcs that now exist in the zone.
 328         LANG=C /usr/sbin/zlogin -S $ZONENAME /usr/bin/svcs -aH | \
 329             /usr/xpg4/bin/awk '{print $3}' >>$insttmpfile
 330 
 331         [[ -n $LOGFILE ]] && \
 332             printf "[$(date)] ${MSG_PREFIX}${v_svcsinzone}\n" >&2
 333         [[ -n $LOGFILE ]] && cat $insttmpfile >&2
 334 
 335         #
 336         # Import ip-interface-management service in S10C, network
 337         # loopback service requires ipmgmtd in exclusive stack zones.
 338         #
 339         /usr/sbin/zlogin -S $ZONENAME /usr/sbin/svccfg import \
 340             $ZONEROOT/var/svc/manifest/network/network-ipmgmt.xml
 341 
 342         #
 343         # Fix network services if shared stack.
 344         #
 345         if [[ "$STACK_TYPE" == "shared" ]]; then
 346                 vlog "$v_fixnetsvcs"
 347 
 348                 NETPHYSDEF="svc:/network/physical:default"
 349                 NETPHYSNWAM="svc:/network/physical:nwam"


 439 
 440 #
 441 # Zoneadmd writes a one-line index file into the zone when the zone boots,
 442 # so any information about installed zones from the original system will
 443 # be lost at that time.  Here we'll warn the sysadmin about any pre-existing
 444 # zones that they might want to clean up by hand, but we'll leave the zonepaths
 445 # in place in case they're on shared storage and will be migrated to
 446 # a new host.
 447 #
 448 warn_zones()
 449 {
 450         zoneconfig=$ZONEROOT/etc/zones
 451 
 452         [[ ! -d $zoneconfig ]] && return
 453 
 454         if [[ -h $zoneconfig/index || ! -f $zoneconfig/index ]]; then
 455                 error "$e_badfile" "/etc/zones/index"
 456                 return
 457         fi
 458 
 459         NGZ=$(/usr/xpg4/bin/awk -F: '{
 460                 if (substr($1, 0, 1) == "#" || $1 == "global")
 461                         continue
 462 
 463                 if ($2 == "installed")
 464                         printf("%s ", $1)
 465         }' $zoneconfig/index)
 466 
 467         # Return if there are no installed zones to warn about.
 468         [[ -z "$NGZ" ]] && return
 469 
 470         log "$v_rmzones" "$NGZ"
 471 
 472         NGZP=$(/usr/xpg4/bin/awk -F: '{
 473                 if (substr($1, 0, 1) == "#" || $1 == "global")
 474                         continue
 475 
 476                 if ($2 == "installed")
 477                         printf("%s ", $3)
 478         }' $zoneconfig/index)
 479 
 480         log "$v_rmzonepaths"
 481 
 482         for i in $NGZP
 483         do
 484                 log "    %s" "$i"
 485         done
 486 }
 487 
 488 #
 489 # ^C Should cleanup; if the zone is running, it should try to halt it.
 490 #
 491 zone_is_running=0
 492 trap trap_cleanup INT


 565 safe_opt_dir /etc/lu
 566 safe_opt_dir /etc/zones
 567 
 568 mk_zone_dirs
 569 
 570 # Now do the work to update the zone.
 571 
 572 # Check for zones inside of image.
 573 warn_zones
 574 fix_smf_pre_uoa
 575 
 576 log "$v_adjust"
 577 
 578 #
 579 # Any errors in these functions are not considered fatal.  The zone can be
 580 # be fixed up manually afterwards and it may need some additional manual
 581 # cleanup in any case.
 582 #
 583 
 584 STACK_TYPE=$(/usr/sbin/zoneadm -z $ZONENAME list -p | \
 585     /usr/xpg4/bin/awk -F: '{print $7}')
 586 if (( $? != 0 )); then
 587         error "$e_badinfo" "stacktype"
 588 fi
 589 vlog "$v_stacktype" "$STACK_TYPE"
 590 
 591 fix_lu
 592 fix_net
 593 fix_nfs
 594 fix_vfstab
 595 
 596 vlog "$v_booting"
 597 
 598 #
 599 # Boot the zone so that we can do all of the SMF updates needed on the zone's
 600 # repository.
 601 #
 602 
 603 zone_is_running=1
 604 
 605 /usr/sbin/zoneadm -z $ZONENAME boot -f -- -m milestone=none


 608         /usr/bin/rm -f $SMFTMPFILE
 609         fatal "$e_exitfail"
 610 fi
 611 
 612 #
 613 # Remove all files and directories installed by hollow packages.  Such files
 614 # and directories shouldn't exist inside zones.
 615 #
 616 hollow_pkgs=$(mktemp -t .hollow.pkgs.XXXXXX)
 617 hollow_file_list=$(mktemp $ZONEROOT/.hollow.pkgs.files.XXXXXX)
 618 hollow_dir_list=$(mktemp $ZONEROOT/.hollow.pkgs.dirs.XXXXXX)
 619 [ -f "$hollow_pkgs" -a -f "$hollow_file_list" -a -f "$hollow_dir_list" ] || {
 620         error "$e_tmpfile"
 621         rm -f $hollow_pkgs $hollow_file_list $hollow_dir_list
 622         fatal "$e_exitfail"
 623 }
 624 for pkg_name in $ZONEROOT/var/sadm/pkg/*; do
 625         grep 'SUNW_PKG_HOLLOW=true' $pkg_name/pkginfo >/dev/null 2>&1 && \
 626             basename $pkg_name >>$hollow_pkgs
 627 done
 628 /usr/xpg4/bin/awk -v hollowpkgs=$hollow_pkgs -v filelist=$hollow_file_list \
 629     -v dirlist=$hollow_dir_list '
 630         BEGIN {
 631                 while (getline p <hollowpkgs > 0)
 632                         pkgs[p] = 1;
 633                 close(hollowpkgs);
 634         }
 635         {
 636                 # fld is the field where the pkg names begin.
 637                 # nm is the file/dir entry name.
 638                 if ($2 == "f") {
 639                         fld=10;
 640                         nm=$1;
 641                 } else if ($2 == "d") {
 642                         fld=7;
 643                         nm=$1;
 644                 } else if ($2 == "s" || $2 == "l") {
 645                         fld=4;
 646                         split($1, a, "=");
 647                         nm=a[1];
 648                 } else {