<commit_before>#!/usr/bin/bash
#
# Copyright (c) 2010 Joyent Inc., All rights reserved.
#
# Exit codes:
#
# 0 - success
# 1 - error
# 2 - rebooting (don't bother doing anything)
#

DEBUG="true"

. /lib/svc/share/joyent_include.sh


# All the files come from USB, so we need that mounted.
if ! mount_usb; then
    # This is to move us to the next line past the login: prompt
    echo "" >>/dev/console
    echo "FATAL: Cannot find USB key... ${mount_usb_msg}" >>/dev/console
    exit 1;
fi

admin_nic=`/usr/bin/bootparams | grep "^admin_nic=" | cut -f2 -d'=' | sed 's/0\([0-9a-f]\)/\1/g'`

# check if we've imported a zpool
POOLS=`zpool list`

if [[ ${POOLS} == "no pools available" ]]; then

    # This is to move us to the next line past the login: prompt
    echo "" >>/dev/console

    /mnt/scripts/joysetup.sh || exit 1

    echo -n "Importing zone template dataset... " >>/dev/console
    bzcat /mnt/bare.zfs.bz2 | zfs recv -e zones || exit 1;
    echo "done." >>/dev/console
    reboot
    exit 2
fi

# Create a link to the config as /etc/headnode.config, so we can have a
# consistent location for it when we want to be able to umount the USB later
ln -s /mnt/config /etc/headnode.config

# Now the infrastructure zones

NEXTVNIC=`dladm show-vnic | grep -c vnic`

ZONES=`zoneadm list -i | grep -v "^global$"`

LATESTTEMPLATE=''
for template in `ls /zones | grep bare`; do
    LATESTTEMPLATE=${template}
done

USBZONES=`ls /mnt/zones`
ALLZONES=`for x in ${ZONES} ${USBZONES}; do echo ${x}; done | sort -r | uniq | xargs`
CREATEDZONES=

for zone in $ALLZONES; do<commit_msg>Need to create symlink earlier so other script can use it.<commit_after>#!/usr/bin/bash
#
# Copyright (c) 2010 Joyent Inc., All rights reserved.
#
# Exit codes:
#
# 0 - success
# 1 - error
# 2 - rebooting (don't bother doing anything)
#

DEBUG="true"

. /lib/svc/share/joyent_include.sh


# All the files come from USB, so we need that mounted.
if ! mount_usb; then
    # This is to move us to the next line past the login: prompt
    echo "" >>/dev/console
    echo "FATAL: Cannot find USB key... ${mount_usb_msg}" >>/dev/console
    exit 1;
fi

# Create a link to the config as /etc/headnode.config, so we can have a
# consistent location for it when we want to be able to umount the USB later
ln -s /mnt/config /etc/headnode.config

admin_nic=`/usr/bin/bootparams | grep "^admin_nic=" | cut -f2 -d'=' | sed 's/0\([0-9a-f]\)/\1/g'`

# check if we've imported a zpool
POOLS=`zpool list`

if [[ ${POOLS} == "no pools available" ]]; then

    # This is to move us to the next line past the login: prompt
    echo "" >>/dev/console

    /mnt/scripts/joysetup.sh || exit 1

    echo -n "Importing zone template dataset... " >>/dev/console
    bzcat /mnt/bare.zfs.bz2 | zfs recv -e zones || exit 1;
    echo "done." >>/dev/console
    reboot
    exit 2
fi

# Now the infrastructure zones

NEXTVNIC=`dladm show-vnic | grep -c vnic`

ZONES=`zoneadm list -i | grep -v "^global$"`

LATESTTEMPLATE=''
for template in `ls /zones | grep bare`; do
    LATESTTEMPLATE=${template}
done

USBZONES=`ls /mnt/zones`
ALLZONES=`for x in ${ZONES} ${USBZONES}; do echo ${x}; done | sort -r | uniq | xargs`
CREATEDZONES=

for zone in $ALLZONES; do
{'fraction_non_alphanumeric': 0.13830783640337183, 'fraction_numerical': 0.010615048392132375, 'mean_word_length': 3.1182519280205656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '4290770', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1170, 'n_words': 419}