<commit_before>#!/bin/sh

# This script is executed on the first boot after install has
# completed. It is best to edit the middle of the file as
# noted below so custom commands are executed before
# the script notifies confluent that install is fully complete.

nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
confluent_apikey=$(cat /etc/confluent/confluent.apikey)
confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}')
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
export nodename confluent_mgr confluent_profile
. /etc/confluent/functions
exec >> /var/log/confluent/confluent-firstboot.log
exec 2>> /var/log/confluent/confluent-firstboot.log
tail -f /var/log/confluent/confluent-firstboot.log > /dev/console &
logshowpid=$!
while ! ping -c 1 $confluent_mgr >& /dev/null; do
	sleep 1
done

if [ ! -f /etc/confluent/firstboot.ran ]; then
    touch /etc/confluent/firstboot.ran

    cat /etc/confluent/tls/*.pem >> /etc/pki/tls/certs/ca-bundle.crt

    run_remote firstboot.custom
    # Firstboot scripts may be placed into firstboot.d, e.g. firstboot.d/01-firstaction.sh, firstboot.d/02-secondaction.sh
    run_remote_parts firstboot.d

    # Induce execution of remote configuration, e.g. ansible plays in ansible/firstboot.d/
    run_remote_config firstboot.d
fi

curl -X POST -d 'status: complete' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
systemctl disable firstboot
rm /etc/systemd/system/firstboot.service
rm /etc/confluent/firstboot.ran
kill $logshowpid<commit_msg>Fix firstboot with ipv6 deployment in el8<commit_after>#!/bin/sh

# This script is executed on the first boot after install has
# completed. It is best to edit the middle of the file as
# noted below so custom commands are executed before
# the script notifies confluent that install is fully complete.

nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
confluent_apikey=$(cat /etc/confluent/confluent.apikey)
v6cfg=$(grep ^ipv6_method: /etc/confluent/confluent.deploycfg)
v6cfg=${v6cfg#ipv6_method: }
if [ "$v6cfg" = "static" ]; then
    confluent_mgr=$(grep ^deploy_server_v6: /etc/confluent/confluent.deploycfg)
    confluent_mgr=${confluent_mgr#deploy_server_v6: }
    confluent_pingtarget=$confluent_mgr
    confluent_mgr="[$confluent_mgr]"
else
    confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg)
    confluent_mgr=${confluent_mgr#deploy_server: }
    confluent_pingtarget=$confluent_mgr
fi
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
export nodename confluent_mgr confluent_profile
. /etc/confluent/functions
exec >> /var/log/confluent/confluent-firstboot.log
exec 2>> /var/log/confluent/confluent-firstboot.log
tail -f /var/log/confluent/confluent-firstboot.log > /dev/console &
logshowpid=$!
while ! ping -c 1 $confluent_pingtarget >& /dev/null; do
	sleep 1
done

if [ ! -f /etc/confluent/firstboot.ran ]; then
    touch /etc/confluent/firstboot.ran

    cat /etc/confluent/tls/*.pem >> /etc/pki/tls/certs/ca-bundle.crt

    run_remote firstboot.custom
    # Firstboot scripts may be placed into firstboot.d, e.g. firstboot.d/01-firstaction.sh, firstboot.d/02-secondaction.sh
    run_remote_parts firstboot.d

    # Induce execution of remote configuration, e.g. ansible plays in ansible/firstboot.d/
    run_remote_config firstboot.d
fi

curl -X POST -d 'status: complete' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
systemctl disable firstboot
rm /etc/systemd/system/firstboot.service
rm /etc/confluent/firstboot.ran
kill $logshowpid
{'fraction_non_alphanumeric': 0.11632814560801899, 'fraction_numerical': 0.007649696649960433, 'mean_word_length': 4.719457013574661, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '4625372', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1377, 'n_words': 303}