<commit_before>#!/bin/bash
#
# Copyright (c) 2011, Joyent Inc., All rights reserved.
#


ERRORLOG="/tmp/destroy_zone-$1.$$"
exec 5>${ERRORLOG}
BASH_XTRACEFD=5
export PS4='+(${BASH_SOURCE}:${LINENO}): ${SECONDS} ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'

set -o errexit
set -o xtrace

zone=$1
if [[ -z ${zone} ]]; then
    echo "Usage: $0 <zone>"
    exit 1
fi

echo -n "Destroying '${zone}':"
zoneadm -z ${zone} halt || /bin/true
echo -n " halt"
zoneadm -z ${zone} uninstall -F || /bin/true
echo -n ", uninstall"
zonecfg -z ${zone} delete -F
echo -n ", delete "

echo " ... DONE!"

exit 0<commit_msg>HEAD-249 destroy_zone needs to wait until zone has shutdown before uninstalling<commit_after>#!/bin/bash
#
# Copyright (c) 2011, Joyent Inc., All rights reserved.
#


ERRORLOG="/tmp/destroy_zone-$1.$$"
exec 5>${ERRORLOG}
BASH_XTRACEFD=5
export PS4='+(${BASH_SOURCE}:${LINENO}): ${SECONDS} ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'

set -o errexit
set -o xtrace

zone=$1
if [[ -z ${zone} ]]; then
    echo "Usage: $0 <zone>"
    exit 1
fi

echo -n "Destroying '${zone}':"
zoneadm -z ${zone} halt || /bin/true

state=`zoneadm -z ${zone} list -p | cut -d: -f3`
while [ "$state" != "installed" ]; do
	sleep 5
	state=`zoneadm -z ${zone} list -p | cut -d: -f3`
	if [ "$state" != "installed" ]; then
		echo
		echo "Waiting for zone to shutdown, state: $state"

		for i in `mount -p | nawk -v zname=${zone} '{
			if (index($3, zname) != 0)
				print $3
		}'`; do
			echo "check file system: $i"
			fuser $i
		done
	fi
done

echo -n " halt"
zoneadm -z ${zone} uninstall -F || /bin/true
echo -n ", uninstall"
zonecfg -z ${zone} delete -F
echo -n ", delete "

echo " ... DONE!"

exit 0
{'fraction_non_alphanumeric': 0.20336943441636582, 'fraction_numerical': 0.022262334536702767, 'mean_word_length': 3.4945945945945946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7114396', 'n_tokens_mistral': 715, 'n_tokens_neox': 663, 'n_words': 205}