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
493
494 #
|
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 next
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 next
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
493
494 #
|